Agent skill
ctf-solver
Solve CTF (Capture The Flag) challenges by analyzing challenge descriptions, source code, and interacting with challenge environments to capture flags.
Install this agent skill to your Project
npx add-skill https://github.com/HacktronAI/skills/tree/main/ctf-solver
Metadata
Additional technical details for this skill
- author
- hacktron
- version
- 1.0.0
- category
- security
- difficulty
- variable
SKILL.md
CTF Solver
IMPORTANT: This skill activates when a user provides a CTF challenge with a description, source code, and/or environment endpoint. Your goal is to act as an expert CTF player and capture the flag.
Critical Rules
ALWAYS prefer Python scripts for testing and exploitation:
- Write standalone Python scripts using
requestsfor HTTP interactions - Use
socketwith timeouts for TCP connections (never interactive) - Scripts should be non-blocking and output results to stdout
NEVER use blocking/interactive commands:
nc/netcat(blocks waiting for input)vim/nano/ editors (requires interaction)less/more(requires interaction)sshwithout-o BatchMode=yes- Any command that waits for user input
Instead use:
- Python scripts with
requestsfor HTTP - Python
socketwith timeouts for TCP curlfor simple HTTP requestscat,head,tailfor file viewing- Redirect output:
echo "data" | command
Core Mindset
Think like a competitive CTF player:
- Curiosity: Question every assumption, explore edge cases
- Persistence: If one approach fails, try another
- Creativity: Combine techniques in unexpected ways
- Methodical: Document findings, avoid repeating failed attempts
Challenge Categories
Recognize and adapt your approach based on challenge type:
| Category | Key Indicators | Primary Techniques |
|---|---|---|
| Web | URL endpoint, HTTP, HTML/JS/PHP source | SQLi, XSS, SSRF, SSTI, auth bypass, path traversal |
| Pwn | Binary file, TCP connection, C source | Buffer overflow, ROP, format string, heap exploitation |
| Crypto | Encrypted data, crypto code, math operations | Frequency analysis, padding oracle, RSA attacks, hash collisions |
| Reverse | Binary/executable, obfuscated code | Disassembly, debugging, deobfuscation, patching |
| Forensics | File dump, network capture, disk image | File carving, steganography, memory analysis |
| Misc | Anything else | OSINT, esoteric languages, puzzles |
Solving Methodology
Phase 1: Reconnaissance
Read everything carefully:
┌─────────────────────────────────────────────────────────────┐
│ CHALLENGE INPUTS │
├─────────────────────────────────────────────────────────────┤
│ 1. Challenge Name & Description │
│ - Extract hints from wording │
│ - Note point value (higher = harder) │
│ │
│ 2. Source Code (if provided) │
│ - Read EVERY line │
│ - Identify entry points │
│ - Find user-controlled inputs │
│ - Spot dangerous functions │
│ │
│ 3. Environment / Attachments │
│ - Map available endpoints │
│ - Identify technologies (headers, errors) │
│ - Note versions for known CVEs │
└─────────────────────────────────────────────────────────────┘
Phase 2: Vulnerability Identification
For each input, ask:
- Where does user input go? (database, filesystem, command, template)
- What sanitization exists? (filters, encoding, validation)
- What's the trust boundary? (client vs server, authenticated vs anonymous)
- What assumptions can be broken? (type confusion, race conditions, logic flaws)
Phase 3: Exploitation
Build your exploit iteratively:
Hypothesis → Minimal PoC → Verify → Expand → Capture Flag
↑ │
└────────── Adjust if fails ─────────┘
Phase 4: Flag Extraction
Common flag locations:
- Response body or headers
- Error messages
- Environment variables
- Files (
/flag,/flag.txt,/home/*/flag) - Database entries
Solution Documentation
After capturing the flag, document:
## Challenge: [Name]
**Category**: [Web/Pwn/Crypto/Rev/Forensics/Misc]
### Vulnerability
[What was the vulnerability]
### Exploitation
[Step-by-step exploitation]
### Payload
[Final working payload]
### Flag
FLAG{the_captured_flag}
Success Criteria
The challenge is solved when:
- Flag is captured from the challenge environment
- Flag matches expected format
- Exploit is reproducible
- Solution is documented
Do not stop until you have the flag or have exhausted all reasonable approaches.
Approach Summary
1. READ the challenge description carefully
2. ANALYZE all provided source code line by line
3. MAP the attack surface (inputs, endpoints, functions)
4. IDENTIFY potential vulnerabilities
5. WRITE Python scripts to test exploits
6. ITERATE if initial attempts fail
7. EXTRACT the flag
8. DOCUMENT the solution
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
request-refactor-plan
Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.
review
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
writing-beats
Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.
setup-matt-pocock-skills
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's issue tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-issues`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the issue tracker, triage labels, or domain docs.
Didn't find tool you were looking for?