Digital Forensics & IR / Malware Engineering

Malware Analysis & Reverse Engineering

Malware analysis answers a narrow operational question: what does this sample do, what does it talk to, and how would the estate know if it ran somewhere else. Each successive technique costs more analyst time than the last, so the discipline is mostly about stopping at the stage that answers the question actually being asked. The output that matters is not the analysis write-up but the detection content derived from it — byte patterns as YARA rules, behavior as Sigma rules — because that is what protects the hosts nobody has looked at yet.

Three panels. The first covers static inspection and detonation: PE and ELF header parsing, string and import table extraction, and the split between a self-hosted isolated lab and a hosted cloud sandbox, noting that a hosted submission is not air-gapped. The second covers reverse engineering and rule authoring: disassembly and decompilation in Ghidra or IDA Pro, dumping an unpacked payload from memory at the original entry point, and turning findings into YARA byte rules and Sigma behavioral rules. The third covers lab safety and what analysis does not prove: written authorization before detonation, a network the sample cannot escape, and the fact that a clean dynamic run may mean evasion rather than benign behavior.

Static inspection ↔ isolated or hosted detonation ↔ decompilation and memory unpacking ↔ YARA and Sigma rule authoring

Before detonating anything

Running live malware is the one activity on this page with consequences outside the analyst’s machine. Three prerequisites apply before the first execution:

The four stages of analysis

The four-stage split below follows the taxonomy in Sikorski and Honig’s Practical Malware Analysis, which is the vocabulary most analysts use. Each stage costs more time than the last, so the useful question is which stage answers the question at hand rather than how far down the list one can get.

Analysis stage Method What it yields Typical tooling
1. Basic static Inspecting file properties without executing the payload. SHA-256 and fuzzy hashes, PE/ELF header structure, imported functions (IAT), compiler artifacts, extracted strings, capability guesses. pestudio, strings, file, capa, VirusTotal.
2. Basic dynamic Executing the sample in an isolated environment while recording behavior. Process trees, registry and filesystem changes, dropped files, attempted C2 destinations. Self-hosted: CAPE, Procmon, Wireshark, INetSim. Hosted: ANY.RUN, Joe Sandbox.
3. Advanced static Reading the disassembly and decompiled output. Reconstructed pseudocode, algorithm logic, key derivation, C2 protocol structure, capability the sample did not exercise at runtime. Ghidra, IDA Pro, Binary Ninja, radare2.
4. Advanced dynamic Stepping through execution under a debugger. Unpacked payloads dumped from memory, anti-debugging checks bypassed, keys recovered from live state. x64dbg, x32dbg, GDB, WinDbg.

Self-hosted versus hosted detonation

Stage 2 has two operating models that are frequently treated as one. A self-hosted lab runs on hardware or a hypervisor under local control, on an isolated segment with simulated services. A hosted sandbox is an internet service that runs the sample on someone else’s infrastructure.

A hosted sandbox is by construction not air-gapped, and on free tiers the analysis is normally public — ANY.RUN’s plans list “unlimited public analyses” for the Community tier and reserve private analyses for paid tiers. For a sample pulled from a live incident that matters twice over: the submission can expose victim-identifying artifacts such as internal hostnames, share paths, and targeted user names, and an adversary monitoring public sandbox feeds for their own tooling learns that they have been detected. Incident samples belong in the self-hosted lab; hosted services are for commodity samples where neither concern applies.

What a clean dynamic run does not prove

Sandbox output is evidence of what the sample did in that environment, during that window. Malware routinely declines to act when it detects one:

A sample that does nothing in a sandbox is therefore not established as benign; it is unresolved, and the question moves to Stage 3, where capability is visible in the code whether or not it executed.

Packers, crypters, and unpacking from memory

Packers and crypters (UPX, Themida, commodity XOR string encryption) exist to defeat static inspection: the analyst sees a small stub and a high-entropy blob rather than the real code.

  1. How packing works at runtime: the packed executable contains a stub and an encrypted payload buffer. On execution the stub allocates writable-executable memory (VirtualAlloc with PAGE_EXECUTE_READWRITE), decrypts the payload into it, and transfers control to the original entry point (OEP) of the unpacked program.
  2. How to recover the payload: set breakpoints on memory allocation APIs and on the tail jump into the freshly written region, let the stub finish decrypting, then dump the unpacked image from memory to disk. The dumped binary is what Stage 1 and Stage 3 techniques should be run against — analyzing the packed file yields the stub’s behavior, not the malware’s.

