Malware Classification
Systematic methodology for triaging unknown binaries, classifying malware families, extracting indicators of compromise, and producing actionable intelligence. Covers the full pipeline from initial sample receipt through final classification report.
Classification Taxonomy
Know what you are looking for. Every sample maps to one of these categories:
| Category | Subcategories | Key Behavioral Signals |
|---|---|---|
| Ransomware | Crypto-locker, locker, wiper-ransom | File enumeration, crypto API calls, ransom note drops, shadow copy deletion |
| RAT | Full RAT, lightweight backdoor | Reverse shell, command dispatch, screenshot capture, keylogging, file exfil |
| Loader/Dropper | Stage-1 loader, dropper, downloader | Downloads next stage, writes to disk or injects, minimal own functionality |
| Stealer/Infostealer | Browser stealer, credential harvester | Reads browser DBs, credential stores, clipboard, crypto wallets |
| Banker Trojan | Web inject, form grabber, overlay | Targets banking URLs, injects into browser, form hooking |
| Botnet Agent | DDoS bot, spam bot, proxy bot | C2 check-in loop, command polling, peer-to-peer comms |
| Rootkit | Kernel rootkit, userland rootkit, bootkit | Driver loading, SSDT hooks, DKOM, MBR/VBR modification |
| Cryptominer | CPU miner, GPU miner | High CPU usage, stratum protocol, mining pool connections |
| Wiper | Destructive wiper, MBR wiper | Overwrites MBR, mass file deletion, no recovery mechanism |
| Spyware | Keylogger, screen capture, audio capture | Input hooks, periodic screenshots, mic access |
| Adware/PUP | Ad injector, browser hijacker | Browser extension install, DNS hijack, ad network callbacks |
Triage Workflow
Follow this sequence. Each phase feeds the next — do not skip steps.
Phase 1 — Sample Receipt and Hashing
Every analysis begins with positive identification and deduplication.
# Compute all hashes for the sample
sha256sum <sample>
md5sum <sample>
ssdeep <sample>
# Check file type
file <sample>
# Track in romero analysis DB
node ${CLAUDE_PLUGIN_ROOT}/scripts/binary-hasher.js hash <sample>
node ${CLAUDE_PLUGIN_ROOT}/scripts/analysis-tracker.js add <sha256> classification pending
Record SHA256, MD5, SHA1, ssdeep, file size, and file type before touching anything else. This is your chain of custody starting point.
Phase 2 — Static Triage (No Execution)
Static analysis extracts maximum intelligence without running the sample.
2a. PE Header Analysis
# Section table, imports, exports, timestamps, debug info
r2 -qc 'iH; iS; ii; iE; it' <sample>
# Rich header (compiler fingerprint)
r2 -qc 'iR' <sample>
# Check for anomalies with pestudio (if available)
pestudio <sample>
Look for: abnormal section names (packer signatures), section entropy above 6.5, entry point outside .text, minimal imports (LoadLibrary + GetProcAddress only), mismatched compile timestamps, suspicious rich header entries.
2b. Packer and Protector Detection
# Detect It Easy — best automated packer identification
diec <sample>
# YARA-based packer scan
yara -r ${CLAUDE_PLUGIN_ROOT}/rules/packers.yar <sample>
# Entropy per section (key packer signal)
r2 -qc 'iS~entropy' <sample>
If packed: identify the packer, attempt unpacking, then restart triage on the unpacked sample. See references/packer-detection.md for packer-specific strategies.
2c. String Extraction
# Standard strings
strings -n 6 <sample> > strings_ascii.txt
strings -n 6 -el <sample> > strings_unicode.txt
# FLOSS for obfuscated/stack strings
floss <sample> > strings_floss.txt
# Quick triage of interesting strings
strings <sample> | grep -iE '(http|ftp|\.exe|\.dll|cmd\.exe|powershell|reg\s|schtasks|net\s|wmic)'
Strings reveal: C2 URLs, file paths, registry keys, mutex names, error messages, API names, embedded configs, debug paths (PDB), campaign IDs.
2d. Import Analysis
# Full import table
r2 -qc 'ii' <sample>
# Compute imphash for family clustering
python3 -c "import pefile; pe=pefile.PE('<sample>'); print(pe.get_imphash())"
Flag these import categories:
| Category | APIs | Indicates |
|---|---|---|
| Process injection | CreateRemoteThread, NtWriteVirtualMemory, QueueUserAPC | Code injection |
| Evasion | IsDebuggerPresent, NtQueryInformationProcess, GetTickCount | Anti-analysis |
| Persistence | RegSetValueEx, CreateService, SchTasksCreate | Survival mechanism |
| Networking | InternetOpen, WSAStartup, HttpSendRequest, WinHttpConnect | C2 or data exfil |
| Crypto | CryptEncrypt, BCryptEncrypt, CryptHashData | Encryption (ransom or comms) |
| Credential theft | CredEnumerate, LsaRetrievePrivateData, CryptUnprotectData | Credential harvesting |
| Keylogging | SetWindowsHookEx, GetAsyncKeyState, GetKeyState | Input capture |
| Screen capture | BitBlt, CreateCompatibleBitmap, GetDC | Visual surveillance |
| File ops | FindFirstFile, MoveFileEx, DeleteFile, WriteFile | File manipulation |
| Privilege | AdjustTokenPrivileges, OpenProcessToken, LookupPrivilegeValue | Privilege escalation |
2e. YARA Scanning
# Scan against all rule sets
yara -s -r /path/to/rules/ <sample>
# Scan with specific rulesets
yara -s rules/malware_families.yar <sample>
yara -s rules/capabilities.yar <sample>
yara -s rules/packers.yar <sample>
See references/yara-rules.md for writing custom detection rules.
Phase 3 — Similarity Analysis
Determine if the sample is related to known malware families.
# ssdeep fuzzy hash comparison against corpus
ssdeep -m known_hashes.txt <sample>
# TLSH locality-sensitive hash
tlsh -f <sample>
tlsh -c <sample> -l known_tlsh.txt
# imphash comparison (same imphash = same import structure = likely same family)
python3 -c "import pefile; pe=pefile.PE('<sample>'); print(pe.get_imphash())"
See references/similarity-analysis.md for fuzzy hashing methodology and thresholds.
Phase 4 — Dynamic Analysis (Sandboxed Execution)
Run the sample in an isolated environment when static analysis is insufficient.
Automated Sandbox Submission
# CAPEv2 submission
curl -F "file=@<sample>" http://<cape-host>:8000/apiv2/tasks/create/file/
# Check results
curl http://<cape-host>:8000/apiv2/tasks/view/<task_id>/
Behavioral Signals to Extract
Monitor sandbox output for:
| Behavior | Tools/Artifacts | Classification Signal |
|---|---|---|
| File drops | Procmon, dropped files list | Dropper, loader |
| Network connections | Fakenet-NG, pcap | C2, data exfil |
| Registry modifications | Procmon, regshot diff | Persistence |
| Process creation | Process tree | Injection, child spawning |
| API call sequences | API trace log | Behavioral fingerprint |
| Mutex creation | Handle list | Family identifier |
| Scheduled tasks/services | Sysmon, event logs | Persistence |
| Crypto operations | API trace | Ransomware, encrypted comms |
| Screenshot/keylog | API hooks | Spyware, RAT |
Anti-Analysis Detection
If the sample detects the sandbox and refuses to execute, document the evasion technique:
- Timing checks: RDTSC, GetTickCount, Sleep acceleration
- Environment checks: VM artifacts, MAC prefixes, disk size, username
- Debugger checks: IsDebuggerPresent, int3 scanning, hardware breakpoints
- Human interaction checks: Mouse movement, click patterns, recent files
See references/behavioral-indicators.md for sandbox evasion catalog and countermeasures.
Phase 5 — IOC Extraction
Extract every actionable indicator from static and dynamic analysis.
| IOC Type | How to Extract | Tracking Tag |
|---|---|---|
| C2 servers | Strings, PCAP, config extraction | ioc-c2 |
| Mutexes | Dynamic analysis, strings | ioc-mutex |
| Dropped files |