GLASSWING showed up in a batch of invoice-themed attachments in late October. On the surface it’s an unremarkable .NET downloader. Underneath, the second stage is a careful piece of native code: no plaintext strings at all, a hand-rolled API hashing scheme, and a C2 protocol dressed up as Windows telemetry. This post walks through both stages and ends with a config extractor you can run against new samples.
Triage#
The first stage is a 412 KB .NET assembly named InvoiceViewer.exe. It’s obfuscated with a commodity protector, but the control flow survives de4dot well enough to read. The interesting part is a 96 KB blob in the managed resources named glass.bin, with entropy near 7.98. That’s our second stage.
$ diec InvoiceViewer.exe
PE32+
Library: .NET(v4.0.30319)[-]
Protector: ConfuserEx(1.x)[Maximum]
Overlay: Binary
$ ent glass.bin
Entropy = 7.981204 bits per byte.Stage 1: unwrapping the resource#
The loader reads glass.bin, then decrypts it with RC4 using a key derived from the assembly’s own module version ID. Tying the key to the MVID means a rebuilt sample gets a fresh key for free, which defeats naive static signatures on the encrypted blob.
byte[] blob = GetResource("glass.bin");
byte[] key = SHA256.Create().ComputeHash(
typeof(Program).Module.ModuleVersionId.ToByteArray());
byte[] pe = Rc4(key.Take(16).ToArray(), blob);
Hollow(@"C:\Windows\System32\dllhost.exe", pe);Hollow is textbook process hollowing (T1055.012 Process Hollowing): create dllhost.exe suspended, unmap its image, write the payload, fix the thread context, resume. Nothing novel, but it does mean the native stage never touches disk in its decrypted form.
Stage 2: strings that only exist on the stack#
Open the native payload in a disassembler and the string view is almost empty. Every string is built byte by byte on the stack, then XOR-decrypted in place with a rolling key. Here’s the decryptor, which is inlined at nearly 300 call sites:
; rcx = buffer, edx = length, r8b = seed
decrypt_stack_string:
xor eax, eax
.loop:
mov r9b, r8b
add r9b, al ; key = seed + index
rol r9b, 3
xor byte [rcx+rax], r9b
inc eax
cmp eax, edx
jb .loop
retThe key for each byte is rol8(seed + i, 3), and the seed is a single immediate loaded just before the call. That makes the scheme trivial to emulate once you can find the seed and the stacked bytes, so the next step is scripting that across the whole binary.
Recovering every string at once#
Rather than emulate, I pattern-match each call site in Ghidra: walk backwards from the CALL to collect the MOV byte [rsp+n], imm8 instructions and the MOV r8b, imm8 seed, decrypt, and write the result as a comment.
def rol8(v, n):
return ((v << n) | (v >> (8 - n))) & 0xFF
def decrypt(buf: bytes, seed: int) -> str:
out = bytes(b ^ rol8((seed + i) & 0xFF, 3) for i, b in enumerate(buf))
return out.decode("utf-8", errors="replace")
for call in find_calls(DECRYPTOR):
seed, stacked = collect_stack_bytes(call, max_back=64)
if stacked:
setPreComment(call, decrypt(stacked, seed))That recovers 287 strings, including the C2 hosts, the user agent, and the beacon path. The fake telemetry theme is consistent: the user agent claims to be Microsoft-CryptoAPI/10.0 and the beacon goes to a /v2/metrics/ingest endpoint.
Command and control#
Beacons are HTTPS POST requests with a JSON body that mimics a telemetry upload. The real payload is the blob field: AES-256-CBC with a per-host key, then base64. The C2 picks tasks by returning an equally boring-looking JSON body.
| Field | Purpose |
|---|---|
ver | Hard-coded 2.1.7, the build tag |
sid | FNV-1a hash of the machine GUID |
blob | Encrypted host survey or task result |
ts | Unix time, used as part of the IV |
Supported tasks are limited: download and execute, run a shell command, update the C2 list, and uninstall. GLASSWING is a door, not a house; in the cases I’ve seen, the follow-on payload was a commodity infostealer.
Persistence#
On first run the payload copies itself into a folder named to look like a Windows Store package, then registers a scheduled task named MicrosoftEdgeTelemetrySvc that runs at logon (T1053.005 Scheduled Task).
Detection#
The stack-string decryptor is the most stable feature across the six builds I have. The YARA rule for it is in its own post: catching GLASSWING’s string decryptor.
Indicators#
Indicators of compromise 10
| Type | Indicator | Context |
|---|---|---|
| sha256 | 4afbb3264c77ed6a41dc6aabaf0c2268634a7c5b244a3a6744275d0e137d4c39 | Stage 1, InvoiceViewer.exe (.NET) |
| sha256 | 5149d4b05f91777e9e0c0ff65c557fbb9219ef5b8e2b97d73e34548e31c745c8 | Stage 2, decrypted native payload |
| md5 | 6c15de782971dfc715780b3c47fe4a9a | Stage 1, same file as above |
| domain | telemetry-cdn[.]example | Primary C2 |
| domain | update-metrics[.]example | Fallback C2, hard-coded |
| url | hxxps://telemetry-cdn[.]example/v2/metrics/ingest | Beacon endpoint, POST |
| ip | 203[.]0[.]113[.]47 | Resolved for primary C2, 2026-11-02 to 2026-11-14 |
| ip | 198[.]51[.]100[.]212 | Payload staging server |
| mutex | Global\{7E1F2A90-GLW-4C1B} | Single-instance check |
| path | %LOCALAPPDATA%\Packages\Microsoft.Windows.Telemetry\tmsvc.exe | Persistence copy |
