Fundamentals

T1204

Malware Analysis Fundamentals

A foundational guide to malware analysis for SOC analysts — static vs dynamic analysis, hash types (MD5/SHA1/SHA256), packers and unpacking, sandbox escape techniques, and the analyst triage workflow.

View on Graph

What Malware Analysis Is and Why Analysts Need It

  • Malware analysis is the systematic examination of a suspicious file or URL to determine if it is malicious, how it operates, and what its objective is.
  • MITRE ATT&CK maps user execution of malicious payloads to T1204 (User Execution), and the defense falls under M1049 (Antivirus/Antimalware) and M1040 (Behavioral Prevention).
  • Analysts who understand malware analysis can distinguish between a confirmed threat and a false positive, triage samples quickly to determine response priority, and extract indicators (IOCs) for detection and blocking.
  • The discipline has two major branches: static analysis (examining the file without executing it) and dynamic analysis (running the file and observing its behavior).

Static Analysis — Examining the File Without Execution

Static analysis extracts information from the file itself without running it. It is the fastest and safest analysis method.

Hash Types — The First Check

Every file has a cryptographic hash — a fingerprint that uniquely identifies it. Analysts use three hash algorithms:

AlgorithmBit LengthSpeedCollision RiskUse Case
MD5128 bitsFastestKnown collisions (2004)Cached indicator lookup, de-duplication — not security-critical
SHA1160 bitsModerateTheoretical collisionsLegacy compatibility, some threat intel feeds
SHA256256 bitsModerateNone knownStandard for all security work — use this for detection and reporting

When to use which:

  • SHA256 — Primary hash for detection rules, VirusTotal lookups, and IOC sharing (MISP, STIX)
  • MD5 — Useful when searching legacy intel feeds or de-duplicating in large file collections
  • SHA1 — Rarely used today; some older security tools still reference it

File Metadata Examination

Before running any tools, read the file’s metadata:

# Linux — get file type and basic info
file suspicious.exe
# PE32 executable (GUI) Intel 80386, for MS Windows

# Extract PE metadata with exiftool
exiftool suspicious.exe

# Windows — check the digital signature
sigcheck.exe -a suspicious.exe
PE FieldWhat It RevealsSuspicious Pattern
Compile timestampWhen the binary was compiledCompile timestamp in the future; or 10+ years old with a recent file mod date
SubsystemGUI vs Console vs DriverGUI subsystem for a command-line tool is suspicious
Digital signatureSigned by a trusted CAMissing signature, self-signed, revoked cert, or mismatched publisher name
Original filenameName embedded during compilationMismatch between disk filename and PE metadata
Entry pointStarting address of executable codeEntry point in a non-standard section (not .text) suggests packing

Section Analysis — Spotting Packers

PE executables are divided into sections. Packed malware uses non-standard sections or incorrectly sized ones:

Section NamePurposePacked Indicator
.textCompiled codeIf .text has high entropy (>7.0), the code is likely packed
.rdataRead-only data (constants, imports)Unusually large or absent suggests packing
.dataRuntime data (global variables)Large .data sections can hide unpacked code
.rsrcResources (icons, strings, manifests)Malware hides payloads in resources
.UPX, .packedCustom packer sectionDirect indicator of UPX or similar packing
.abc, .00cfgNon-standard namesUse of arbitrary section names = likely custom packer

Entropy check with spark or sigcheck:

# Check section entropy with sigcheck (Windows)
sigcheck.exe -e suspicious.exe

# CLI entropy scanner on Linux
cat suspicious.exe | ent

A Shannon entropy above 7.5 in the .text section strongly indicates packed or encrypted code.


Packers — Why Malware Packs Itself

Packers compress or encrypt the original executable and wrap it in a small stub that unpacks the real code in memory. Malware authors use packers to evade signature-based detection.

Common Packers

PackerTypeHow to DetectHow to Unpack
UPXCompressorSection names contain .UPXupx -d suspicious.exe
MPRESSCompressorSection .MPRESS1, .MPRESS2m press -d suspicious.exe
VMProtectVirtualizerExtremely high entropy, large .textManual unpacking required
ThemidaVirtualizer + obfuscatorLarge binary, high entropy, anti-debugManual unpacking required
ConfuserEx.NET obfuscatorRenamed types, string encryptionde4dot for .NET unpacking
Custom packerProprietaryNon-standard sections, high entropyBehavioral unpacking (run, memory dump)

Unpacking Workflow

  1. Simple packing (UPX, MPRESS): Use the unpacker tools above
  2. Custom packer: Run the malware in a sandbox, let it unpack in memory, then dump the process memory
  3. Dump unpacked process memory:
    # Use Process Hacker (Windows) to dump process memory
    # Or use LiME (Linux Memory Extractor) on a live Linux sandbox
    # Or use Volatility to dump the process:
    vol -f memory.dump windows.memmap.Memmap --pid 1234 --dump

