CTF router — event workflow, triage, dispatch, flags
Operates at /home/riegan/Projects/ctf (this repo). Mixed-team level: every path has a
beginner-safe triage step; category skills carry the expert playbooks.
Operating rules (always in force)
- Remote gate: never connect to a remote challenge service, scoreboard, or another
team's box without explicit user go-ahead in the current session. The user may
pre-authorize an event ("remote OK for ") — then remote work for that event's
hosts is allowed, everything else still gated. Local analysis is always allowed.
- Untrusted artifacts: challenge files are hostile. Analyze statically first;
execute only under
podman isolation or with user approval. Never sudo a challenge
file, never run its installers on the host, never open challenge documents in
desktop apps — use scripts/ and parsers here.
- Install policy: Python libs →
scripts/setup.sh venv or
uv pip install --python .venv/bin/python <pkg>. System tools → sudo pacman -S
(document first, ask before running sudo). Single binaries → cargo install /
go install / uv tool install / upstream tarball into ~/.local/bin.
- Workspace discipline: one dir per challenge;
notes.md records hypothesis →
evidence → next step, including failed approaches. Never scatter files.
- Flag discipline: every flag found is logged to
work/<event>/flags.md with
challenge name + timestamp before anything else happens.
Workflow
1. setup scripts/setup.sh (once per machine) — .venv with pwntools etc.
2. workspace mkdir -p work/<event>/<category>-<name>/{dist,solve} && cd there
cp challenge files into dist/ ; create notes.md (goal, remote info,
points, solves count, description verbatim)
3. triage universal first pass (below) → dispatch table → read category skill
4. solve loop: hypothesis → test → record in notes.md ; escalate depth via
the category skill's references/
5. flag validate format → grep for submission mistakes → log to flags.md
6. submit user gate → references/submission.md (CTFd/rCTF)
7. writeup references/writeup.md template into challenge dir
Universal triage (first 5 minutes, any category)
file dist/* # real type, arch, stripped, embedded
binwalk dist/<file> # after install; embedded blobs/squashfs
strings -n 8 dist/<file> | grep -aiE 'flag|ctf\{|key|passw|http' | head
exiftool dist/<file> # after install; metadata leaks
ls -la; sha256sum dist/* # inventory + hashes (compare vs teammates)
Then category-specific dispatch:
| Signal in triage |
Skill to read |
ELF binary + remote nc host port |
ctf-pwn |
| Binary/bytecode, no remote, "find the input/key" |
ctf-rev |
.py doing math, RSA params, ciphertext, n e c |
ctf-crypto |
| URL, web app, login form, source zip |
ctf-web |
| pcap, disk/memory image, image/audio, "recover/investigate" |
ctf-forensics |
| Text puzzle, sandbox/pyjail, esoteric language, OSINT |
ctf-misc |
RPC URL, .sol, bytecode 0x..., wallet private key |
ctf-blockchain |
.apk, .ipa, mobile emulator mention |
ctf-mobile |
| Own service to defend, tick-based scoring, flags rotate |
ctf-attack-defense |
| VM/IP range to root, HTB/THM box, scoreboard = root flags |
ctf-boot2root |
| Unclear |
run full triage on every file; ctf-forensics generics first |
Flag hunting
Search targets after each successful exploitation step — flags hide in cwd, /, env,
process memory, database dumps, HTTP responses, JWT claims, file metadata.
# generic: works on binaries, dumps, memory, strings of anything
grep -aohE '(flag|FLAG|ctf|CTF|picoCTF|HTB)\{[^}]{4,}\}' <target> | sort -u
grep -aohE '[a-zA-Z0-9_]{2,16}\{[^}]{4,}\}' <target> | sort -u # any XXX{...} wrapper
grep -arE 'flag' /proc/<pid>/environ 2>/dev/null; cat /flag* /home/*/flag* 2>/dev/null
find / -name '*flag*' -not -path '/proc/*' -not -path '/sys/*' 2>/dev/null
Event organizers publish the format in rules — record it in notes.md first.
Last resorts: 32-hex (grep -aohE '\b[0-9a-f]{32}\b'), base64 blobs that decode to
readable text, XOR-with-repeated-key of flag{ prefix.
work/<event>/flags.md format:
| time | challenge | flag | notes |
|---|---|---|---|
| 14:32 | pwn-ret2win | flag{n0_r3turn_n0_gl0ry} | ret2win, offset 44 |
Toolbox (router level)
| Tool |
Install |
Purpose |
.venv |
scripts/setup.sh |
pwntools, pycryptodome, gmpy2, sympy, requests... |
scripts/ctf |
included |
run any command with .venv on PATH |
file, strings, xxd, openssl, 7z, nmap, gdb |
preinstalled |
triage, hex, crypto, archives, scans, debugging |
podman |
preinstalled |
isolation for untrusted binaries |
| binwalk / exiftool |
sudo pacman -S binwalk perl-image-exiftool |
embedded blobs, metadata |
Deeper references in this skill
references/submission.md — CTFd and rCTF flag submission via curl, session handling.
references/writeup.md — writeup template + event summary report.
1---2name: riegan-ctf3description: "Use when the user mentions CTF, capture the flag, a challenge, jeopardy, attack-defense, king of the hill, boot2root, HackTheBox/picoCTF/CTFtime, asks to find/submit a flag, triage challenge files (binary, pcap, image, disk dump, APK, contracts), or wants CTF methodology or writeups. This is the router: sets up the workspace, triages, and dispatches to ctf-pwn, ctf-rev, ctf-crypto, ctf-web, ctf-forensics, ctf-misc, ctf-blockchain, ctf-mobile, ctf-attack-defense, ctf-boot2root."4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/riegan-ctf6---78# CTF router — event workflow, triage, dispatch, flags910Operates at `/home/riegan/Projects/ctf` (this repo). Mixed-team level: every path has a11beginner-safe triage step; category skills carry the expert playbooks.1213## Operating rules (always in force)14151. **Remote gate**: never connect to a remote challenge service, scoreboard, or another16 team's box without explicit user go-ahead in the current session. The user may17 pre-authorize an event ("remote OK for <event>") — then remote work for that event's18 hosts is allowed, everything else still gated. Local analysis is always allowed.192. **Untrusted artifacts**: challenge files are hostile. Analyze statically first;20 execute only under `podman` isolation or with user approval. Never `sudo` a challenge21 file, never run its installers on the host, never open challenge documents in22 desktop apps — use `scripts/` and parsers here.233. **Install policy**: Python libs → `scripts/setup.sh` venv or24 `uv pip install --python .venv/bin/python <pkg>`. System tools → `sudo pacman -S`25 (document first, ask before running sudo). Single binaries → `cargo install` /26 `go install` / `uv tool install` / upstream tarball into `~/.local/bin`.274. **Workspace discipline**: one dir per challenge; `notes.md` records hypothesis →28 evidence → next step, including failed approaches. Never scatter files.295. **Flag discipline**: every flag found is logged to `work/<event>/flags.md` with30 challenge name + timestamp before anything else happens.3132## Workflow3334```351. setup scripts/setup.sh (once per machine) — .venv with pwntools etc.362. workspace mkdir -p work/<event>/<category>-<name>/{dist,solve} && cd there37 cp challenge files into dist/ ; create notes.md (goal, remote info,38 points, solves count, description verbatim)393. triage universal first pass (below) → dispatch table → read category skill404. solve loop: hypothesis → test → record in notes.md ; escalate depth via41 the category skill's references/425. flag validate format → grep for submission mistakes → log to flags.md436. submit user gate → references/submission.md (CTFd/rCTF)447. writeup references/writeup.md template into challenge dir45```4647## Universal triage (first 5 minutes, any category)4849```bash50file dist/* # real type, arch, stripped, embedded51binwalk dist/<file> # after install; embedded blobs/squashfs52strings -n 8 dist/<file> | grep -aiE 'flag|ctf\{|key|passw|http' | head53exiftool dist/<file> # after install; metadata leaks54ls -la; sha256sum dist/* # inventory + hashes (compare vs teammates)55```5657Then category-specific dispatch:5859| Signal in triage | Skill to read |60|---|---|61| ELF binary + remote `nc host port` | `ctf-pwn` |62| Binary/bytecode, no remote, "find the input/key" | `ctf-rev` |63| `.py` doing math, RSA params, ciphertext, `n e c` | `ctf-crypto` |64| URL, web app, login form, source zip | `ctf-web` |65| pcap, disk/memory image, image/audio, "recover/investigate" | `ctf-forensics` |66| Text puzzle, sandbox/pyjail, esoteric language, OSINT | `ctf-misc` |67| RPC URL, `.sol`, bytecode `0x...`, wallet private key | `ctf-blockchain` |68| `.apk`, `.ipa`, mobile emulator mention | `ctf-mobile` |69| Own service to defend, tick-based scoring, flags rotate | `ctf-attack-defense` |70| VM/IP range to root, HTB/THM box, scoreboard = root flags | `ctf-boot2root` |71| Unclear | run full triage on every file; `ctf-forensics` generics first |7273## Flag hunting7475Search targets after each successful exploitation step — flags hide in cwd, `/`, env,76process memory, database dumps, HTTP responses, JWT claims, file metadata.7778```bash79# generic: works on binaries, dumps, memory, strings of anything80grep -aohE '(flag|FLAG|ctf|CTF|picoCTF|HTB)\{[^}]{4,}\}' <target> | sort -u81grep -aohE '[a-zA-Z0-9_]{2,16}\{[^}]{4,}\}' <target> | sort -u # any XXX{...} wrapper82grep -arE 'flag' /proc/<pid>/environ 2>/dev/null; cat /flag* /home/*/flag* 2>/dev/null83find / -name '*flag*' -not -path '/proc/*' -not -path '/sys/*' 2>/dev/null84```8586Event organizers publish the format in rules — record it in `notes.md` first.87Last resorts: 32-hex (`grep -aohE '\b[0-9a-f]{32}\b'`), base64 blobs that decode to88readable text, XOR-with-repeated-key of `flag{` prefix.8990`work/<event>/flags.md` format:9192```markdown93| time | challenge | flag | notes |94|---|---|---|---|95| 14:32 | pwn-ret2win | flag{n0_r3turn_n0_gl0ry} | ret2win, offset 44 |96```9798## Toolbox (router level)99100| Tool | Install | Purpose |101|---|---|---|102| `.venv` | `scripts/setup.sh` | pwntools, pycryptodome, gmpy2, sympy, requests... |103| `scripts/ctf` | included | run any command with `.venv` on PATH |104| `file`, `strings`, `xxd`, `openssl`, `7z`, `nmap`, `gdb` | preinstalled | triage, hex, crypto, archives, scans, debugging |105| `podman` | preinstalled | isolation for untrusted binaries |106| binwalk / exiftool | `sudo pacman -S binwalk perl-image-exiftool` | embedded blobs, metadata |107108## Deeper references in this skill109110- `references/submission.md` — CTFd and rCTF flag submission via curl, session handling.111- `references/writeup.md` — writeup template + event summary report.