Dynamic Malware Analysis
Dynamic analysis means running the sample in a controlled environment and observing its real behavior: what processes it creates, what it touches on disk and in the registry, what connections it attempts, what persistence it installs. It reveals what static analysis can’t see (encrypted/packed code, input-dependent logic), but it runs dangerous code, so isolation is absolute. It’s dynamic reverse engineering applied to malicious samples, aimed at extracting behavior and IOCs to detect.
Threat model
Section titled “Threat model”Dynamic analysis is powerful because malware gives itself away by acting: however packed it is, when it runs it has to unpack in memory and do what it came to do. The adversary counters with anti-sandbox/anti-VM (won’t detonate if it detects the lab) and conditional logic (only acts at a certain time, with a certain system language, or after human interaction). That’s why the environment must look real and the analyst must be ready to force execution.
The operational risk is obvious: you’re running a weapon. An isolation failure can infect your network or leak that you’re analyzing the sample (OPSEC). The environment isn’t a detail: it’s half the job.
The environment (the most important part)
Section titled “The environment (the most important part)”- Dedicated VM with a clean snapshot before each run, on a hypervisor separate from your host.
- Simulated network: INetSim or FakeNet-NG fake DNS/HTTP/HTTPS to capture the domains/URLs the sample contacts without letting it out.
- Distros: REMnux for the analysis side and a Windows victim VM (FLARE-VM).
- Anti-sandbox: many families detect VM/sandbox and won’t run (see Obfuscation and packing); hardened VMs that look real are used, or bare-metal for very evasive samples.
Golden rule: clean snapshot, isolated/simulated network, and the lab never connected to your network or the Internet uncontrolled.
What to monitor
Section titled “What to monitor”Observation tools on Windows (equivalents on Linux with strace/sysdig/auditd):
- Process Monitor (ProcMon) — all activity: files, registry, processes, network.
- Process Hacker / Process Explorer — process tree, injections, handles, in-memory strings.
- Autoruns — installed persistence (see Persistence).
- Regshot — registry and filesystem diff before/after.
- Wireshark / tcpdump — generated traffic (see Network sniffing); FakeNet/INetSim logs tell which domains/IPs it contacted.
Sandboxes (CAPEv2, Cuckoo, ANY.RUN interactive, Joe Sandbox) automate all of this: they run the sample and produce a behavior report + IOCs. They’re the first step, not the last: their report guides the manual analysis.
Behaviors to identify
Section titled “Behaviors to identify”flowchart TD E[Execution] --> P[Processes<br/>children · injection into legit] E --> F[Disk/registry<br/>copies · keys · files] E --> N[Network<br/>DNS/DGA · beacons · 2nd stage] E --> A[Actions<br/>encryption · cred theft · keylog] P --> X[IOCs + TTPs] F --> X N --> X A --> X
- Deployment: copies/renames itself, spawns child processes, injects into legitimate processes (
explorer.exe,svchost.exe) to hide — at the level of recognizing the technique (process hollowing, APC injection), not implementing it. - Persistence: Run keys, scheduled tasks, services, startup folders (see Persistence).
- Network / C2: domain resolution (sometimes DGA), HTTP/HTTPS/DNS beacons, second-stage download (see C2).
- Actions: mass encryption (see Ransomware), credential/browser theft, keylogging, creating a mutex (prevents double infection → excellent IOC).
Memory dumping (unpacking and config)
Section titled “Memory dumping (unpacking and config)”Malware decrypts its code and configuration in memory. Dumping the already-unpacked process reveals what static analysis couldn’t:
- Process Hacker → dump, or pe-sieve/hollows_hunter (detect injection/hollowing and dump the module).
- Analyze the dump statically (strings, CAPA) → C2 config, second stage.
- For the full system, Volatility 3 (hidden processes, injections, connections): see Memory forensics applied to malware.
Configuration extraction
Section titled “Configuration extraction”Many families keep their config (C2, keys, campaign) encrypted in the binary and decrypt it at runtime. After unpacking in memory it’s extracted with per-family config extractors: CAPE ships many built in, and MWCP and community scripts exist. The config is gold for IOCs and campaign attribution.
Red Team
Section titled “Red Team”In authorized exercises, detonating your own artifact in a lab identical to the blue team’s shows what telemetry it generates: which Sysmon events it fires, what it leaves in ProcMon, what shows on the network. If your implant lights up half an EDR console, the exercise already told you what you needed. The goal is to measure visibility, not to hide for hiding’s sake.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Observed behavior feeds Sigma rules (logs/EDR) and in-memory YARA (YARA).
- Mapping to MITRE ATT&CK yields per-technique detections (injection, beaconing, persistence), more robust than per-hash.
Telemetry
Section titled “Telemetry”- Sysmon is the key source: process created (1), network connection (3), image load (7), CreateRemoteThread (8), process access (10), file create (11), registry (12-14).
- Centralize and correlate; mutexes and disk artifacts are high-fidelity IOCs.
Response
Section titled “Response”Network IOCs (C2 domains/IPs) are blocked at DNS/firewall; the full behavior chain builds the containment runbook (see DFIR).
CVEs and real-world cases
Section titled “CVEs and real-world cases”- ANY.RUN and CAPE are references for interactive/automated dynamic analysis; their behavior reports are standard in SOCs.
- Families like GuLoader or Snake Keylogger are known for strong anti-sandbox/anti-VM, forcing hardened environments.
- Typical ATT&CK techniques in dynamic analysis: T1055 (Process Injection), T1497 (Virtualization/Sandbox Evasion), T1071 (Application Layer Protocol / C2).
Testing checklist
Section titled “Testing checklist”- Isolated environment with snapshot and simulated network (INetSim/FakeNet-NG)
- Active monitoring: ProcMon, Process Hacker, Regshot, Wireshark, Autoruns
- Run and observe: child processes, injection, disk, registry
- Capture network activity (C2 domains/IPs/URLs, beaconing)
- Identify installed persistence
- Dump memory to unpack and extract config
- Volatility if system memory analysis is needed (memory)
- IOCs + behavior → detection (Sigma/YARA, ATT&CK mapping)