A dumped image is not a valid on-disk executable without import reconstruction, so expect to repair the import table before a decompiler produces useful output.

Turning findings into detection content

Two rule formats carry different halves of the finding. YARA matches bytes and strings in files and memory. Sigma matches behavior in logs. A sample usually justifies one of each: the byte pattern catches the exact build, the behavioral rule catches the technique after the build changes.

The two rules below are illustrative examples written for this journal, not validated detections. The YARA strings and byte pattern are invented to show rule structure; they have not been tested against real samples and would need validation against both malicious and known-good binaries before deployment.

rule Example_Packed_Ransomware_Structure
{
    meta:
        description = "Illustrative YARA rule structure - not a validated signature"
        author      = "Field Journal (illustrative example)"
        date        = "2026-08-15"
        reference   = "https://attack.mitre.org/software/S1202/"
    strings:
        $s1 = "LockBit 3.0" ascii wide nocase
        $s2 = ".README.txt" ascii wide
        $hex_pattern = { 8B 45 ?? 33 C9 89 4D ?? 8B 4D ?? 8B 11 }
    condition:
        uint16(0) == 0x5A4D and (2 of ($s*) or $hex_pattern)
}

uint16(0) == 0x5A4D reads the first two bytes little-endian, so it matches the MZ header and restricts the rule to PE files. That also means it will not match a memory dump or a minidump artifact such as lsass.dmp, which begins with MDMP — scanning dumps needs a separate rule without the header check.

The behavioral counterpart, trimmed to its essential fields:

title: Shadow Copy Deletion via Vssadmin
status: experimental
description: Detects deletion of volume shadow copies, a common pre-encryption step
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith: '\vssadmin.exe'
        CommandLine|contains|all:
            - 'delete'
            - 'shadows'
    condition: selection
falsepositives:
    - Backup software pruning shadow copies on a schedule
level: high

Rule authoring as a pipeline — testing, transpilation to native SIEM queries, rule status lifecycle, and the metrics that tell you whether a rule is earning its place — is covered in Detection Engineering & SIEM Analytics. Note also that YARA-X, the maintained Rust rewrite from VirusTotal, is the direction of travel for new deployments; rule syntax is largely compatible, but validate before migrating an existing ruleset.

What a signature proves

A YARA hit means a byte pattern matched. It is not attribution: shared code, a common packer, and reused open-source components all produce matches across unrelated families. A YARA miss on a repacked or recompiled sample is the expected outcome rather than a failure, which is why file hashes and byte signatures sit at the bottom of the Pyramid of Pain described in Cyber Threat Intelligence & Threat Actor Profiling — they are cheap to deploy and cheap for an adversary to invalidate. The behavioral rule is what survives a rebuild.

Malware analysis capability review checklist

The checklist below is a journal working model, not a published audit standard. When setting up or auditing a malware analysis capability, evaluate these six criteria:

Diagnostic area Architectural evaluation question Verification & audit evidence
Isolated detonation network Is the self-hosted sandbox segment unable to route to production or the internet, with DNS and HTTP answered by simulated services? Sandbox network and routing configuration.
Submission policy Is there a written rule for which samples may go to a hosted sandbox, given that free-tier submissions are normally public? Sample handling policy & submission records.
Anti-evasion coverage Are analysis VMs hardened against trivial hypervisor detection, and are unresolved “did nothing” results escalated to static analysis rather than closed as benign? Evasion test results & triage disposition records.
Sample intake integrity Are SHA-256 and fuzzy hashes recorded at intake, with retention and destruction rules applied? Intake database records & disposal log.
Rule validation Are new YARA and Sigma rules tested against known-good corpora before deployment, not only against the sample? Rule test suite output & false-positive rates.
Intelligence sharing Are extracted indicators published to the threat intelligence platform, and exported as STIX 2.1 objects over a TAXII 2.1 Collection where a partner requires it? TIP records & TAXII collection configuration.
What I need to remember

Stop at the analysis stage that answers the question. A hosted sandbox is not air-gapped and its free-tier results are usually public, so incident samples stay in the self-hosted lab. A sample that does nothing in a sandbox is unresolved, not benign — evasion looks identical to inactivity, and the answer is in the code. Dump the unpacked payload from memory at the OEP, then produce both a YARA byte rule and a Sigma behavioral rule, because only the behavioral one survives a rebuild.

Primary references