MALWARE ANALYSIS & REVERSE ENGINEERING
Methodology · Static Analysis · Dynamic Analysis · Ghidra · YARA Rules · Ransomware Anatomy · Evasion · Memory Forensics
Analysis Methodology & Lab Setup
- Always start with static triage (hash, strings, imports) before ever executing a sample
- Take a clean VM snapshot before execution — you need to be able to roll back instantly
- INetSim simulates network services inside the VM — malware C2 traffic becomes observable and safe
- REMnux is the purpose-built Linux distro for malware analysis — includes all the tools pre-configured
Malware analysis is like a forensic autopsy — you are studying a dangerous thing in a controlled environment to understand exactly what it does. There are two main approaches: static (examining the file without running it) and dynamic (running it in a sealed container and observing behavior). Professionals use both.
A strange parcel is dumped at your plot gate with no sender. You do not tear it open on the sitting-room table. You carry it to an empty spare room where a mess can be contained, read everything printed on the outside first — weight, labels, who it is addressed to — and only then, carefully, cut the tape. That spare room is your isolated analysis VM; reading the outside is static analysis; opening it under watch is dynamic analysis. Never open the parcel in the room where you live.
Analysis Approaches
| APPROACH | METHOD | TOOLS | WHEN TO USE |
|---|---|---|---|
| Static (basic) | Strings, hashes, imports — no execution | strings, file, pestudio, pefile | First 5 minutes — quick triage |
| Static (advanced) | Disassembly, decompilation, code flow analysis | IDA Pro, Ghidra, Binary Ninja | Deep understanding without execution risk |
| Dynamic (basic) | Execute in sandbox, observe behaviour | Any.run, Cuckoo, Hybrid Analysis | Fast behavioural overview |
| Dynamic (advanced) | Interactive analysis, API monitoring, memory dumps | x64dbg, Procmon, Wireshark | Bypass evasion, full control needed |
| Hybrid | Static to map structure, dynamic to confirm | All of the above | Complete picture — used in reports |
Analysis Workflow
Phase 1: TRIAGE (5 minutes) - Hash the file, check VirusTotal - strings output for quick intel - file type identification - Submit to sandbox (runs in parallel) Phase 2: STATIC ANALYSIS (30-60 minutes) - PE header analysis (imports, sections, entropy) - Disassemble/decompile key functions - Map code flow and identify capabilities - Document IOCs: strings, domains, registry keys Phase 3: DYNAMIC ANALYSIS (30-60 minutes) - Execute in isolated VM (snapshot first!) - Monitor: filesystem, registry, network, processes - Capture full network traffic with Wireshark - Interactive if needed (sandbox or manual) Phase 4: REPORTING - Document: capabilities, persistence, IOCs - Write YARA rule if novel sample - Threat intel sharing if appropriate
Safe Lab Setup
# Isolated VM (VMware or VirtualBox): # - Windows 10/11 for PE malware # - Take CLEAN SNAPSHOT before any execution # - Network: Host-only or NAT (NEVER bridged to real network) # - No shared folders between host and analysis VM # - No clipboard sharing during execution # REMnux — purpose-built malware analysis distro: # https://remnux.org # Includes: volatility, viper, radare2, yarGen, pdftools # Fake network services (inside analysis VM): sudo apt install inetsim sudo inetsim # Simulates DNS, HTTP, SMTP, FTP responses # Malware connects to fake C2 → you see its comms # Handling samples safely: # - Rename .exe to .malz or .vir to prevent accidental run # - Store in password-protected ZIP (password: infected) # - SHA256 hash is your sample identifier # - NEVER double-click — always Open With or run in sandbox
Never execute malware samples on your host machine or any network-connected system you care about. Use an isolated virtual machine with networking disabled or pointed at INetSim. The only exception is deliberate dynamic analysis with proper containment. One mistake = real infection.
- Always start with static triage (hash, strings, imports) before ever executing a sample
- Take a clean VM snapshot before execution — you need to be able to roll back instantly
- INetSim simulates network services inside the VM — malware C2 traffic becomes observable and safe
- REMnux is the purpose-built Linux distro for malware analysis — includes all the tools pre-configured