hypnguyen1209/offensive-claude / skills/malware-analysis
malware-analysis
UnverifiedUse when reverse-engineering or detecting malware — static triage + capa/YARA-X, emulation/DBI/.NET unpacking, dynamic/fileless/Volatility 3 memory analysis, C2 config extraction (Cobalt Strike/CAPE), C2 traffic detection (JA4+, beaconing)
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.0 KB |
| references/config-c2-extraction.md | markdown | 7.6 KB |
| references/dynamic-fileless-memory.md | markdown | 7.9 KB |
| references/network-c2-detection.md | markdown | 6.8 KB |
| references/static-triage-capa.md | markdown | 7.2 KB |
| references/unpacking-deobfuscation.md | markdown | 7.8 KB |
| references/yara-detection-engineering.md | markdown | 6.5 KB |
| scripts/auto_unpack.py | script | 6.8 KB |
| scripts/beacon_profiler.py | script | 4.6 KB |
| scripts/cs_config_extract.py | script | 5.0 KB |
| scripts/frida_unpack.js | script | 4.5 KB |
| scripts/mem_triage.py | script | 6.0 KB |
| scripts/triage.py | script | 9.0 KB |
| scripts/yara_gen.py | script | 5.9 KB |
references/static-triage-capa.md
View on GitHub# Static Triage & Capability Detection
Goal: identify, classify, and capability-profile an unknown sample **without executing it**.
Output of this cluster: hashes (incl. fuzzy/code hashes), packer verdict, capability list mapped
to ATT&CK, candidate IOCs, and a go/no-go for dynamic detonation.
## Theory / mechanism
Static triage layers cheap-to-expensive signals:
1. **Identity & similarity hashes.** `sha256` for exact identity; `imphash` (MD5 of the ordered
import table) clusters same-compiler/same-loader families; the **Rich header hash** fingerprints
the exact MSVC toolchain mix and is very stable across recompiles of the same build environment;
**ssdeep** (CTPH) and **TLSH** are locality-sensitive hashes for "near-duplicate" clustering even
after minor edits. `imphash` is defeated by dynamic API resolution (LoadLibrary/GetProcAddress
only), which is itself an IOC.
2. **PE structure anomalies.** Entry point outside `.text`, RWX sections, section count/name
mismatches, tiny import tables, abnormal `SizeOfRawData==0` with large `VirtualSize`, TLS callbacks
(run pre-`main`, classic anti-debug), overlay data appended past the last section.
3. **Per-section Shannon entropy.** > 7.0 ≈ compressed/encrypted (packed or embedded payload).
A packed UPX-clone shows one high-entropy section + a low-entropy stub.
4. **Obfuscated string recovery.** Plain `strings` misses stack strings, single-byte XOR, and
"tight strings". **FLOSS** (FLARE Obfuscated String Solver) statically emulates string-decode
routines to recover them.
5. **Capability detection.** **capa** disassembles the file and matches *code-level* features
(instructions/basic-blocks/function calls) against a rule corpus, emitting MITRE ATT&CK
techniques and MBC behaviors. This is the static analog of behavioral analysis — it tells you
*what the binary can do* before you run it.
## Tooling (2024-2026 currency)
- **capa** (Mandiant/FLARE, open source) — PE / ELF / .NET / shellcode, plus **dynamic capa** that
reads **CAPE sandbox** API traces to extract capabilities from runtime behavior (shortcuts
thousands of API log lines). **capa Explorer Web** (2025) renders capa results in the browser,
complementing the IDA Pro `capa-explorer` plugin. In **Feb 2025** Google + FLARE shipped **capa
rules for Android** (ptrace calls, device-info theft, remote code download, JNI crypto) to catch
native-code-obfuscated Android malware on Play. capa rules share format DNA with YARA — you can
author family-specific capability rules.
- **FLOSS 3.x** — bundled in **FLARE-VM**. The **2025 FLARE-VM** refresh added `uncompyle6` +
Python libs for marshalled/`.pyc` malware, **GoStringUngarbler** to recover strings from
`garble`-obfuscated Go binaries, and Universal Extractor 2 / Electron / InnoSetup extractors;
installer GUI was rebuilt and Win11 support hardened.
- **YARA-X 1.0** (June 2025 stable, Rust rewrite) for signature scanning during triage — see
`references/yara-detection-engineering.md`.
- **PEScan** (2025 Volatility plugin contest) — for memory-resident PEs, scores regions on packer
ID, section entropy, header anomalies, embedded IPs/URLs/strings.
## Complete working triage
```bash
# 0. one-shot orchestrated triage (hashes + PE anomalies + capability combos + FLOSS/capa/YARA-X)
python3 scripts/triage.py sample.exe --floss --capa --yara rules/family.yar --json out/triage.json
# 1. capability map -> ATT&CK (static)
capa -j sample.exe > out/capa.json
capa sample.exe # human view with ATT&CK + MBC tables
# 2. dynamic capa over a CAPE report (when you have a sandbox run)
capa -f cape out/cape_report.json
# 3. obfuscated strings
floss -q sample.exe | tee out/floss.txt
# narrow to actionable IOCs
floss -q sample.exe | grep -iE 'https?://|\\\\|cmd|powershell|schtasks|reg add|\.onion|[A-Za-z0-9+/]{40,}='
# 4. imphash / rich-hash clustering across a corpus
for f in corpus/*; do
python3 -c "import pefile,sys;p=pefile.PE(sys.argv[1]);print(p.get_imphash(), sys.argv[1])" "$f"
done | sort | uniq -c -w32 # group by imphash
```
`scripts/triage.py` computes sha256/md5/imphash/ssdeep/TLSH, decodes the **Rich header** + rich_hash,
per-section entropy, flags RWX/non-standard-EP/TLS-callbacks, and matches the suspicious-API combo
table (process injection/hollowing/APC, AMSI-ETW-patch primitives, keylogging, anti-debug, C2 HTTP,
ransomware crypto, persistence). It shells out to FLOSS/capa/YARA-X only if they're on PATH.
## Reading capa + triage output (decision logic)
- `procinject*` + `defense-evasion/amsi` capa hits → expect an in-memory loader; plan a Frida/x64dbg
detonation (see unpacking + fileless clusters) rather than relying on static alone.
- High-entropy single section + < 10 imports → packed; route to `references/unpacking-deobfuscation.md`.
- capa "communicate via HTTP/DNS" + hardcoded URLs in FLOSS → seed `references/config-c2-extraction.md`.
- imphash matches a known family cluster → pull that family's YARA + config extractor first.
## Detection
Static triage is performed *on* malware, but its outputs feed defensive detection. Concrete artifacts
to operationalize:
- **YARA-X** hunting rule keyed on the dominant **imphash** and Rich `rich_hash` for the family
(stable pivots — see `yara_gen.py`).
- **Sigma (process creation)** for the capabilities you confirmed, e.g. dynamic-resolution loaders:
```yaml
title: Suspicious Image With Tiny Import Table Spawning LOLBins
logsource: { product: windows, category: process_creation }
detection:
selection_parent:
ParentImage|endswith: ['\rundll32.exe','\regsvr32.exe','\mshta.exe']
selection_child:
Image|endswith: ['\powershell.exe','\cmd.exe','\wscript.exe']
condition: selection_parent and selection_child
level: high
tags: [attack.execution, attack.t1059]
```
IOCs to record per sample: sha256, imphash, rich_hash, ssdeep/TLSH, capa ATT&CK list, FLOSS-recovered
URLs/keys/mutexes, packer verdict.
## OPSEC
- Triage is read-only and offline — **no execution, no network**. Safe on the analyst host, but keep
samples in an isolated working dir and never double-click.
- FLOSS statically *emulates* decode stubs (vivisect) — no real execution, but very hostile samples
can craft inputs to crash the emulator; run inside the analysis VM regardless.
- Strip sample extension / set `chmod -x` on Linux hosts to avoid accidental detonation.
- Hash everything before opening in any GUI tool that may modify the file (some unpackers rewrite).
## References
- VirusTotal Blog — *YARA-X 1.0.0: The Stable Release and Its Advantages* (June 2025): https://blog.virustotal.com/2025/06/yara-x-100-stable-release-and-its.html
- Google Cloud / Mandiant — *capa rules for Android malware detection* (Feb 2025): https://cloud.google.com/blog/topics/threat-intelligence/capa-rules-android-malware-detection/
- Google Cloud / Mandiant — *Dynamic capa: Executable Run-Time Behavior with the CAPE Sandbox*: https://cloud.google.com/blog/topics/threat-intelligence/dynamic-capa-executable-behavior-cape-sandbox
- Google Cloud / Mandiant — *FLARE-VM: Continuously Sharpening the Analyst's Edge* (2025 refresh): https://security.googlecloudcommunity.com/community-blog-42/flare-vm-continuously-sharpening-the-analyst-s-edge-5941
- mandiant/capa: https://github.com/mandiant/capa
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |