# Solve Challenge

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

- Skill: `dangeroussong/solve-challenge` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add dangeroussong/solve-challenge`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dangeroussong/solve-challenge/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: DangerousSONG (https://skillmd.com/u/dangeroussong)
- Updated: 2026-11-19
- Page: https://skillmd.com/skills/dangeroussong/solve-challenge

---


# 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
bash scripts/install_ctf_tools.sh all
```

Run a narrower mode when you only want one tool group:

```bash
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:

```bash
# 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:

```bash
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.

```text
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](../ctf-web/tools-mcp.md#playwright-mcp-browser-automation).

**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

1. **Explore files** -- List the challenge directory, run `file *` on everything
2. **Triage binaries** -- `strings`, `xxd | head`, `binwalk`, `checksec` on binaries
3. **Fetch links** -- If the challenge mentions URLs, fetch them FIRST for context
4. **Connect** -- Try remote services (`nc`) to understand what they expect
5. **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.

