Skip to content
Pwnversity
MAL-STATICintermediate · 7 min · upd. 2026-10

Static Malware Analysis

ATT&CKCWE

Static analysis examines a sample without running it: you inspect the file, its strings, its imports, its structure, and its code to deduce what it does. It’s the first safe stop (you don’t run dangerous code) and gives a broad view, though packed or obfuscated malware (see Obfuscation and packing) limits what’s visible without detonating. It’s reverse engineering applied to malicious samples, aimed at extracting behavior and IOCs to detect.

Static analysis is cheap and safe, but the adversary knows it: that’s why they pack, encrypt strings, and resolve APIs at runtime so the binary “at rest” tells as little as possible. The analyst’s strategy is to read what does remain visible (format, imports, entropy, resources) to decide whether it’s worth unpacking and moving to dynamic. Never assume a “clean” static result means benign: it may mean well packed.

Executable formats: what each header hints

Section titled “Executable formats: what each header hints”

The header reveals the platform and often the intent:

  • PE (Portable Executable, Windows) — starts with MZ. Of interest: sections (.text, .data, .rsrc), the IAT (import table), embedded resources, the compile timestamp, and the Authenticode signature (valid? stolen/expired?).
  • ELF (Linux/Unix) — starts with \x7fELF. Of interest: the type (EXEC/DYN), sections, dynamic symbols, and linking (static vs dynamic; stripped).
  • Mach-O (macOS/iOS) — magic feedface/cafebabe (the latter a universal binary with several architectures). Of interest: load commands, linked libraries, and code signature.

The import table is the fastest behavioral hint: which APIs a binary links suggests what it does without reading a line of disassembly.

Technical triage (identity and reputation)

Section titled “Technical triage (identity and reputation)”

Identity triage is detailed in Sample triage; static reuses it:

Ventana de terminal
sha256sum sample.bin # identifier for VT/MalwareBazaar
file sample.bin # PE / ELF / Mach-O / Office / PDF
Ventana de terminal
strings -a sample.bin # ASCII
strings -e l sample.bin # UTF-16LE (typical on Windows)
floss sample.bin # FLARE FLOSS: extracts OBFUSCATED/stacked strings

Many families build their strings at runtime (stackstrings, XOR) so strings won’t reveal them. FLOSS (Mandiant) recovers them statically: URLs, mutexes, paths, and keys you otherwise wouldn’t see.

Entropy near 8 bits/byte in code sections betrays compression or encryption. Tools like Detect It Easy (DIE) give per-section entropy and identify packer/compiler. High entropy + an almost empty IAT = a packed sample you’ll need to unpack (see Obfuscation and packing).

API groupings that tell a story (PE examples, with equivalents on other platforms):

  • VirtualAllocEx + WriteProcessMemory + CreateRemoteThread → code injection into another process.
  • InternetOpen / WinHttpConnect / socket → network / C2.
  • CryptAcquireContext / CryptEncrypt / BCrypt → encryption (possible ransomware).
  • RegSetValueEx / CreateService / schtasks → persistence.
  • IsDebuggerPresent / CheckRemoteDebuggerPresent → anti-analysis.

An almost empty IAT isn’t reassuring: it suggests dynamic resolution (LoadLibrary+GetProcAddress) to hide exactly these hints.

CAPA (Mandiant) reads the binary and maps its capabilities to MITRE ATT&CK and its own rules without you reading all the disassembly: “encrypts data using RC4”, “communicates over HTTP”, “injects code”. It’s the shortcut to a first verdict on what the sample does.

Minimal x86-64 refresher to read disassembly

Section titled “Minimal x86-64 refresher to read disassembly”

To follow Ghidra/IDA pseudocode, recall: registers (RAX return, RDI/RSI/RDX/RCX/R8/R9 arguments on System V; RCX/RDX/R8/R9 on Windows x64), the stack and the function prologue/epilogue, and recognizing if/else, switch, and loop patterns. You don’t need to write assembly: just reading it is enough to locate the config-decryption routine, the C2 logic, or the encryption algorithm. Detail in x86-64 assembly and Static analysis (reversing).

Ventana de terminal
olevba sample.doc # oletools: extracts and deobfuscates VBA macros
pdfid sample.pdf # embedded JavaScript, automatic actions
pdf-parser sample.pdf

PowerShell/JS/HTA scripts usually arrive base64-encoded or concatenated: deobfuscate them before interpreting (see Obfuscation and packing).

flowchart TD
  A[Sample] --> B[Format + headers<br/>PE / ELF / Mach-O]
  B --> C[Strings + FLOSS]
  C --> D[Entropy / packer<br/>DIE]
  D --> E{Packed?}
  E -->|Yes| F[Unpack<br/>see mal-obfus / mal-dynamic]
  E -->|No| G[Imports + CAPA]
  F --> G
  G --> H[Decompile key logic<br/>Ghidra / IDA]
  H --> I[Extract IOCs → YARA]

In authorized exercises, static analysis is used in reverse: review the footprint of your own artifact before using it —what strings, imports, and capabilities it would reveal to this same analysis— with utilities like ThreatCheck/DefenderCheck to learn which byte fires a signature. Understanding what gives a binary away to static analysis is exactly what a blue team will see.

  • Static is the signature factory: YARA rules (strings, byte sequences, PE conditions) and SIEM/EDR IOCs come from here.
  • imphash and CAPA group variants by imports/capabilities even when the hash changes.
  • Keep the static report (imports, capabilities, IOCs) for correlation and later hunting.

Detected capabilities prioritize response: if CAPA flags “encrypts files” and “deletes shadow copies”, treat the sample as ransomware and trigger the matching runbook even before dynamic analysis.

  • CAPA and imphash (Mandiant) are de facto standards in static PE triage.
  • Abuse of stolen/expired Authenticode signatures to look legitimate is recurrent (e.g. leaked certificates reused by stealers and loaders).
  • VBA-macro documents were the initial access for Emotet/Qakbot for years; Office blocking Internet macros by default (2022) shifted the threat toward containers (ISO, LNK, OneNote).
  • ATT&CK techniques inferred statically: T1055 (Process Injection), T1486 (Data Encrypted for Impact), T1027 (Obfuscated Files).
  • Format confirmed and headers reviewed (PE/ELF/Mach-O)
  • Strings with strings and FLOSS (obfuscated)
  • Entropy/packer assessed (DIE); decide whether to unpack
  • Imports/IAT read → behavior inferred (injection/network/crypto/persistence)
  • CAPA run → capabilities mapped to ATT&CK
  • Key logic decompiled (config decryption, C2, encryption)
  • Documents/scripts deobfuscated (olevba/pdf-parser)
  • IOCs extracted → YARA rules