1. Delivery Chain: ISO → LNK → DLL Sideloading
Spear-phishing email with the subject «Q3 Financial Audit — Confidential». Attachment Audit_Q3_2024.iso (2.1 MB). Inside:
Setup.exe from the ISO working directoryWhen the ISO is mounted and the LNK is clicked, Setup.exe runs and looks for Setup.dll in the current directory (DLL Search Order Hijacking). It loads the malicious DLL → Entry Point DllMain → shellcode execution.
2. Loader Analysis — Unpacking Shellcode
The DLL exports DllRegisterServer (typical for regsvr32) and ServiceMain. In DllMain(DLL_PROCESS_ATTACH):
- Anti-VM: checks
SMBIOS(VMware/VirtualBox),CPUIDhypervisor bit, MAC addresses (00:0C:29, 00:50:56, 00:1C:14), processes (vmtoolsd, vboxtray, wireshark, procmon, ida, x64dbg). - Anti-Debug:
IsDebuggerPresent,CheckRemoteDebuggerPresent,NtQueryInformationProcess(ProcessDebugPort),NtSetInformationThread(ThreadHideFromDebugger), timing checks (RDTSC). - Time-based evasion:
GetTickCount64delta > 10 min between runs → exit. - If all checks pass — allocates RWX memory (
VirtualAlloc), decrypts the embedded shellcode (XOR 0x9A + ROL 3), copies it, spawns a thread (CreateThread).
# Shellcode Extraction from Loader (IDAPython)
import idc, idaapi, idautils
def find_shellcode():
# Pattern: VirtualAlloc + RtlMoveMemory + CreateThread
for ea in idautils.Functions():
name = idc.get_func_name(ea)
if 'DllMain' in name or 'sub_' in name:
for head in idautils.Heads(ea, idc.get_func_attr(ea, idc.FUNCATTR_END)):
mnem = idc.print_insn_mnem(head)
if mnem == 'call':
op = idc.print_operand(head, 0)
if 'VirtualAlloc' in op:
print(f'VirtualAlloc at 0x{head:X}')
# Trace back to find shellcode buffer
# ...
# XOR Decoder
shellcode_enc = bytes([0x9A ^ b for b in raw_shellcode])
shellcode = bytes([(b << 3 | b >> 5) & 0xFF for b in shellcode_enc]) # ROL 3
with open('beacon_shellcode.bin', 'wb') as f:
f.write(shellcode)The extracted shellcode (298 KB) is a Cobalt Strike Beacon (Stageless, x64). We load it into Cobalt Strike Parser (CS2CF / beacon-config-extractor) to pull the config.
3. Cobalt Strike Beacon Config Extraction
The Beacon config is encrypted with RC4 (the key is derived from the watermark). The parser locates the config by the 0x00 0x00 0x00 0x00 signature (beacon metadata header) plus known offsets.
{
"watermark": 1337,
"beacon_type": "x64 stageless",
"c2": [
{
"protocol": "https",
"host": "cdn.financial-audit-services[.]com",
"port": 443,
"uri": "/api/v1/telemetry",
"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Accept": "*/*",
"Connection": "keep-alive"
}
}
],
"spawnto_x86": "C:\\Windows\\SysWOW64\\rundll32.exe",
"spawnto_x64": "C:\\Windows\\System32\\rundll32.exe",
"pipename": "msagent_%d",
"sleep": 60000,
"jitter": 23,
"maxdns": 255,
"dns_idle": "8.8.8.8",
"dns_sleep": 0,
"proxy_behavior": "use_ie",
"killdate": "2025-12-31",
"proc_inject": {
"min_alloc": 17500,
"startrwx": false,
"userwx": false,
"transforms": ["x64\\thread_hijack", "x64\\dynamic_syscall"],
"execute": "CreateThread"
}
}Key details for hunting:
Watermark: 1337
Cobalt Strike 4.0+ (trial/leaked). Not unique, but confirms the CS framework.
Malleable Profile: «Amazon CloudFront»
C2 URI /api/v1/telemetry, headers mimic legitimate API traffic. TLS JA3 fingerprint = 771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-156-157-47-53 (matches the public «Amazon CloudFront» profile from the Malleable C2 Profiles repository).