ctf-agent 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +131 -0
- package/Dockerfile +192 -0
- package/README.md +522 -0
- package/agents/ctf-analyzer.md +58 -0
- package/agents/ctf-controller.md +151 -0
- package/agents/ctf-speedrun.md +74 -0
- package/bin/ctf-agent.js +119 -0
- package/docker-compose.yml +13 -0
- package/mcp_config.json +19 -0
- package/package.json +44 -0
- package/references/ctf-triage-ladder.md +68 -0
- package/references/exploit-databases.md +575 -0
- package/references/llm-safety-and-policy-compliance.md +173 -0
- package/references/multi-agent-orchestration-and-policy-routing.md +278 -0
- package/references/security-events-and-intelligence.md +566 -0
- package/references/version-matrix.md +59 -0
- package/rules/ctf-execution-rules.md +44 -0
- package/rules/ctf-safety-framing-rules.md +140 -0
- package/rules/flag-validation-rules.md +25 -0
- package/scripts/__init__.py +1 -0
- package/scripts/ctf-tools.lock +205 -0
- package/scripts/ctf_init.py +1026 -0
- package/scripts/ctf_update.py +583 -0
- package/scripts/ctfd_client.py +81 -0
- package/scripts/cve_lookup.py +453 -0
- package/scripts/extract_flags.py +155 -0
- package/scripts/install_as_agent.py +278 -0
- package/scripts/install_ctf_tools.sh +603 -0
- package/scripts/parallel_triage.py +395 -0
- package/scripts/prompt_policy_sanitizer.py +283 -0
- package/scripts/scope_guard.py +444 -0
- package/scripts/skill_validator.py +504 -0
- package/scripts/workspace_cleaner.py +141 -0
- package/skills/ctf-ai-ml/SKILL.md +120 -0
- package/skills/ctf-ai-ml/adversarial-ml.md +623 -0
- package/skills/ctf-ai-ml/llm-attacks.md +487 -0
- package/skills/ctf-ai-ml/model-attacks.md +422 -0
- package/skills/ctf-crypto/SKILL.md +320 -0
- package/skills/ctf-crypto/advanced-math.md +798 -0
- package/skills/ctf-crypto/classic-ciphers.md +651 -0
- package/skills/ctf-crypto/ecc-attacks.md +347 -0
- package/skills/ctf-crypto/exotic-crypto-2.md +380 -0
- package/skills/ctf-crypto/exotic-crypto.md +528 -0
- package/skills/ctf-crypto/historical.md +113 -0
- package/skills/ctf-crypto/lattice-and-lwe.md +524 -0
- package/skills/ctf-crypto/modern-ciphers-2.md +563 -0
- package/skills/ctf-crypto/modern-ciphers-3.md +453 -0
- package/skills/ctf-crypto/modern-ciphers.md +649 -0
- package/skills/ctf-crypto/prng-attacks.md +257 -0
- package/skills/ctf-crypto/prng.md +664 -0
- package/skills/ctf-crypto/rsa-attacks-2.md +792 -0
- package/skills/ctf-crypto/rsa-attacks.md +487 -0
- package/skills/ctf-crypto/stream-ciphers.md +390 -0
- package/skills/ctf-crypto/zkp-and-advanced.md +456 -0
- package/skills/ctf-forensics/3d-printing.md +121 -0
- package/skills/ctf-forensics/SKILL.md +379 -0
- package/skills/ctf-forensics/disk-advanced.md +497 -0
- package/skills/ctf-forensics/disk-and-memory.md +491 -0
- package/skills/ctf-forensics/disk-recovery.md +699 -0
- package/skills/ctf-forensics/linux-forensics.md +511 -0
- package/skills/ctf-forensics/network-advanced.md +583 -0
- package/skills/ctf-forensics/network.md +645 -0
- package/skills/ctf-forensics/peripheral-capture.md +287 -0
- package/skills/ctf-forensics/signals-and-hardware.md +713 -0
- package/skills/ctf-forensics/steganography.md +694 -0
- package/skills/ctf-forensics/stego-advanced-2.md +475 -0
- package/skills/ctf-forensics/stego-advanced.md +481 -0
- package/skills/ctf-forensics/stego-image.md +691 -0
- package/skills/ctf-forensics/windows.md +625 -0
- package/skills/ctf-malware/SKILL.md +181 -0
- package/skills/ctf-malware/c2-and-protocols.md +274 -0
- package/skills/ctf-malware/pe-and-dotnet.md +108 -0
- package/skills/ctf-malware/scripts-and-obfuscation.md +449 -0
- package/skills/ctf-misc/SKILL.md +498 -0
- package/skills/ctf-misc/bashjails.md +323 -0
- package/skills/ctf-misc/ctfd-navigation.md +465 -0
- package/skills/ctf-misc/dns.md +255 -0
- package/skills/ctf-misc/encodings-advanced.md +504 -0
- package/skills/ctf-misc/encodings.md +431 -0
- package/skills/ctf-misc/games-and-vms-2.md +254 -0
- package/skills/ctf-misc/games-and-vms-3.md +690 -0
- package/skills/ctf-misc/games-and-vms-4.md +229 -0
- package/skills/ctf-misc/games-and-vms.md +529 -0
- package/skills/ctf-misc/linux-privesc.md +333 -0
- package/skills/ctf-misc/pyjails.md +671 -0
- package/skills/ctf-misc/rf-sdr.md +91 -0
- package/skills/ctf-osint/SKILL.md +198 -0
- package/skills/ctf-osint/geolocation-and-media.md +464 -0
- package/skills/ctf-osint/social-media.md +312 -0
- package/skills/ctf-osint/web-and-dns.md +341 -0
- package/skills/ctf-pwn/SKILL.md +214 -0
- package/skills/ctf-pwn/advanced-exploits-2.md +579 -0
- package/skills/ctf-pwn/advanced-exploits-3.md +598 -0
- package/skills/ctf-pwn/advanced-exploits-4.md +590 -0
- package/skills/ctf-pwn/advanced-exploits-5.md +119 -0
- package/skills/ctf-pwn/advanced-exploits.md +773 -0
- package/skills/ctf-pwn/advanced.md +326 -0
- package/skills/ctf-pwn/field-notes.md +245 -0
- package/skills/ctf-pwn/format-string.md +694 -0
- package/skills/ctf-pwn/heap-fsop.md +285 -0
- package/skills/ctf-pwn/heap-techniques-2.md +333 -0
- package/skills/ctf-pwn/heap-techniques.md +513 -0
- package/skills/ctf-pwn/kernel-bypass.md +421 -0
- package/skills/ctf-pwn/kernel-techniques.md +366 -0
- package/skills/ctf-pwn/kernel.md +636 -0
- package/skills/ctf-pwn/overflow-basics.md +611 -0
- package/skills/ctf-pwn/rop-advanced.md +725 -0
- package/skills/ctf-pwn/rop-and-shellcode.md +659 -0
- package/skills/ctf-pwn/sandbox-escape.md +313 -0
- package/skills/ctf-reverse/SKILL.md +163 -0
- package/skills/ctf-reverse/anti-analysis-ctf.md +204 -0
- package/skills/ctf-reverse/anti-analysis.md +693 -0
- package/skills/ctf-reverse/field-notes.md +376 -0
- package/skills/ctf-reverse/languages-compiled.md +666 -0
- package/skills/ctf-reverse/languages-platforms.md +592 -0
- package/skills/ctf-reverse/languages.md +553 -0
- package/skills/ctf-reverse/patterns-ctf-2.md +397 -0
- package/skills/ctf-reverse/patterns-ctf-3.md +797 -0
- package/skills/ctf-reverse/patterns-ctf.md +670 -0
- package/skills/ctf-reverse/patterns-runtime.md +274 -0
- package/skills/ctf-reverse/patterns.md +572 -0
- package/skills/ctf-reverse/platforms-hardware.md +387 -0
- package/skills/ctf-reverse/platforms.md +664 -0
- package/skills/ctf-reverse/tools-advanced-2.md +421 -0
- package/skills/ctf-reverse/tools-advanced.md +407 -0
- package/skills/ctf-reverse/tools-dynamic.md +679 -0
- package/skills/ctf-reverse/tools-emulation.md +319 -0
- package/skills/ctf-reverse/tools.md +573 -0
- package/skills/ctf-web/SKILL.md +153 -0
- package/skills/ctf-web/auth-and-access-2.md +82 -0
- package/skills/ctf-web/auth-and-access.md +783 -0
- package/skills/ctf-web/auth-infra.md +321 -0
- package/skills/ctf-web/auth-jwt.md +186 -0
- package/skills/ctf-web/client-side-advanced.md +739 -0
- package/skills/ctf-web/client-side.md +529 -0
- package/skills/ctf-web/cves.md +373 -0
- package/skills/ctf-web/field-notes.md +482 -0
- package/skills/ctf-web/node-and-prototype.md +200 -0
- package/skills/ctf-web/server-side-2.md +337 -0
- package/skills/ctf-web/server-side-advanced-2.md +559 -0
- package/skills/ctf-web/server-side-advanced-3.md +125 -0
- package/skills/ctf-web/server-side-advanced-4.md +480 -0
- package/skills/ctf-web/server-side-advanced.md +378 -0
- package/skills/ctf-web/server-side-deser.md +443 -0
- package/skills/ctf-web/server-side-exec-2.md +799 -0
- package/skills/ctf-web/server-side-exec.md +457 -0
- package/skills/ctf-web/server-side.md +629 -0
- package/skills/ctf-web/sql-injection.md +790 -0
- package/skills/ctf-web/web3.md +374 -0
- package/skills/ctf-writeup/SKILL.md +90 -0
- package/skills/solve-challenge/SKILL.md +269 -0
- package/skills.json +16 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: solve-challenge
|
|
3
|
+
description: Coordinates triage and solution workflows for authorized CTF competition challenges and educational security labs by identifying the dominant challenge category and routing execution to the right specialized ctf-* skill. Use when given an authorized CTF challenge bundle, isolated test service, or benchmark file.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access. Orchestrates other ctf-* skills.
|
|
6
|
+
allowed-tools: Bash Read Write Edit Glob Grep Task WebFetch WebSearch Skill
|
|
7
|
+
metadata:
|
|
8
|
+
user-invocable: "true"
|
|
9
|
+
argument-hint: "[--mode blitz|deep] [category] [challenge-file-or-url]"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# CTF Challenge Solver
|
|
13
|
+
|
|
14
|
+
You're a skilled CTF player. Your goal is to solve the challenge and find the flag.
|
|
15
|
+
|
|
16
|
+
## Environment Setup & Tool Invocation
|
|
17
|
+
|
|
18
|
+
All CTF tools and Python libraries are centrally managed and installed via the toolchain installer in [scripts/install_ctf_tools.sh](../../scripts/install_ctf_tools.sh).
|
|
19
|
+
|
|
20
|
+
### Pre-install Full Toolchain
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bash .agents/scripts/install_ctf_tools.sh all
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Verify installed packages:
|
|
27
|
+
```bash
|
|
28
|
+
bash .agents/scripts/install_ctf_tools.sh --verify
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Execution Across Platforms
|
|
32
|
+
|
|
33
|
+
- **On Windows Host (via WSL Kali Linux)**:
|
|
34
|
+
- Run Linux tools and virtualenv-installed Python modules directly inside WSL:
|
|
35
|
+
```bash
|
|
36
|
+
wsl -d kali-linux bash -c "source ~/.ctf-tools/venv/bin/activate && <command>"
|
|
37
|
+
```
|
|
38
|
+
- Pre-installed virtualenv is at `~/.ctf-tools/venv` (auto-activated in `~/.bashrc`).
|
|
39
|
+
- Windows files are accessible at `/mnt/c/Users/...`.
|
|
40
|
+
|
|
41
|
+
- **On Native Linux / WSL**:
|
|
42
|
+
- Activate the CTF virtualenv before executing scripts:
|
|
43
|
+
```bash
|
|
44
|
+
source ~/.ctf-tools/venv/bin/activate
|
|
45
|
+
```
|
|
46
|
+
- System binaries (`nmap`, `r2`, `gdb`, `tshark`, `hashcat`, `ffuf`, `apktool`, etc.) are directly available in PATH.
|
|
47
|
+
|
|
48
|
+
## Core References & Intelligence Hubs
|
|
49
|
+
|
|
50
|
+
- [exploit-databases.md](../../references/exploit-databases.md) - Exploit databases, CVE advisories, Sploitus, Exploit-DB/Searchsploit, GitHub PoCs, and the `.agents/scripts/cve_lookup.py` CLI utility.
|
|
51
|
+
- [security-events-and-intelligence.md](../../references/security-events-and-intelligence.md) - Security event intelligence, CTFtime archives, Pwn2Own research, threat intel feeds, and automated key/flag/CTFd token extraction techniques.
|
|
52
|
+
|
|
53
|
+
## Workflow
|
|
54
|
+
|
|
55
|
+
### Step 0: CTFd Platform Detection
|
|
56
|
+
|
|
57
|
+
If the CTF platform URL is known, check if it runs CTFd and switch to API-driven navigation:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Detect CTFd (look for /api/v1/ and /themes/core/)
|
|
61
|
+
curl -s "$CTF_URL/api/v1/" | head -5
|
|
62
|
+
curl -s "$CTF_URL" | grep -oE '/themes/core/'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
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:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
export CTF_URL="https://ctf.example.com"
|
|
69
|
+
export CTF_TOKEN="ctfd_..." # Ask user for this
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Invoke `/ctf-misc` and load its `ctfd-navigation.md` for the full API reference and Python client class. See [security-events-and-intelligence.md](../../references/security-events-and-intelligence.md) for automated event key extraction and flag submission.
|
|
73
|
+
|
|
74
|
+
### Step 0.5: Operational Mode Determination (Blitz vs Deep Analysis)
|
|
75
|
+
|
|
76
|
+
Determine the operational profile before beginning exploitation:
|
|
77
|
+
|
|
78
|
+
1. **Blitz / Speedrun Mode (`--mode blitz`, `--fast`)**:
|
|
79
|
+
- **Trigger**: Active CTF competitions, time pressure, or prompts like "speedrun", "fast", "blitz", "find flag quickly".
|
|
80
|
+
- **Primary Objective**: Minimal Time-to-Flag (First Blood).
|
|
81
|
+
- **Behavioral Rule**: Fast triage, tight timeouts (30-60s max per attempt), **Stop-on-Flag (HALT immediately)**, zero doc/writeup overhead, auto-clean temporary scratch files, print flag banner, and exit.
|
|
82
|
+
|
|
83
|
+
2. **Deep Analysis / Lab Mode (`--mode deep`, `--deep`, `--lab`)**:
|
|
84
|
+
- **Trigger**: Lab challenges (HTB, PortSwigger, pwnable.tw), security audits, research, or prompts like "deep analysis", "detailed writeup", "write docs", "root cause analysis".
|
|
85
|
+
- **Primary Objective**: Security rigor, exhaustive Root Cause Analysis (RCA), and publication-ready documentation.
|
|
86
|
+
- **Behavioral Rule**: Reverse engineering, memory/math layout documentation, artifact preservation in `resources/`, invoke `/ctf-writeup` to generate standard `writeup.md`, and create self-contained `solve.py`.
|
|
87
|
+
|
|
88
|
+
### Step 0.6: Task Envelope & Security Context Binding
|
|
89
|
+
|
|
90
|
+
Before delegating to category skills or secondary agents, bind the challenge/lab into a **Task Envelope (TE)** and **Security Context Object (SCO)** per [multi-agent-orchestration-and-policy-routing.md](../../references/multi-agent-orchestration-and-policy-routing.md):
|
|
91
|
+
1. **Define Security Context**: Binds target endpoint/file, establishes `mode: ctf | lab`, confirms `environment.isolated: true`.
|
|
92
|
+
2. **Shallow Execution Mandate**: Delegate directly to the single category skill (e.g. `/ctf-web`, `/ctf-pwn`). Do not spawn recursive subagents.
|
|
93
|
+
3. **Refusal Router Protocol**:
|
|
94
|
+
- If an invocation returns a safety refusal, classify:
|
|
95
|
+
- Type A (Wording): 1 retry with `prompt_policy_sanitizer.py`.
|
|
96
|
+
- Type B (Ambiguity): 1 retry with attached Security Context.
|
|
97
|
+
- Type C (Hard Policy): 0 retries with rephrasing; fall back immediately to deterministic tools (`wsl bash -c ...`, `checksec`, `gdb`, `curl`, `pwntools`).
|
|
98
|
+
|
|
99
|
+
### Step 1: Hint & Description Analysis (Hint-First Methodology)
|
|
100
|
+
|
|
101
|
+
**CRITICAL RULE**: If a challenge title, description, or hint is provided, **analyze it thoroughly BEFORE touching files or running recon tools**.
|
|
102
|
+
|
|
103
|
+
Challenge authors intentionally embed directional cues to prevent players from going down irrelevant rabbit holes:
|
|
104
|
+
1. **Name Puns & Exploit Metaphors**:
|
|
105
|
+
- "Apple" / "Fruit" -> House of Apple (FSOP)
|
|
106
|
+
- "Wiener" / "Fermat" / "Broadcast" -> Specific RSA attacks
|
|
107
|
+
- "Flight" / "RSC" -> React Server Components Flight RCE
|
|
108
|
+
- "Lattice" / "Knapsack" / "Vector" -> LLL / CVP / LWE
|
|
109
|
+
- "Tcache" / "Fast" -> Specific glibc heap bins
|
|
110
|
+
2. **Technical Fingerprints & Negative Constraints**:
|
|
111
|
+
- Explicit version mentions: "Runs on Ubuntu 24.04 (glibc 2.39)", "PHP 8.2", "Python 3.12"
|
|
112
|
+
- Scope limiters: "No brute force required", "Zero network traffic needed", "Only port 8080"
|
|
113
|
+
3. **Formulate Hypotheses**:
|
|
114
|
+
- Establish 1-2 prioritized exploit paths based on the hint.
|
|
115
|
+
- **Only if NO hint/description exists (or it is purely generic like 'Get the flag')**: Fall back to Step 2 and the standard CTF Triage Ladder.
|
|
116
|
+
|
|
117
|
+
### Step 2: Recon (File & Service Triage)
|
|
118
|
+
|
|
119
|
+
1. **Explore files** -- List the challenge directory, run `file *` on everything
|
|
120
|
+
2. **Triage binaries** -- `strings`, `xxd | head`, `binwalk`, `checksec` on binaries
|
|
121
|
+
3. **Fetch links** -- If the challenge mentions URLs, fetch them FIRST for context
|
|
122
|
+
4. **Connect** -- Try remote services (`nc`) to understand what they expect
|
|
123
|
+
5. **Read hints** -- Challenge descriptions, filenames, and comments often contain clues
|
|
124
|
+
6. **Vulnerability & Exploit Lookup** -- If specific software versions, libraries, or CVEs are discovered, query exploit repositories ([exploit-databases.md](../../references/exploit-databases.md)) using `python .agents/scripts/cve_lookup.py <CVE>` or Sploitus/Searchsploit. Check CTFtime and event intelligence for challenge lineage.
|
|
125
|
+
|
|
126
|
+
### Step 3: Categorize
|
|
127
|
+
|
|
128
|
+
Determine the primary category, then invoke the matching skill.
|
|
129
|
+
|
|
130
|
+
**By file type:**
|
|
131
|
+
- `.pcap`, `.pcapng`, `.evtx`, `.raw`, `.dd`, `.E01` -> forensics
|
|
132
|
+
- `.elf`, `.exe`, `.so`, `.dll`, binary with no extension -> reverse or pwn (check if remote service provided -- if yes, likely pwn)
|
|
133
|
+
- `.py`, `.sage`, `.txt` with numbers -> crypto
|
|
134
|
+
- `.apk`, `.wasm`, `.pyc` -> reverse
|
|
135
|
+
- Web URL or source code with HTML/JS/PHP/templates -> web
|
|
136
|
+
- Images, audio, PDFs with no obvious content -> forensics (steganography)
|
|
137
|
+
|
|
138
|
+
**By challenge description keywords:**
|
|
139
|
+
- "buffer overflow", "ROP", "shellcode", "libc", "heap" -> pwn
|
|
140
|
+
- "RSA", "AES", "cipher", "encrypt", "prime", "modulus", "lattice", "LWE", "GCM" -> crypto
|
|
141
|
+
- "XSS", "SQL", "injection", "cookie", "JWT", "SSRF" -> web
|
|
142
|
+
- "disk image", "memory dump", "packet capture", "registry", "power trace", "side-channel", "spectrogram", "audio tracks", "MKV" -> forensics
|
|
143
|
+
- "find", "locate", "identify", "who", "where" -> osint
|
|
144
|
+
- "obfuscated", "packed", "C2", "malware", "beacon" -> malware
|
|
145
|
+
- "jail", "sandbox", "escape", "encoding", "signal", "game", "Nim", "commitment", "Gray code" -> misc
|
|
146
|
+
|
|
147
|
+
**By service behavior:**
|
|
148
|
+
- Port with interactive prompt, crash on long input -> pwn
|
|
149
|
+
- HTTP service -> web
|
|
150
|
+
- netcat with math/crypto puzzles -> crypto
|
|
151
|
+
- netcat with restricted shell or eval -> misc (jail)
|
|
152
|
+
|
|
153
|
+
### Step 4: Invoke the Category Skill
|
|
154
|
+
|
|
155
|
+
Once you identify the category, **invoke the matching skill** to get specialized techniques:
|
|
156
|
+
|
|
157
|
+
| Category | Invoke | When to Use |
|
|
158
|
+
|----------|--------|-------------|
|
|
159
|
+
| Web | `/ctf-web` | XSS, SQLi, SSTI, SSRF, JWT, file uploads, prototype pollution |
|
|
160
|
+
| Pwn | `/ctf-pwn` | Buffer overflow, format string, heap, ROP, sandbox escape |
|
|
161
|
+
| Crypto | `/ctf-crypto` | RSA, AES, ECC, PRNG, ZKP, classical ciphers |
|
|
162
|
+
| Reverse | `/ctf-reverse` | Binary analysis, game clients, VMs, obfuscated code |
|
|
163
|
+
| Forensics | `/ctf-forensics` | Disk images, memory dumps, event logs, stego, network captures |
|
|
164
|
+
| OSINT | `/ctf-osint` | Social media, geolocation, DNS, public records |
|
|
165
|
+
| Malware | `/ctf-malware` | Obfuscated scripts, C2 traffic, PE/.NET analysis |
|
|
166
|
+
| Misc | `/ctf-misc` | Jails, encodings, RF/SDR, esoteric languages, constraint solving |
|
|
167
|
+
|
|
168
|
+
You can also invoke `/ctf-<category>` to load the full skill instructions with detailed techniques.
|
|
169
|
+
|
|
170
|
+
### Step 5: Pivot When Stuck
|
|
171
|
+
|
|
172
|
+
If your first approach doesn't work:
|
|
173
|
+
|
|
174
|
+
1. **Re-examine assumptions** -- Is this really the category you think? A "web" challenge might need crypto for JWT forgery. A "forensics" PCAP might contain a pwn exploit to replay.
|
|
175
|
+
2. **Try a different category skill** -- Many challenges span multiple categories. Invoke a second skill for the cross-cutting technique.
|
|
176
|
+
3. **Look for what you missed** -- Hidden files, alternate ports, response headers, comments in source, metadata in images.
|
|
177
|
+
4. **Simplify** -- If an exploit is too complex, check if there's a simpler path (default creds, known CVE, logic bug).
|
|
178
|
+
5. **Check edge cases** -- Off-by-one, race conditions, integer overflow, encoding mismatches.
|
|
179
|
+
|
|
180
|
+
**Common multi-category patterns:**
|
|
181
|
+
- Forensics + Crypto: encrypted data in PCAP/disk image, need crypto to decrypt
|
|
182
|
+
- Web + Reverse: WASM or obfuscated JS in web challenge
|
|
183
|
+
- Web + Crypto: JWT forgery, custom MAC/signature schemes
|
|
184
|
+
- Reverse + Pwn: reverse the binary first, then exploit the vulnerability
|
|
185
|
+
- Forensics + OSINT: recover data from dump, then trace it via public sources
|
|
186
|
+
- Misc + Crypto: jail escape requires building crypto primitives under constraints
|
|
187
|
+
- OSINT + Stego: social media posts with unicode homoglyph steganography (Cyrillic lookalikes encode bits)
|
|
188
|
+
- Web + Forensics: paywall bypass (curl reveals content hidden by CSS overlays)
|
|
189
|
+
- Misc + Crypto + Game Theory: multi-phase interactive challenges with AES decryption → HMAC commitment → combinatorial game solving (GF(256) Nim)
|
|
190
|
+
- Crypto + Geometry + Lattice: multi-layer challenges progressing from spatial reconstruction → subspace recovery → LWE solving → AES-GCM decryption
|
|
191
|
+
- Forensics + Signal Processing: power traces / side-channel analysis requiring statistical analysis of measurement data
|
|
192
|
+
- Forensics + Network + Encoding: timing-based encoding in PCAP (inter-packet intervals encode binary data)
|
|
193
|
+
|
|
194
|
+
### Step 6: Post-Exploitation & Completion (Mode-Dependent)
|
|
195
|
+
|
|
196
|
+
#### Branch A: Blitz Mode (`--mode blitz` or `--fast`)
|
|
197
|
+
When running in Blitz mode (active CTF competition):
|
|
198
|
+
1. **Stop-on-Flag (HALT immediately)**: The moment a flag candidate is verified, stop all further tool invocations, scans, or code modifications.
|
|
199
|
+
2. **Display Verified Flag Banner**:
|
|
200
|
+
```bash
|
|
201
|
+
python3 scripts/extract_flags.py "<output>" --banner
|
|
202
|
+
```
|
|
203
|
+
3. **Automated Workspace Cleanup**: Clean temporary scratch files and debris:
|
|
204
|
+
```bash
|
|
205
|
+
python3 scripts/workspace_cleaner.py --fast
|
|
206
|
+
```
|
|
207
|
+
4. **Zero Documentation Overhead**:
|
|
208
|
+
- **STRICTLY DO NOT** call `ctf-writeup`.
|
|
209
|
+
- **DO NOT** create `writeup.md` or any report files.
|
|
210
|
+
- Limit chat response to at most 3 concise lines:
|
|
211
|
+
1. Flag Banner.
|
|
212
|
+
2. Exploit vector in 1 sentence.
|
|
213
|
+
3. Solve script location or CTFd submission status.
|
|
214
|
+
|
|
215
|
+
#### Branch B: Deep Analysis Mode (`--mode deep` or `--deep`)
|
|
216
|
+
When running in Deep Analysis / Lab mode (research, audit, or practice):
|
|
217
|
+
1. **Organize Directory Structure**:
|
|
218
|
+
```bash
|
|
219
|
+
python3 scripts/workspace_cleaner.py --deep
|
|
220
|
+
```
|
|
221
|
+
Ensure the directory strictly contains `writeup.md`, `solve.py`, and `resources/` (with all challenge files, pcaps, and dumps moved inside `resources/`).
|
|
222
|
+
2. **Author Full Writeup**: Invoke `/ctf-writeup` to generate a comprehensive 5-section `writeup.md` including Hint Analysis, Target Architecture & RCA, Step-by-Step Exploitation, and Standalone Exploit Script.
|
|
223
|
+
3. **Verify Reproducibility**: Confirm `solve.py` executes standalone and prints the flag.
|
|
224
|
+
|
|
225
|
+
## Flag Formats
|
|
226
|
+
|
|
227
|
+
Flags vary by CTF. Common formats:
|
|
228
|
+
- `flag{...}`, `FLAG{...}`, `CTF{...}`, `TEAM{...}`
|
|
229
|
+
- Custom prefixes: check the challenge description or CTF rules for the format (e.g., `ENO{...}`, `HTB{...}`, `picoCTF{...}`)
|
|
230
|
+
- Sometimes just a plaintext string with no wrapper
|
|
231
|
+
|
|
232
|
+
**Validation rule (important):**
|
|
233
|
+
- If you find multiple flag-like strings, treat them as candidates and validate before finalizing.
|
|
234
|
+
- Prefer the token tied to the intended artifact/workflow (not random metadata noise or obvious decoys).
|
|
235
|
+
- Do a corpus-wide uniqueness check and include the source file/path when reporting.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Search for common flag patterns in files
|
|
239
|
+
grep -rniE '(flag|ctf|eno|htb|pico)\{' .
|
|
240
|
+
# Search in binary/memory output
|
|
241
|
+
strings output.bin | grep -iE '\{.*\}'
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Quick Reference
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Recon
|
|
248
|
+
file * # Identify file types
|
|
249
|
+
strings binary | grep -i flag # Quick string search
|
|
250
|
+
xxd binary | head -20 # Hex dump header
|
|
251
|
+
binwalk -e firmware.bin # Extract embedded files
|
|
252
|
+
checksec --file=binary # Check binary protections
|
|
253
|
+
|
|
254
|
+
# Connect
|
|
255
|
+
nc host port # Connect to challenge
|
|
256
|
+
echo -e "answer1\nanswer2" | nc host port # Scripted input
|
|
257
|
+
curl -v http://host:port/ # HTTP recon
|
|
258
|
+
|
|
259
|
+
# Python exploit template
|
|
260
|
+
python3 -c "
|
|
261
|
+
from pwn import *
|
|
262
|
+
r = remote('host', port)
|
|
263
|
+
r.interactive()
|
|
264
|
+
"
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Challenge
|
|
268
|
+
|
|
269
|
+
$ARGUMENTS
|
package/skills.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/google/antigravity/main/schemas/skills.json",
|
|
3
|
+
"skills": [
|
|
4
|
+
"./skills/solve-challenge",
|
|
5
|
+
"./skills/ctf-web",
|
|
6
|
+
"./skills/ctf-pwn",
|
|
7
|
+
"./skills/ctf-crypto",
|
|
8
|
+
"./skills/ctf-reverse",
|
|
9
|
+
"./skills/ctf-forensics",
|
|
10
|
+
"./skills/ctf-ai-ml",
|
|
11
|
+
"./skills/ctf-malware",
|
|
12
|
+
"./skills/ctf-osint",
|
|
13
|
+
"./skills/ctf-misc",
|
|
14
|
+
"./skills/ctf-writeup"
|
|
15
|
+
]
|
|
16
|
+
}
|