TL;DR
Windows Defender quarantined the ransomware but the evidence set ships the quarantine store. Decrypt the quarantine with the static MsMpEng RC4 key, read the AES key out of the dropper, rebuild the IV from host identifiers found in the registry, and decrypt the victim files.
01Recon
The evidence archive is a classic Windows triage collection:
EncryptedFiles/ 9 x *.enc (sizes all multiples of 16, no header, high entropy)
EventLogs/ Security, System, Application, PowerShell-Operational,
Defender-Operational, TerminalServices (.evtx)
Prefetch/ *.pf + Ag*.db
Registry/ SYSTEM, SOFTWARE, NTUSER.DAT
Quarantine/ Entries/{8003AEBB-...} Resources/36/367F08... ResourceData/36/367F08...
READ_ME.txt the ransom note (UTF-16LE)The ransom note names the victim: Your Unique ID: LOCK-DESKTOP-KLPAT9O-JM-20260628-7F3A.
The.enc files carry no magic bytes, no salt and no IV, every length is an exact multiple of 16. That rules out a self-describing container and means the key material has to come from somewhere else in the image. The Quarantine/ tree is that somewhere: Defender caught the dropper and kept a copy.
02The bug
Two design decisions in the ransomware make full recovery possible:
- The AES key is a hard-coded literal in the dropper, obfuscated only by Chr() concatenation, and the dropper itself survives in Defender's quarantine store.
- The IV is derived from non-secret host identifiers, MD5(COMPUTERNAME + USERNAME), both of which are recoverable from the registry hives in the same evidence set (and the computer name is printed in the ransom note).
Defender's quarantine store is itself only obfuscated, not encrypted: every file is RC4 with a static, publicly documented 256-byte key compiled into MsMpEng.
03Exploitation
- Decrypt the quarantine store. RC4 each of the three files with the static MsMpEng key. The ResourceData entry parses as:
dword magic1 = 3 ; dword magic2 = 2 ; dword sd_len = 0xAC (security descriptor)
payload starts at 0x28 + sd_len = 0xD4The payload is a 4,557-byte HTA, Q3 Financial Review - Loading, carrying a VBScript Window_OnLoad that builds and runs a PowerShell one-liner.
- Read the crypto out of the dropper.
k = Chr(70) & Chr(120) & Chr(55) & Chr(109) & Chr(75) & Chr(57) & Chr(118) & Chr(76) _
& Chr(50) & Chr(110) & Chr(81) & Chr(52) & Chr(119) & Chr(80) & Chr(122) & Chr(33)which is Fx7mK9vL2nQ4wPz!. The PowerShell then does:
$kb = [Text.Encoding]::UTF8.GetBytes($p.PadRight(32).Substring(0,32)) # key
$ivSeed = $env:COMPUTERNAME + $env:USERNAME
$iv = [Security.Cryptography.MD5]::Create().ComputeHash(
[Text.Encoding]::UTF8.GetBytes($ivSeed)) # IV
$a.Key = $kb; $a.IV = $iv; $a.Mode = 0; $a.Padding = 2So: AES-256, key = "Fx7mK9vL2nQ4wPz!" right-padded to 32 bytes with spaces. $a.Mode = 0 is not a valid CipherMode; the assignment throws and is swallowed by $ErrorActionPreference='SilentlyContinue', so the mode stays at.NET's default, CBC. Padding = 2 is PKCS#7.
- Rebuild the IV. COMPUTERNAME is DESKTOP-KLPAT9O (ransom note, confirmed in Registry/SYSTEM). For USERNAME, the note only gives the first two letters uppercased (JM); the profile path in the hives gives it exactly:
$ strings -el Registry/SOFTWARE | grep -iE '^C:\\Users\\[^\\]+$'
C:\Users\jmartinIV = MD5("DESKTOP-KLPAT9O" + "jmartin") = a31de3916e88f240c2bf08735b965aa9.
- Decrypt and read. All 9 files decrypt to clean UTF-8 with valid PKCS#7. The flag is in
Q3_auth_memo.txt, base64-encoded "for secure internal transmission":
QkhGbGFnWXtkM2YzbmQzcl9xdTRyNG50MW4zX3IzYzB2M3J5XzIwMjZ9
-> BHFlagY{...}Key code KEY = bytes([0x1E,0x87,0x78,0x1B,0x8D,0xBA,0xA8,0x44...]) # 256-byte static MsMpEng RC4 key
def rc4(data, key=KEY):
S = list(range(256)); j = 0
for i in range(256):
j = (j + S[i] + key[i % len(key)]) & 0xff
S[i], S[j] = S[j], S[i]
out = bytearray(); i = j = 0
for c in data:
i = (i + 1) & 0xff; j = (j + S[i]) & 0xff
S[i], S[j] = S[j], S[i]
out.append(c ^ S[(S[i] + S[j]) & 0xff])
return bytes(out)
dec = rc4(open(RESOURCE_DATA, 'rb').read())
sd_len = struct.unpack('<I', dec[8:12])[0]
hta = dec[0x28 + sd_len:] # the quarantined dropper
key = "Fx7mK9vL2nQ4wPz!".ljust(32).encode() # AES-256
iv = hashlib.md5(b"DESKTOP-KLPAT9O" + b"jmartin").digest()
pt = AES.new(key, AES.MODE_CBC, iv).decrypt(open(f,'rb').read())04Dead ends
- PKCS#7 validity does not confirm the IV. In CBC the final block depends only on the previous ciphertext block, so every IV candidate passes a padding check. Three candidate usernames all gave 9/9 valid padding; only inspecting the first plaintext block distinguishes them.
- $a.Mode = 0 looks like ECB at a glance (in some libraries 0 means ECB). In.NET, CipherMode has no member 0; the property setter throws and SilentlyContinue hides it, so the effective mode is the default CBC. Decrypting as ECB produces garbage in every block.
- The Quarantine/Resources and Quarantine/Entries files unpack with a per-section RC4 stream rather than one continuous stream; only ResourceData is needed, so this never had to be resolved.