Dynamic Analysis — Running Malware in a Sandbox

Dynamic analysis executes the file in a controlled environment and records everything it does. This is the most reliable way to understand malware behavior.

Sandbox Requirements

RequirementWhyImplementation
IsolationNo network path to production systemsSeparate VLAN, host-only networking, or air-gapped VM
Network simulationObserve C2 behavior without real riskFakenet-NG, INetSim, or dnsmasq with sinkhole
Monitoring toolsCapture every actionProcMon, Process Hacker, Wireshark, API Monitor
SnapshotsClean state between runsVM snapshots restored after each analysis
Multiple OS versionsMalware checks OS versionKeep Windows 10, 11, Server 2022 images

What to Observe

BehaviorHow to ObserveMalicious Indicator
Process creationProcMon, Process HackerSpawns cmd.exe, powershell.exe, rundll32.exe
File creationProcMon, RegshotDrops files in %TEMP%, %APPDATA%, %PROGRAMDATA%
Registry changesRegshot, ProcMonAdds Run keys, service entries, COM hijacks
Network connectionsWireshark, Fakenet-NGOutbound TCP to port 80/443/53, DNS queries to suspicious domains
Memory injectionProcess Hacker, API MonitorVirtualAllocEx + WriteProcessMemory + CreateRemoteThread
PersistenceAutoruns, scheduled tasksNew service, Run key, scheduled task, WMI subscription

Sandbox Evasion Techniques

Malware authors actively detect sandbox environments and alter behavior:

Evasion TechniqueWhat the Malware DoesHow to Counter
VM detectionChecks for VMware/VirtualBox drivers, MAC OUI, BIOS stringsConfigure hypervisor detection evasion in VM settings
Sleep evasionCalls Sleep() for 5-30 minutes before executing payloadUse API Monitor to intercept Sleep calls, skip or reduce sleep
Human interaction checkWaits for mouse movement, USB insertion, or open documentsSimulate human interaction via scripts
Domain checkOnly executes if the machine is domain-joinedJoin sandbox to a test domain
Debugger detectionChecks for IsDebuggerPresent, NtQueryInformationProcessUse stealthy debugger (x64dbg with ScyllaHide plugin)
User agent checkChecks browser or tool user agent stringsConfigure sandbox with real browser fingerprints
Anti-sandbox blacklistChecks for known sandbox IPs, MACs, and hostnamesRandomize MAC, hostname, and IP in sandbox

Quick evasion check — Sysmon Event ID 1 for sleep commands:

index=windows sourcetype=WinEventLog:Sysmon EventCode=1
| search CommandLine="*sleep*" OR CommandLine="*Start-Sleep*" OR CommandLine="*timeout*"
| stats count, values(CommandLine) as Commands by Image, Computer
| where count > 3
| eval alert = "Potential sandbox evasion — " . Image . " called sleep multiple times: " . Commands
| table Computer, Image, count, alert

Analyst Triage Workflow

5-Minute Checklist

StepActionWhat You Learn
1Hash the file (SHA256)Unique fingerprint
2VirusTotal lookupKnown malicious? Detection rate?
3Check file type (file command)PE, ELF, script, document?
4Check digital signatureLegitimate or forged?
5Quick strings scanURLs, IPs, mutexes, C2 patterns
6Check section entropyPacked or unpacked?
7Run in sandboxBehavioral analysis

Triage Decision Matrix

FindingClassificationAction
VT 0 detections + no network + no persistenceLikely benignDocument, close
VT 5+ detections + creates Run key + beacons outCommodity malwareBlock C2, clean host
VT 10+ detections + drops additional payloadDropperEscalate — dropper payload needs separate analysis
VT 0 detections + creates admin user + connects to unknown IPTargeted/zero-dayEscalate immediately

Tools Every Analyst Should Know

ToolAnalysis TypeWhat It Does
VirusTotalReputationMulti-engine AV scan, community comments
Any.RunDynamicInteractive cloud sandbox
ProcMon (Sysinternals)DynamicReal-time file, registry, process monitoring
Process HackerDynamicMemory inspection, process dumping, network monitoring
x64dbgStatic/DynamicDebugger for Windows binaries
GhidraStaticNSA reverse engineering framework, decompiler
PEStudioStaticPE file analysis, indicators of malicious intent
CAPAStaticIdentifies malware capabilities from binary analysis
FLOSSStaticExtracts obfuscated strings (FLARE Obfuscated String Solver)
RegshotDynamicBefore/after registry comparison
  • Malware Analysis Triage — detection and response for T1204 techniques
  • EDR Basics — detection and response for T1059, T1003, T1055, T1204, T1562 techniques
  • Kill Chain — covers the kill chain concepts
  • Ghidra — detection and response for T1204 techniques
  • REMnux — detection and response for T1204 techniques

Sources