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 |
scripts/mem_triage.py
View on GitHub#!/usr/bin/env python3
r"""
mem_triage.py - Volatility 3 memory triage driver for injection / fileless hunts.
Wraps the Volatility 3 CLI to run an injection + fileless analysis playbook and
collapse the output into a single JSON verdict: malfind hits, hollowed/ghosted
processes, unhooked syscalls, suspicious cmdlines, netscan beacon endpoints, and
in-memory AMSI/ETW patch indicators. Also scans malfind output for the classic
AmsiScanBuffer / NtTraceEvent patch stubs.
USAGE:
python3 mem_triage.py -f memory.raw --vol vol # 'vol' = vol3 entrypoint
python3 mem_triage.py -f memory.raw --vol "python3 vol.py" --json out.json
DEPENDENCIES:
Volatility 3 installed and on PATH (`pip install volatility3`; entrypoint `vol`).
OPSEC (defensive): operates on a captured dump; capture memory BEFORE remediation.
"""
import argparse
import json
import re
import shlex
import subprocess
import sys
# In-memory patch stub signatures seen in 2025 AsyncRAT/Remcos loaders.
# AmsiScanBuffer neutered -> mov eax,0 ; ret (xor eax,eax;ret also common)
PATCH_STUBS = {
"amsi_ret_clean": rb"\xb8\x00\x00\x00\x00\xc3", # mov eax,0 ; ret
"amsi_xor_ret": rb"\x31\xc0\xc3", # xor eax,eax ; ret
"amsi_err": rb"\xb8\x57\x00\x07\x80\xc3", # mov eax,0x80070057 ; ret (E_INVALIDARG)
"etw_ret": rb"\xc3", # bare ret patched at NtTraceEvent
}
PLAYBOOK = [
("pslist", "windows.pslist"),
("psscan", "windows.psscan"),
("malfind", "windows.malfind"),
("hollow", "windows.hollowprocesses"), # vol3 2024+ plugin
("ghosting", "windows.processghosting"), # vol3 2024+ plugin
("unhooked", "windows.unhooked_system_calls"),
("cmdline", "windows.cmdline"),
("netscan", "windows.netscan"),
]
def run_vol(vol_cmd, dump, plugin, extra=None):
args = shlex.split(vol_cmd) + ["-f", dump, "-r", "json", plugin]
if extra:
args += extra
try:
cp = subprocess.run(args, capture_output=True, text=True, timeout=1800)
if cp.returncode != 0:
return {"_error": cp.stderr[-400:].strip() or "nonzero exit"}
try:
return json.loads(cp.stdout)
except json.JSONDecodeError:
return {"_raw": cp.stdout[-4000:]}
except FileNotFoundError:
return {"_error": "volatility3 not found on PATH"}
except subprocess.TimeoutExpired:
return {"_error": "plugin timed out"}
def hunt_patch_stubs(vol_cmd, dump, malfind_rows):
"""For each malfind PID, dump the region and check for AMSI/ETW patch bytes."""
findings = []
pids = sorted({r.get("PID") for r in malfind_rows if isinstance(r, dict) and r.get("PID")})
for pid in pids[:15]:
# vmscan via windows.vadinfo + procdump is heavy; instead grep the hexdump
# that malfind already prints in text mode for the patch stubs.
args = shlex.split(vol_cmd) + ["-f", dump, "windows.malfind", "--pid", str(pid)]
try:
cp = subprocess.run(args, capture_output=True, text=True, timeout=600)
except Exception:
continue
raw = cp.stdout.encode("latin1", "replace")
# malfind prints a Disasm + Hexdump; reconstruct bytes from hex columns
hexbytes = bytes.fromhex("".join(re.findall(r"\b([0-9a-f]{2})\b", cp.stdout.lower())[:4096]) or "")
for name, sig in PATCH_STUBS.items():
if sig in hexbytes or sig in raw:
findings.append({"pid": pid, "indicator": name})
return findings
def main():
ap = argparse.ArgumentParser()
ap.add_argument("-f", "--file", required=True, help="memory image")
ap.add_argument("--vol", default="vol", help="volatility3 entrypoint (default: vol)")
ap.add_argument("--json", help="write verdict JSON here")
ap.add_argument("--patch-hunt", action="store_true",
help="scan malfind regions for AMSI/ETW patch stubs (slower)")
a = ap.parse_args()
report = {"image": a.file, "results": {}, "verdict": {"suspicious": []}}
raw = {}
for label, plugin in PLAYBOOK:
print(f"[*] {plugin} ...", file=sys.stderr)
out = run_vol(a.vol, a.file, plugin)
raw[label] = out
if isinstance(out, dict) and "_error" in out:
report["results"][label] = {"error": out["_error"]}
continue
rows = out if isinstance(out, list) else out.get("rows", out)
report["results"][label] = {"count": len(rows) if isinstance(rows, list) else "n/a"}
# Verdict synthesis
malfind_rows = raw.get("malfind") if isinstance(raw.get("malfind"), list) else []
if malfind_rows:
report["verdict"]["suspicious"].append(
f"malfind: {len(malfind_rows)} injected/RWX region(s) without file backing")
for k in ("hollow", "ghosting", "unhooked"):
rows = raw.get(k) if isinstance(raw.get(k), list) else []
if rows:
report["verdict"]["suspicious"].append(f"{k}: {len(rows)} hit(s)")
# Hidden processes = in psscan but not pslist (DKOM)
def pidset(label):
rows = raw.get(label) if isinstance(raw.get(label), list) else []
return {r.get("PID") for r in rows if isinstance(r, dict) and r.get("PID")}
hidden = pidset("psscan") - pidset("pslist")
if hidden:
report["verdict"]["suspicious"].append(f"hidden process PIDs (DKOM): {sorted(hidden)}")
if a.patch_hunt and malfind_rows:
patches = hunt_patch_stubs(a.vol, a.file, malfind_rows)
if patches:
report["patch_stubs"] = patches
report["verdict"]["suspicious"].append(f"AMSI/ETW patch stubs: {patches}")
out = json.dumps(report, indent=2, default=str)
if a.json:
open(a.json, "w").write(out)
print(f"[+] verdict -> {a.json}")
print("\n[VERDICT]")
if report["verdict"]["suspicious"]:
for s in report["verdict"]["suspicious"]:
print(f" [!] {s}")
else:
print(" no high-confidence injection/fileless indicators in standard playbook")
if __name__ == "__main__":
main()
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 |