CTF Challenge Solver
You're a skilled CTF player. Your goal is to solve the challenge and find the flag.
Environment Setup
Two setup strategies depending on your workflow:
Pre-install (recommended before competitions)
Use the central installer entrypoint:
bash scripts/install_ctf_tools.sh all
Run a narrower mode when you only want one tool group:
bash scripts/install_ctf_tools.sh python
bash scripts/install_ctf_tools.sh apt
bash scripts/install_ctf_tools.sh brew
bash scripts/install_ctf_tools.sh gems
bash scripts/install_ctf_tools.sh go
bash scripts/install_ctf_tools.sh manual
The full package lists now live in scripts/install_ctf_tools.sh.
On-demand (during challenges)
Each category skill's SKILL.md has a Prerequisites section listing only the tools needed for that category. Install as you go.
Workflow
Step 0: CTFd Platform Detection
If the CTF platform URL is known, check if it runs CTFd and switch to API-driven navigation:
# Detect CTFd (look for /api/v1/ and /themes/core/)
curl -s "$CTF_URL/api/v1/" | head -5
curl -s "$CTF_URL" | grep -oE '/themes/core/'
If CTFd is detected, ask the user for their API token (generated from CTFd Settings > Access Tokens). The token is not provided by default — the user must create one in the CTFd web UI first. Once provided, set the environment variables and proceed via API:
export CTF_URL="https://ctf.example.com"
export CTF_TOKEN="ctfd_..." # Ask user for this
Invoke /ctf-misc and load its ctfd-navigation.md (not distributed with this library) for the full API reference and Python client class.
CTF Platform Interaction via Playwright MCP
When the platform is not CTFd, has no usable API, or gates challenges behind a
JS-rendered UI / login, drive the platform in a real browser with Playwright
MCP (https://github.com/microsoft/playwright-mcp). This lets the agent read
challenge text, download attachments, keep a login session, and submit flags
directly through the site.
browser_navigate "https://ctf.example.com/challenges"
browser_snapshot # list challenges, points, categories (rendered)
browser_click <challenge ref> # open a challenge card
browser_snapshot # read description, hints, attachment links
browser_click <attachment ref> # download the challenge file (saved by the browser)
# ... solve the challenge ...
browser_type <flag input ref> "flag{...}"
browser_click <submit ref>
browser_find text="Correct" # cheaper than a full snapshot to check the verdict
browser_find (text or regex over the accessibility tree) is the right tool
whenever you only need to confirm one value — reserve full browser_snapshot
for when you need element refs to click or type into.
Login sessions (cookies/localStorage) persist across tool calls, so authenticate
once and every later navigation is authorized. For general browser-automation
tooling see ../ctf-web/tools-mcp.md.
Prefer a native API when one exists (CTFd token flow above is faster and more
reliable); use Playwright MCP for platforms without an API or when the challenge
list only renders client-side.
Step 1: Recon
- Explore files -- List the challenge directory, run
file * on everything
- Triage binaries --
strings, xxd | head, binwalk, checksec on binaries
- Fetch links -- If the challenge mentions URLs, fetch them FIRST for context
- Connect -- Try remote services (
nc) to understand what they expect
- Read hints -- Challenge descriptions, filenames, and comments often contain clues
Step 2: Categorize
Determine the primary category, then invoke the matching skill.
By file type:
.pcap, .pcapng, .evtx, .raw, .dd, .E01 -> forensics
.elf, .exe, .so, .dll, binary with no extension -> reverse or pwn (check if remote service provided -- if yes, likely pwn)
.py, .sage, .txt with numbers -> crypto
.apk, .wasm, .pyc -> reverse
.safetensors, .pt, .pth, .bin, .onnx -> ai-ml
- Web URL or source code with HTML/JS/PHP/templates -> web
- Images, audio, PDFs with no obvious content -> forensics (steganography)
By challenge description keywords:
- "buffer overflow", "ROP", "shellcode", "libc", "heap" -> pwn
- "RSA", "AES", "cipher", "encrypt", "prime", "modulus", "lattice", "LWE", "GCM" -> crypto
- "XSS", "SQL", "injection", "cookie", "JWT", "SSRF" -> web
- "disk image", "memory dump", "packet capture", "registry", "power trace", "side-channel", "spectrogram", "audio tracks", "MKV" -> forensics
- "find", "locate", "identify", "who", "where" -> osint
- "obfuscated", "packed", "C2", "malware", "beacon" -> malware
- "prompt injection", "LoRA", "adversarial", "model weights", "embedding" -> ai-ml
- "jail", "sandbox", "escape", "encoding", "signal", "game", "Nim", "commitment", "Gray code" -> misc
By service behavior:
- Port with interactive prompt, crash on long input -> pwn
- HTTP service -> web
- netcat with math/crypto puzzles -> crypto
- netcat with restricted shell or eval -> misc (jail)
📎 Detailed content (full examples / references / data tables) has been split into reference.md in the same directory; use Read to load the relevant section on demand.
📎 Reference Document Notice: this skill is adapted from an upstream open-source repository; the following reference documents are not distributed with this library: ctfd-navigation.md, install_ctf_tools.sh. The key points of the related topics are retained in the corresponding descriptions in this document; if you need the expanded content, grep the library using keywords from the body text or search on your own.
1---2name: solve-challenge3description: "CTF solver scheduler: first-pass triage to identify challenge type and route to specialized ctf-* skills; skip when type is already clear. Signals: ctf, solve, routing, challenge triage, competition."4zh-signals: "CTF 解题调度器:首轮分诊识别题型,路由到对应 ctf-* 专项 skill;题型已明时不走此 skill。信号:ctf,解题,调度,题型分诊,比赛。"5when-to-use: Solves CTF challenges by performing first-pass triage, identifying the dominant category, and routing execution to the right specialized ctf-* skill. Use when the user gives you a challenge bundle, a 6license: MIT7compatibility: Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access. Orchestrates other ctf-* skills.8allowed-tools: Bash Read Write Edit Glob Grep Task WebFetch WebSearch Skill9metadata:10 source: https://skillmd.com/skills/dangeroussong/solve-challenge11 user-invocable: "true"12 argument-hint: "[category] [challenge-file-or-url]"13---1415# CTF Challenge Solver1617You're a skilled CTF player. Your goal is to solve the challenge and find the flag.1819## Environment Setup2021Two setup strategies depending on your workflow:2223### Pre-install (recommended before competitions)2425Use the central installer entrypoint:2627```bash28bash scripts/install_ctf_tools.sh all29```3031Run a narrower mode when you only want one tool group:3233```bash34bash scripts/install_ctf_tools.sh python35bash scripts/install_ctf_tools.sh apt36bash scripts/install_ctf_tools.sh brew37bash scripts/install_ctf_tools.sh gems38bash scripts/install_ctf_tools.sh go39bash scripts/install_ctf_tools.sh manual40```4142The full package lists now live in scripts/install_ctf_tools.sh.4344### On-demand (during challenges)4546Each category skill's `SKILL.md` has a **Prerequisites** section listing only the tools needed for that category. Install as you go.4748## Workflow4950### Step 0: CTFd Platform Detection5152If the CTF platform URL is known, check if it runs CTFd and switch to API-driven navigation:5354```bash55# Detect CTFd (look for /api/v1/ and /themes/core/)56curl -s "$CTF_URL/api/v1/" | head -557curl -s "$CTF_URL" | grep -oE '/themes/core/'58```5960If CTFd is detected, **ask the user for their API token** (generated from CTFd Settings > Access Tokens). The token is not provided by default — the user must create one in the CTFd web UI first. Once provided, set the environment variables and proceed via API:6162```bash63export CTF_URL="https://ctf.example.com"64export CTF_TOKEN="ctfd_..." # Ask user for this65```6667Invoke `/ctf-misc` and load its `ctfd-navigation.md` (not distributed with this library) for the full API reference and Python client class.6869#### CTF Platform Interaction via Playwright MCP7071When the platform is **not** CTFd, has no usable API, or gates challenges behind a72JS-rendered UI / login, drive the platform in a real browser with **Playwright73MCP** (`https://github.com/microsoft/playwright-mcp`). This lets the agent read74challenge text, download attachments, keep a login session, and submit flags75directly through the site.7677```text78browser_navigate "https://ctf.example.com/challenges"79browser_snapshot # list challenges, points, categories (rendered)80browser_click <challenge ref> # open a challenge card81browser_snapshot # read description, hints, attachment links82browser_click <attachment ref> # download the challenge file (saved by the browser)83# ... solve the challenge ...84browser_type <flag input ref> "flag{...}"85browser_click <submit ref>86browser_find text="Correct" # cheaper than a full snapshot to check the verdict87```8889`browser_find` (text or regex over the accessibility tree) is the right tool90whenever you only need to confirm one value — reserve full `browser_snapshot`91for when you need element refs to click or type into.9293Login sessions (cookies/localStorage) persist across tool calls, so authenticate94once and every later navigation is authorized. For general browser-automation95tooling see [../ctf-web/tools-mcp.md](../ctf-web/tools-mcp.md#playwright-mcp-browser-automation).9697**Prefer a native API when one exists** (CTFd token flow above is faster and more98reliable); use Playwright MCP for platforms without an API or when the challenge99list only renders client-side.100101### Step 1: Recon1021031. **Explore files** -- List the challenge directory, run `file *` on everything1042. **Triage binaries** -- `strings`, `xxd | head`, `binwalk`, `checksec` on binaries1053. **Fetch links** -- If the challenge mentions URLs, fetch them FIRST for context1064. **Connect** -- Try remote services (`nc`) to understand what they expect1075. **Read hints** -- Challenge descriptions, filenames, and comments often contain clues108109### Step 2: Categorize110111Determine the primary category, then invoke the matching skill.112113**By file type:**114- `.pcap`, `.pcapng`, `.evtx`, `.raw`, `.dd`, `.E01` -> forensics115- `.elf`, `.exe`, `.so`, `.dll`, binary with no extension -> reverse or pwn (check if remote service provided -- if yes, likely pwn)116- `.py`, `.sage`, `.txt` with numbers -> crypto117- `.apk`, `.wasm`, `.pyc` -> reverse118- `.safetensors`, `.pt`, `.pth`, `.bin`, `.onnx` -> ai-ml119- Web URL or source code with HTML/JS/PHP/templates -> web120- Images, audio, PDFs with no obvious content -> forensics (steganography)121122**By challenge description keywords:**123- "buffer overflow", "ROP", "shellcode", "libc", "heap" -> pwn124- "RSA", "AES", "cipher", "encrypt", "prime", "modulus", "lattice", "LWE", "GCM" -> crypto125- "XSS", "SQL", "injection", "cookie", "JWT", "SSRF" -> web126- "disk image", "memory dump", "packet capture", "registry", "power trace", "side-channel", "spectrogram", "audio tracks", "MKV" -> forensics127- "find", "locate", "identify", "who", "where" -> osint128- "obfuscated", "packed", "C2", "malware", "beacon" -> malware129- "prompt injection", "LoRA", "adversarial", "model weights", "embedding" -> ai-ml130- "jail", "sandbox", "escape", "encoding", "signal", "game", "Nim", "commitment", "Gray code" -> misc131132**By service behavior:**133- Port with interactive prompt, crash on long input -> pwn134- HTTP service -> web135- netcat with math/crypto puzzles -> crypto136- netcat with restricted shell or eval -> misc (jail)137138> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.139140> 📎 **Reference Document Notice**: this skill is adapted from an upstream open-source repository; the following reference documents are **not distributed with this library**: `ctfd-navigation.md`, `install_ctf_tools.sh`. The key points of the related topics are retained in the corresponding descriptions in this document; if you need the expanded content, grep the library using keywords from the body text or search on your own.