agentleFS
Bizaza-devsBizaza-devs/Claude-PurpleTeam/skills/malware-triage/SKILL.md

malware-triage

Skill0 starsChanged 4 days agoMITView on GitHub

Safe, analysis-only malware triage for defenders. Covers handling rules (isolated analysis VM such as REMnux or FLARE-VM, no network or simulated network via INetSim or FakeNet-NG, defanged storage, password-protected zips with password "infected"), static triage (SHA-256, imphash, ssdeep/TLSH, file, TrID, Detect It Easy, PE headers and imports with pefile/PE-bear/PEStudio, strings and FLOSS, capa, entropy and packers like UPX), document malware (oletools oleid, olevba, mraptor, rtfobj, msodde; pdfid and pdf-parser; OneNote, LNK, ISO containers), static deobfuscation of PowerShell -EncodedCommand, JavaScript, VBScript, sandbox use (CAPE, public sandboxes, VirusTotal) with TLP and privacy rules, and IOC + YARA output. Use when asked to "analyse this sample", "is this file malicious", "what does this macro do", "decode this PowerShell", or "extract IOCs and write YARA".

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never on a production or personal machine: Never double-click, preview, or open a sample in Office/Acrobat outside the VM.

    line 30
  2. Very specific:

    Read as text, pretty-print (js-beautify), resolve string concatenation and fromCharCode/Chr() arrays by hand or in CyberChef.

    line 162
  3. Distinctive:

    Default posture: hash lookup first, private detonation second, public upload last and only with approval (record who approved, when, which …

    line 178

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Malware triage

When to use

  • A suspicious file was found during an investigation (EDR quarantine, phishing attachment, file recovered from disk or memory) and you need a fast, safe answer: malicious or not, what family/capability, which IOCs, and how to detect it elsewhere.
  • You need indicators and a YARA rule to scope the incident fleet-wide.

This is triage and analysis only. No modification of malware to make it work, no building or improving of payloads, no evasion techniques. Deep reverse engineering of novel malware is a specialist task - escalate with your findings. Phishing emails as a whole go to phishing-analysis / /phish.

Ground rules

  1. Hash + source + who before any analysis. Record SHA-256, where and when the sample was obtained, and the evidence-log row (evidence-handling) before you open it.
  2. Analyse only in an isolated analysis VM. Snapshot before, revert after. No shared folders/clipboard in write mode, no domain join, no corporate credentials, no route to production. Host-only network or simulated internet only.
  3. Never on a production or personal machine. Never double-click, preview, or open a sample in Office/Acrobat outside the VM.
  4. No upload of client or confidential files to public services without written approval. Search public services by hash first. Documents and scripts often embed internal names, credentials or PII, and public sandbox reports are visible to other users; uploads can also tip off the actor. TLP:AMBER/RED material stays private.
  5. A verdict needs two independent signals (e.g. capa capability + decoded C2 config, or YARA family match + sandbox behaviour). A single AV label or a single high-entropy section is not a verdict.
  6. Defang everything you write down. hxxps://bad[.]example/path, 203.0.113[.]5.

Workflow

  1. Intake: copy the sample into the VM via an approved transfer method, keep it inside a password-protected archive (infected) until analysis. Rename with a non-executable suffix (sample.exe_ or <sha256>.bin).
  2. Identify: hashes, file type, size, compiler/packer, signature.
  3. Reputation by hash: internal TI, EDR fleet prevalence, VirusTotal/ MalwareBazaar lookup by hash (no upload).
  4. Static triage: headers, imports, strings/FLOSS, capa, entropy; documents with oletools/pdf tools; scripts deobfuscated statically.
  5. Dynamic (if needed and approved): private sandbox (CAPE) or the analysis VM with FakeNet-NG/INetSim and process/network monitoring.
  6. Extract IOCs and write YARA (yara-rules); test against the sample and a clean corpus.
  7. Report capability, IOCs, ATT&CK techniques, confidence, and hand off.

Handling rules

RuleDetail
LabREMnux (Linux) and/or FLARE-VM (Windows) in a dedicated hypervisor; snapshots; host firewall blocks VM egress
NetworkNone, host-only to an INetSim/FakeNet-NG VM, or FakeNet-NG locally; never bridged to corporate LAN
StorageZip/7z with password infected (AES for 7z); clear naming <sha256>.bin; never in user home/Downloads
TransferApproved path only (dedicated malware share, encrypted container); never email unprotected samples
Mobile/IoT/macOS samplesSame rules; use matching VM/emulator
RetentionPer case retention policy (evidence-handling); destroy lab snapshots that executed samples when closed

Static triage (PE and ELF)

# Identity
sha256sum sample.bin; md5sum sample.bin           # MD5 only for legacy TI lookups
ssdeep sample.bin                                 # fuzzy hash for variant clustering (tlsh also useful)
file sample.bin                                   # magic type
trid sample.bin                                   # type by signature database
diec sample.bin                                   # Detect It Easy CLI: compiler, packer, protector
# PE structure: sections, entropy, imports, timestamps, resources, signature
python3 -c "import pefile; pe=pefile.PE('sample.bin'); print(pe.get_imphash()); print(pe.dump_info())" | less
# Strings: ASCII and UTF-16LE, then FLOSS for stack/tight/decoded strings
strings -n 8 sample.bin > strings_ascii.txt
strings -n 8 -el sample.bin > strings_utf16.txt
floss sample.bin > floss.txt
# Capabilities mapped to ATT&CK / MBC
capa sample.bin
capa -vv sample.bin > capa_verbose.txt            # shows matched addresses/features

GUI equivalents on FLARE-VM: PEStudio, PE-bear, Detect It Easy, CFF Explorer.

What to look at:

ObservationPossible meaningCaveat
Section entropy above ~7.2, tiny import table, sections named UPX0/UPX1 or odd namesPacked/encrypted (T1027.002)Installers, compressed resources and legit protectors also have high entropy
Imports VirtualAlloc(Ex), WriteProcessMemory, CreateRemoteThread, NtUnmapViewOfSectionInjection capability (T1055)Debuggers, EDR, game anti-cheat import the same
GetProcAddress + LoadLibrary onlyDynamic API resolution (hides imports)Common in packers and some legit software
Compile timestamp in the future or 1992Forged or Delphi defaultReproducible builds zero the field
Invalid / mismatched Authenticode signatureTampered or stolen certVerify chain and revocation, not just presence
.NET assemblyDecompile with dnSpyEx/ILSpy in the VMObfuscators (ConfuserEx etc.) need deobfuscation first
Strings: URLs, IPs, user agents, mutex names, PDB paths, ransom note textIOCs and attribution leadsDecoys are common; corroborate

UPX-packed samples can be unpacked on a copy with upx -d copy.bin for static analysis; custom packers need dynamic unpacking - escalate.

Document and container malware

# Office (OLE and OOXML): indicators, then macro source with decoding
oleid suspicious.docm
olevba --decode --deobf suspicious.docm > olevba.txt
mraptor suspicious.docm                 # flags auto-exec + write/exec macro combinations
msodde suspicious.docx                  # DDE / DDEAUTO fields
oleobj suspicious.docx                  # embedded OLE objects (extract to disk inside the VM)
rtfobj suspicious.rtf                   # embedded objects in RTF (e.g. equation-editor exploits)
# PDF: keyword triage, then inspect objects
pdfid.py suspicious.pdf                 # counts of /JavaScript, /JS, /OpenAction, /Launch, /EmbeddedFile, /AA
pdf-parser.py --search /JavaScript suspicious.pdf
pdf-parser.py --object 12 --filter --raw suspicious.pdf > obj12.txt
  • Excel 4.0 (XLM) macros: olevba shows them in recent versions; XLMMacroDeobfuscator emulates them without Excel.
  • OneNote (.one): embedded files - Didier Stevens' onedump.py.
  • LNK attachments: LECmd.exe -f file.lnk shows target and arguments (often powershell/mshta/cmd one-liners).
  • ISO/IMG/VHD/ZIP containers (Mark-of-the-Web bypass, T1553.005): list and extract with 7-Zip inside the VM, then triage each member.
  • HTML smuggling attachments: read the HTML/JS as text; look for Blob, msSaveOrOpenBlob, base64 payloads.

Script deobfuscation (static, without executing)

PowerShell (T1059.001, T1027):

# -EncodedCommand / -enc is Base64 of UTF-16LE text
echo 'SQBFAFgAIAAoA...' | base64 -d | iconv -f UTF-16LE -t UTF-8
# In the analysis VM only: decode without running
[Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($b64))
# Compressed layers: Base64 -> Deflate/GZip -> text
$ms = New-Object IO.MemoryStream(,[Convert]::FromBase64String($b64))
(New-Object IO.StreamReader(New-Object IO.Compression.DeflateStream($ms,[IO.Compression.CompressionMode]::Decompress))).ReadToEnd()
  • Peel layers by replacing the final execution sink (IEX, Invoke-Expression, & ([scriptblock]::Create(...)), .Invoke()) with output to a file. Do this only in the VM: expressions before the sink still evaluate, and nested layers may contain download cradles.
  • CyberChef (offline copy in the VM) recipes: From Base64, Decode text (UTF-16LE), Raw Inflate, Gunzip, XOR, From Charcode.
  • Script Block Logging (4104) on the victim often already holds the decoded layers - check it first (windows-forensics).

JavaScript / JScript / VBScript / HTA:

  • Read as text, pretty-print (js-beautify), resolve string concatenation and fromCharCode/Chr() arrays by hand or in CyberChef.
  • Replace eval/new Function/Execute/ExecuteGlobal with printing only inside the VM; never run with wscript/cscript/mshta on a real host.
  • box-js (REMnux) emulates WScript/ActiveX objects to record URLs and dropped files - still run it only in the lab.

Dynamic analysis and sandboxes

OptionPrivacyUse
CAPE (self-hosted)PrivateBehaviour, config extraction for many families, memory dumps
Analysis VM + Procmon/Sysmon + FakeNet-NG/INetSimPrivateControlled detonation, see requested domains/URLs
Commercial private sandbox tenantPer contractWhen licensed; check data retention terms
Public sandboxes (e.g. ANY.RUN free tier, Hybrid Analysis, Triage public) and VirusTotal uploadPublic or shared with other customersOnly with written approval for that sample, never for client documents, never TLP:AMBER/RED
  • Default posture: hash lookup first, private detonation second, public upload last and only with approval (record who approved, when, which service).
  • Simulated network: INetSim answers HTTP/DNS/SMTP; FakeNet-NG redirects all traffic to local listeners. Real internet access for a sample is an explicit, approved exception (risk: live C2 interaction, harm to third parties, actor tipping).
  • Anti-analysis behaviour (sleeping, VM checks) is a finding to record; do not try to defeat it beyond standard sandbox configuration - escalate.

IOC and YARA output

  • IOCs: SHA-256 (+ MD5/SHA-1 for legacy TI), imphash, ssdeep/TLSH, file names, paths, mutexes, named pipes, registry keys, scheduled task names, domains, URLs, IPs, user agents, certificate thumbprints. Defang in reports; keep a machine-readable list for threat-intel-ioc. In a case folder, append to iocs.csv (type,value_defanged,first_seen_utc, last_seen_utc,source,confidence,tlp,notes).
  • Mark each IOC with type, context (C2, download, drop path), first seen, and confidence; flag likely-shared infrastructure (CDNs, cloud storage, URL shorteners) as low blocking value.
  • YARA: prefer unique strings (decoded config markers, PDB paths, rare byte sequences from capa/FLOSS output) plus a PE condition; avoid packer-only strings. Test against the sample set and a goodware corpus before deployment (yara-rules).
// Skeleton for a family rule from triage findings - replace strings with real artefacts and test for FPs
rule Case01_Loader_Triage
{
    meta:
        author = "case01 analyst"
        description = "Loader found on HOST01; strings from FLOSS decoded output"
        reference = "case01"
    strings:
        $pdb = "\\loader\\Release\\ldr.pdb" ascii
        $mtx = "Global\\a1b2c3d4-case01" wide
        $cfg = { 8B 45 ?? 33 C9 8A 0C 01 }
    condition:
        uint16(0) == 0x5A4D and filesize < 2MB and 2 of them
}

Verdict table

VerdictEvidence that moves it
True Positive (malicious)Two independent signals: e.g. capa injection/persistence capabilities + decoded C2, YARA family match + sandbox C2 attempt, known-bad hash in trusted TI + matching behaviour
Benign True PositiveDual-use tool (PsExec, rclone, AnyDesk, nmap) - file is legitimate, the use is the question; hand back to the investigation
False PositiveSigned by a trusted vendor, prevalent in fleet, matches software inventory, no malicious capability
Needs more dataPacked/obfuscated beyond triage, environment-keyed, or sandbox evasive - escalate to reverse engineering with all notes

False positives & benign look-alikes

  • Legit packers/protectors (UPX on open-source tools, commercial licensing protectors) and installers with high entropy.
  • Admin scripts that use -EncodedCommand (SCCM, monitoring agents).
  • Office documents with benign macros (finance templates) - mraptor flags auto-exec, not malice.
  • Generic AV heuristic labels (Generic, Heur, ML) without a family.
  • Penetration-testing tools found on approved red-team hosts.

Pitfalls

  • Uploading a confidential document to a public sandbox "just to check".
  • Opening a sample on the analyst workstation through a preview pane or archive viewer.
  • Running "deobfuscation" that actually executes the payload.
  • Letting the VM reach the real internet; DNS leakage through the host.
  • Trusting the PE compile timestamp or the file extension.
  • Reporting IOCs that are shared infrastructure as if they were attributable.
  • Forgetting to revert the snapshot after detonation.

Output

  • Triage note: hashes, type, verdict + confidence, capabilities with ATT&CK IDs, IOCs (defanged), sandbox/approval record.
  • IOC list to threat-intel-ioc / /ioc; YARA rule to yara-rules; detection ideas to detection-engineering / /detect; hunting leads to hunt-dispatch / /hunt; timeline rows (timeline-analysis); report section via ir-report-writing.

References

  • MITRE ATT&CK: T1027 Obfuscated Files or Information, T1027.002 Software Packing, T1055 Process Injection, T1059.001 PowerShell, T1059.005 Visual Basic, T1059.007 JavaScript, T1204.002 Malicious File, T1566.001 Spearphishing Attachment, T1553.005 Mark-of-the-Web Bypass.
  • MITRE Malware Behavior Catalog (MBC) - used by capa.
  • Mandiant FLARE: capa, FLOSS, FLARE-VM, FakeNet-NG documentation.
  • REMnux documentation; oletools (decalage2) documentation; Didier Stevens' pdfid/pdf-parser/onedump documentation.
  • FIRST Traffic Light Protocol (TLP) 2.0.
  • NIST SP 800-83 Rev. 1 Guide to Malware Incident Prevention and Handling.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.