ljagiello/ctf-skills / ctf-malware
ctf-malware
UnverifiedProvides malware analysis and network traffic techniques for CTF challenges. Use when analyzing obfuscated scripts, malicious packages, custom crypto protocols, C2 traffic, PE/.NET binaries, RC4/AES encrypted communications, YARA rules, shellcode analysis, memory forensics for malware (Volatility malfind, process injection detection), anti-analysis techniques (VM/sandbox detection, timing evasion, API hashing, process injection, environment checks), or extracting malware configurations and indicators of compromise.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.9 KB |
| c2-and-protocols.md | markdown | 10.5 KB |
| pe-and-dotnet.md | markdown | 3.0 KB |
| scripts-and-obfuscation.md | markdown | 15.4 KB |
| tools-mcp.md | markdown | 7.9 KB |
tools-mcp.md
View on GitHub# CTF Malware - MCP Server Integration
MCP servers speed up malware triage: decompile to spot the real payload, walk a
crash/behavior dump, and reverse Android samples. The static decompiler MCP
servers (IDA Pro MCP, Ghidra MCP, JADX MCP) are documented authoritatively in
[../ctf-reverse/tools-mcp.md](../ctf-reverse/tools-mcp.md); this file covers the
malware-specific angle and WinDbg MCP for dynamic analysis.
## Table of Contents
- [IDA / Ghidra MCP for Unpacking & Config Extraction](#ida--ghidra-mcp-for-unpacking--config-extraction)
- [WinDbg MCP for Dynamic Malware Debugging](#windbg-mcp-for-dynamic-malware-debugging)
- [JADX MCP for Android Malware](#jadx-mcp-for-android-malware)
> Safety: only run malware dynamically inside an isolated, disposable VM with no
> access to real infrastructure. MCP dynamic-analysis loops still execute the
> sample — treat every step as live.
---
## IDA / Ghidra MCP for Unpacking & Config Extraction
Use the decompiler MCP servers from
[../ctf-reverse/tools-mcp.md](../ctf-reverse/tools-mcp.md) — **pseudocode first,
assembly only when the decompiler fails** (same golden rule).
**Malware-specific queries:**
```text
list_strings filter="http" # C2 URLs — filter server-side (Ghidra), don't dump all
list_strings filter="expand 32-byte k" # ChaCha constant; also try mutex/registry fragments
list_imports # VirtualAlloc/CreateRemoteThread = injection
decompile_function <decrypt_stub> # read the string/config decryptor as pseudo-C
get_xrefs_to address=<blob_addr> # who reads the packed config? (hex address, not a name)
rename_function <sub_x> config_decrypt
set_comment <addr> "RC4 key = 'hunter2'"
disassemble_function address=<unpacker_addr> # ONLY for the exact unpack stub / OEP hunt
```
Mind the argument types: in Ghidra MCP `get_xrefs_to` and `disassemble_function`
take a **hex address**, while `decompile_function` and `get_function_xrefs` take
a **name** — and every `list_*` silently truncates at 100 entries unless you page
or filter. See
[../ctf-reverse/tools-mcp.md](../ctf-reverse/tools-mcp.md#ghidra-mcp-free-decompiler-autonomous-re).
**Where MCP helps most in malware:**
- Identify the crypto by imports + constants, then decompile the decryptor to lift
the algorithm and key (cross-ref algorithm signatures in
[c2-and-protocols.md](c2-and-protocols.md#identifying-encryption-algorithms)).
- Extract the C2 config: decompile the routine that reads the encrypted blob and
reproduce it in Python (see
[pe-and-dotnet.md](pe-and-dotnet.md) — malware config extraction).
- Map API-hashing resolvers: decompile the hash loop, recover the algorithm
(ROR13/DJB2/CRC32), then resolve names with hashdb
([scripts-and-obfuscation.md](scripts-and-obfuscation.md#anti-analysis-techniques)).
- Locate the OEP for packed samples: read the unpack stub's pseudo-C to find where
it jumps to the original entry point, then dump.
**Key insight:** Malware buries one small decryptor under layers of junk. The
decompiler finds it in one `decompile_function` call — read the pseudo-C to lift
the key and algorithm, reproduce it in Python, and skip stepping through the
packer in a debugger entirely.
---
## WinDbg MCP for Dynamic Malware Debugging
Repository: `https://github.com/svnscha/mcp-windbg` (MIT). Full tool list,
session model, and setup in
[../ctf-pwn/tools-mcp.md](../ctf-pwn/tools-mcp.md#windbg-mcp-windows-crash-dumps-live--kernel-debugging).
Every command is addressed by the `session_id` that `open_cdb_dump` /
`open_cdb_remote` returns.
**Post-mortem triage (dump of an already-detonated sample):**
```text
open_cdb_dump sample.dmp include_modules=true
run_cdb_command <sid> ".symfix; .reload" # else !analyze -v invents a wrong answer
run_cdb_command <sid> "!address -f:PAGE_EXECUTE_READWRITE" # RWX = shellcode / unpacked payload
run_cdb_command <sid> "lm" # unbacked/injected regions vs real modules
run_cdb_command <sid> "!peb" # command line, env, image path
run_cdb_command <sid> "!address -f:Heap -c:\"s -u %1 %2 \\\"http\\\"\"" # C2 URLs, UTF-16
run_cdb_command <sid> "!address -f:Heap -c:\"s -a %1 %2 \\\"http\\\"\"" # ...and ASCII copies
run_cdb_command <sid> "u <oep> L40" # disassemble the unpacked entry
run_cdb_command <sid> ".writemem C:\\out\\payload.bin <base> L<size>" # dump for IDA/Ghidra
```
Scan via `!address -c:` rather than a raw range: on x64 the heap lives above
4 GB so a 32-bit range finds nothing, and the full user range hangs the session.
`%1`/`%2` are the region base and end+1. Try `-f:Stack`, `-f:Image`, and
`-f:MEM_PRIVATE` too — injected payloads are usually `MEM_PRIVATE`, not `Heap`.
**Live unpacking loop (isolated VM only).** Let the packer do the work, then
break the moment it hands you plaintext — far faster than reversing the stub:
```bash
cdb -server tcp:port=5005 sample.exe # inside the disposable VM
```
```text
open_cdb_remote "tcp:Port=5005,Server=<vm-ip>"
run_cdb_command <sid> "bp kernel32!VirtualAlloc \"gu; r rax; g\"" # log every alloc, keep running
run_cdb_command <sid> "bp kernel32!CreateRemoteThread" # injection moment
run_cdb_command <sid> "bp kernel32!WinExec; bp kernel32!CreateProcessW"
run_cdb_command <sid> "bp ws2_32!connect" # C2 callout → read sockaddr
run_cdb_command <sid> "g" timeout_seconds=60
run_cdb_command <sid> "!address -f:PAGE_EXECUTE_READWRITE" # the new RWX block is the unpacked payload
run_cdb_command <sid> ".writemem C:\\out\\unpacked.bin <rwx_base> L<size>"
```
`.writemem` the RWX region and feed it to IDA/Ghidra MCP — that skips the packer
entirely. `send_ctrl_break <sid>` if the sample free-runs and stops responding.
**Key insight:** After the packer decrypts in memory,
`!address -f:PAGE_EXECUTE_READWRITE`
and the `s` memory scans reveal the plaintext payload, C2 strings, and injection
regions that static analysis of the on-disk file cannot see — and `.writemem`
turns that in-memory payload back into a file you can decompile. Breakpointing
`VirtualAlloc`/`CreateRemoteThread` beats reversing the unpack stub almost every
time. Pair with Volatility for post-mortem memory forensics
([scripts-and-obfuscation.md](scripts-and-obfuscation.md#memory-forensics-for-malware)).
---
## JADX MCP for Android Malware
Repository: `https://github.com/zinja-coder/jadx-ai-mcp` (Apache-2.0). Setup and
full tool list in [../ctf-reverse/tools-mcp.md](../ctf-reverse/tools-mcp.md#jadx-mcp-android-apk--dex).
**Android malware loop:**
```text
get_android_manifest # exported receivers, SMS/RECEIVE_BOOT perms, C2 in meta-data
search_classes_by_keyword search_term="http" search_in="code" # C2 URLs hardcoded in Java
search_method_by_name onReceive # SMS/boot triggers that malware abuses
get_method_by_name class_name=<Cls> method_name=sendData # both args are required
get_xrefs_to_method <sendData> # what triggers the exfil call
get_smali_of_class <NativeLoader> # drop to smali only if Java decompile breaks
```
**Do not reach for `get_strings` to find C2 URLs or keys** — it only returns
`strings.xml` resources, so anything hardcoded in a Java constant is invisible to
it. Use `search_classes_by_keyword` with `search_in="code"` instead (see
[../ctf-reverse/tools-mcp.md](../ctf-reverse/tools-mcp.md#jadx-mcp-android-apk--dex)
for the argument traps and pagination defaults).
**Key insight:** Android malware hides C2 and exfil logic in exported components
(receivers/services). `get_android_manifest` + `search_method_by_name onReceive`
locate the trigger fast; a code-scope `search_classes_by_keyword` finds the
hardcoded config that a resource-string dump would miss entirely; and decompiled
Java (`get_method_by_name` / `get_class_source`) exposes it before you ever touch
smali. For string decryption done at runtime, hook the decryptor
with Frida (see [../ctf-reverse/tools-dynamic.md](../ctf-reverse/tools-dynamic.md#frida-for-androidios)).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |