$npx -y skills add ljagiello/ctf-skills --skill solve-challengeSolves 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 remote service, a suspicious file, or only a vague challenge description and you
| 1 | # CTF Challenge Solver |
| 2 | |
| 3 | You're a skilled CTF player. Your goal is to solve the challenge and find the flag. |
| 4 | |
| 5 | ## Environment Setup |
| 6 | |
| 7 | Two setup strategies depending on your workflow: |
| 8 | |
| 9 | ### Pre-install (recommended before competitions) |
| 10 | |
| 11 | Use the central installer entrypoint: |
| 12 | |
| 13 | ```bash |
| 14 | bash scripts/install_ctf_tools.sh all |
| 15 | ``` |
| 16 | |
| 17 | Run a narrower mode when you only want one tool group: |
| 18 | |
| 19 | ```bash |
| 20 | bash scripts/install_ctf_tools.sh python |
| 21 | bash scripts/install_ctf_tools.sh apt |
| 22 | bash scripts/install_ctf_tools.sh brew |
| 23 | bash scripts/install_ctf_tools.sh gems |
| 24 | bash scripts/install_ctf_tools.sh go |
| 25 | bash scripts/install_ctf_tools.sh manual |
| 26 | ``` |
| 27 | |
| 28 | The full package lists now live in [scripts/install_ctf_tools.sh](../scripts/install_ctf_tools.sh). |
| 29 | |
| 30 | ### On-demand (during challenges) |
| 31 | |
| 32 | Each category skill's `SKILL.md` has a **Prerequisites** section listing only the tools needed for that category. Install as you go. |
| 33 | |
| 34 | ## Workflow |
| 35 | |
| 36 | ### Step 0: CTFd Platform Detection |
| 37 | |
| 38 | If the CTF platform URL is known, check if it runs CTFd and switch to API-driven navigation: |
| 39 | |
| 40 | ```bash |
| 41 | # Detect CTFd (look for /api/v1/ and /themes/core/) |
| 42 | curl -s "$CTF_URL/api/v1/" | head -5 |
| 43 | curl -s "$CTF_URL" | grep -oE '/themes/core/' |
| 44 | ``` |
| 45 | |
| 46 | 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: |
| 47 | |
| 48 | ```bash |
| 49 | export CTF_URL="https://ctf.example.com" |
| 50 | export CTF_TOKEN="ctfd_..." # Ask user for this |
| 51 | ``` |
| 52 | |
| 53 | Invoke `/ctf-misc` and load its `ctfd-navigation.md` for the full API reference and Python client class. |
| 54 | |
| 55 | ### Step 1: Recon |
| 56 | |
| 57 | 1. **Explore files** -- List the challenge directory, run `file *` on everything |
| 58 | 2. **Triage binaries** -- `strings`, `xxd | head`, `binwalk`, `checksec` on binaries |
| 59 | 3. **Fetch links** -- If the challenge mentions URLs, fetch them FIRST for context |
| 60 | 4. **Connect** -- Try remote services (`nc`) to understand what they expect |
| 61 | 5. **Read hints** -- Challenge descriptions, filenames, and comments often contain clues |
| 62 | |
| 63 | ### Step 2: Categorize |
| 64 | |
| 65 | Determine the primary category, then invoke the matching skill. |
| 66 | |
| 67 | **By file type:** |
| 68 | - `.pcap`, `.pcapng`, `.evtx`, `.raw`, `.dd`, `.E01` -> forensics |
| 69 | - `.elf`, `.exe`, `.so`, `.dll`, binary with no extension -> reverse or pwn (check if remote service provided -- if yes, likely pwn) |
| 70 | - `.py`, `.sage`, `.txt` with numbers -> crypto |
| 71 | - `.apk`, `.wasm`, `.pyc` -> reverse |
| 72 | - Web URL or source code with HTML/JS/PHP/templates -> web |
| 73 | - Images, audio, PDFs with no obvious content -> forensics (steganography) |
| 74 | |
| 75 | **By challenge description keywords:** |
| 76 | - "buffer overflow", "ROP", "shellcode", "libc", "heap" -> pwn |
| 77 | - "RSA", "AES", "cipher", "encrypt", "prime", "modulus", "lattice", "LWE", "GCM" -> crypto |
| 78 | - "XSS", "SQL", "injection", "cookie", "JWT", "SSRF" -> web |
| 79 | - "disk image", "memory dump", "packet capture", "registry", "power trace", "side-channel", "spectrogram", "audio tracks", "MKV" -> forensics |
| 80 | - "find", "locate", "identify", "who", "where" -> osint |
| 81 | - "obfuscated", "packed", "C2", "malware", "beacon" -> malware |
| 82 | - "jail", "sandbox", "escape", "encoding", "signal", "game", "Nim", "commitment", "Gray code" -> misc |
| 83 | |
| 84 | **By service behavior:** |
| 85 | - Port with interactive prompt, crash on long input -> pwn |
| 86 | - HTTP service -> web |
| 87 | - netcat with math/crypto puzzles -> crypto |
| 88 | - netcat with restricted shell or eval -> misc (jail) |
| 89 | |
| 90 | ### Step 3: Invoke the Category Skill |
| 91 | |
| 92 | Once you identify the category, **invoke the matching skill** to get specialized techniques: |
| 93 | |
| 94 | | Category | Invoke | When to Use | |
| 95 | |----------|--------|-------------| |
| 96 | | Web | `/ctf-web` | XSS, SQLi, SSTI, SSRF, JWT, file uploads, prototype pollution | |
| 97 | | Pwn | `/ctf-pwn` | Buffer overflow, format string, heap, ROP, sandbox escape | |
| 98 | | Crypto | `/ctf-crypto` | RSA, AES, ECC, PRNG, ZKP, classical ciphers | |
| 99 | | Reverse | `/ctf-reverse` | Binary analysis, game clients, VMs, obfuscated code | |
| 100 | | Forensics | `/ctf-forensics` | Disk images, memory dumps, event logs, stego, network captures | |
| 101 | | OSINT | `/ctf-osint` | Social media, geolocatio |