Index of every page on this site: llms.txt
All skills
ljagiello avatar

/ctf-malware

@20d182d
by Lukasz Jagielloljagiello/ctf-skills3.8k stars
447
Run it yourself

Provides 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.

Use this Skill: https://skilld.dev/gh/ljagiello/ctf-skills/ctf-malware

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

tools-mcp.md

≈2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

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; this file covers the malware-specific angle and WinDbg MCP for dynamic analysis.

Table of Contents

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 — pseudocode first, assembly only when the decompiler fails (same golden rule).

Malware-specific queries:

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.

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).
  • Extract the C2 config: decompile the routine that reads the encrypted blob and reproduce it in Python (see 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).
  • 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. 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):

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:

cdb -server tcp:port=5005 sample.exe    # inside the disposable VM
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).


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.

Android malware loop:

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 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).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings26d5 checks · Risk SAFE
  • Gen Agent Trust Hub26d

    This skill provides a comprehensive set of techniques and tools for CTF malware analysis and network forensics. It documents standard procedures such as static binary analysis, traffic decryption, and dynamic debugging. While it utilizes powerful tools, external package installations, and elevated privileges (sudo) for network sniffing, all operations are consistent with its educational and forensic purpose. The skill includes explicit warnings to perform analysis only within isolated virtual environments.

  • Socket26d

    1 alert: gptSecurity

  • Snyk26d

    Risk: LOW · No issues

  • Runlayer8mo

    4/4 files flagged

  • ZeroLeaks7mo

    1 finding · Score: 86/100

Signed by skilld at 20d182d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 weeks ago
metadata
{
  "user-invocable": "false",
  "author": "Lukasz Jagiello"
}
All 1 allowed tools
Bash Read Write Edit Glob Grep Task WebFetch WebSearch
Other metadata
compatibility
Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access for tool installation.

README badge

README badge for ljagiello/ctf-skills/ctf-malware