1---2name: riegan-ctf-web3description: "Use when a challenge is a web application: a URL or host:port to attack, a login form, an admin bot, a source zip or Dockerfile for a website; when the user mentions SQLi, XSS, SSTI, LFI/RFI, XXE, SSRF, deserialization, JWT or session tokens, IDOR, CSRF, GraphQL, file upload, cookie stealing, CORS or CSP, request smuggling; or when a flag should be extracted from a website, and for white-box source review of challenge web apps."4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/riegan-ctf-web6---78# CTF web — map the app, pick the bug class, deliver910Workspace layout, remote gate, flag logging: sibling skill `ctf`. **All live testing11against remote targets is gated by the router's rules** — mirror locally whenever the12challenge ships source (`php -S 127.0.0.1:8000`, `python3 -m http.server 8000`,13`scripts/ctf python app.py`, or `podman` for provided Dockerfiles/images; details in14`references/tooling.md`). Craft and verify payloads on the mirror, replay the final15exploit remotely once approved.1617## Triage — map the app (first 10 minutes)18191. Record in `notes.md`: entry URL, ports, stack guess, auth model, whether an admin20 bot exists, whether source was provided.212. Answer the map questions:2223| Question | How |24|---|---|25| Stack / language? | headers (`Server`, `X-Powered-By`), cookie names (`PHPSESSID`/`JSESSIONID`/`laravel_session`/`connect.sid`), 404 page — `references/recon.md` |26| Routes? | robots/sitemap, JS bundles, wayback, ffuf — `references/recon.md` |27| Hidden params? | `scripts/ctf arjun -u URL -m GET` |28| Session mechanism? | cookie flags, JWT? → `scripts/jwt-inspect.py "$TOKEN"` |29| Admin bot? | client-side challenge: `references/client.md` (exfil section first) |30| Source available? | switch to Playbook → source-audit flow |31323. Low-hanging fruit sweep (minutes, wins events):3334| Check | Payoff |35|---|---|36| `/.git/HEAD`, `.env`, `backup.zip`, `.bak`/`~`/`.swp` files | full source / secrets |37| `/robots.txt`, `/sitemap.xml`, wayback CDX | hidden endpoints |38| `/swagger`, `/openapi.json`, `/graphql` introspection | complete API surface |39| `/server-status`, `/actuator/env`, `/phpmyadmin`, `/adminer.php` | config or DB leak |40| default creds (`admin:admin` ...) | instant login — `references/auth.md` |41| JWT in any header/cookie | none / weak secret / confusion — `references/auth.md` |42| `package.json`, `.js.map` source maps | hidden routes, versions |4344One command runs probes + fuzzing: `skills/ctf-web/scripts/dirquick.sh -e .php,.bak -v http://target:port`45(remote gate applies; run it against local mirrors freely).46474. If the flag format appears in any response, log it per the router, keep going for48 the intended path anyway (organizers often plant decoys).4950## Playbook5152### Flow A — source-audit (source zip / Dockerfile given)53541. Identify language + framework from deps (`package.json`, `composer.json`,55 `requirements.txt`, `pom.xml`, `go.mod`). Find the router/controllers: every56 endpoint with its params, and every middleware (auth, body parsing).572. Grep the sinks, then trace each hit back to user input:5859| Language | Grep sink list |60|---|---|61| PHP | `unserialize\(`, `include`, `require`, `eval\(`, `assert\(`, `system\(`, `shell_exec\(`, `passthru\(`, `exec\(`, `popen\(`, `proc_open`, `preg_replace` with `/e`, backticks, `move_uploaded_file\(`, `simplexml_load_string\(`, `DOMDocument->load`, `curl_exec\(`, `md5\(`+`==`, `extract\(`, `header('Location` |62| Python | `pickle`, `yaml.load`, `eval\(`, `exec\(`, `os.system`, `subprocess`, `render_template_string`, `requests.get(` with user URL, f-string/format SQL, `jinja2.Environment` |63| Node | `child_process`, `exec`, `execSync`, `spawn`, `eval\(`, `new Function`, `serialize`, deep `merge`/`extend`/`_.set` (proto pollution), `res.redirect(`, `jwt.verify`, `Object.assign` |64| Java | `readObject`, `ObjectInputStream`, `Runtime.getRuntime`, `ProcessBuilder`, `SpelExpressionParser`, `Velocity`, `Statement`/`executeQuery` with concat, `<%=`, JSP EL `${}`, `XMLDecoder` |65| Any | SQL built by concatenation/`${}`; `==` vs `===`; `jwt.decode` (not verify); `Crypto` with `aes-128-ecb`; `random` for tokens |66673. Match sink to bug class table (below), build the payload against a local mirror,68 then fire at the remote target (gated).694. No obvious sink? Audit business logic: register/login flows, IDOR on every70 object reference, race-prone endpoints (balance/coupon/vote), mass assignment.7172### Flow B — blackbox (no source)73741. Recon sweep (`references/recon.md`): fingerprint, exposed files, dirs, vhosts,75 param mining, wayback.762. Injection probes on every input point, one class at a time — error/boolean/time77 triage in `references/injection.md`.783. Auth surface: default creds, JWT/session weaknesses, OAuth flow, IDOR/mass79 assignment — `references/auth.md`.804. File/URL surfaces: uploads, `?file=` params, importers (SSRF) — `references/deser-files.md`.815. Admin bot / browser-only behavior: `references/client.md`.826. Escalate breadth (deeper wordlists, more params) and depth (chain two bugs:83 LFI+log poison, open redirect+OAuth, XSS+CSRF) before concluding.8485### Bug class index8687| Bug class | Preconditions | Reference |88|---|---|---|89| SQLi (manual + sqlmap), NoSQL, command injection, SSTI, XSLT, LDAP | any user input reaching a query/parser/shell/template | `references/injection.md` |90| JWT/session/OAuth/IDOR/mass assignment/race/CSRF/default creds | any auth or object reference | `references/auth.md` |91| Deserialization (PHP/Python/Java/Ruby/YAML/Node), LFI/RFI, php://filter chain, log poisoning, upload bypasses, XXE, SSRF | user data unserialized / included / fetched | `references/deser-files.md` |92| XSS + admin bot, CSP bypass, prototype pollution, postMessage, CORS, smuggling, cache poisoning, open redirect | client-side render or bot | `references/client.md` |93| Recon: fingerprint, ffuf, exposed source, vhosts, wayback, param mining | always first (Flow B) | `references/recon.md` |94| Proxies (mitmproxy/Burp), browsers, websockets, listeners, local mirrors | tooling for all of the above | `references/tooling.md` |9596## References9798- `references/recon.md` — manual Wappalyzer-style fingerprinting, quick exposed-file99 probes, git-dumper, source maps, Swagger/GraphQL introspection, ffuf patterns100 (extensions/recursion/multi-wordlist/vhost), wayback CDX, arjun.101- `references/injection.md` — SQLi triage + UNION method + sqlmap, NoSQL `$ne`/`$regex`/102 `$where`, command injection channels, SSTI engine decision tree + per-engine RCE103 payloads, SpEL/OGNL/EL, XSLT, LDAP.104- `references/auth.md` — JWT attack table (none/crack/RS→HS confusion/kid/jku/x5u),105 session bugs, OAuth flows, IDOR methodology, mass assignment, races, CSRF,106 default creds, register/login logic flaws.107- `references/deser-files.md` — PHP/Python/Java/Ruby/YAML/Node deserialization,108 phar, LFI path list + wrappers, php://filter chain RCE, log/session poisoning,109 upload bypass table, XXE, SSRF (ports, cloud metadata, gopher, rebinding), SVG XSS.110- `references/client.md` — XSS contexts + exfil listeners (HTTP/WebSocket, HttpOnly111 workaround), CSP bypass table, prototype pollution (client + Node RCE gadget),112 postMessage, CORS, request smuggling basics, cache poisoning, open redirect.113- `references/tooling.md` — mitmproxy scripting, Burp install, sqlmap via proxy,114 ffuf modes, websocat, interactsh, local mirrors, workspace hygiene.115116## Scripts in this skill117118| Script | Purpose |119|---|---|120| `scripts/dirquick.sh` | one-shot recon: header dump, exposed-file probes, ffuf content (+ optional vhost); falls back to a bundled wordlist without seclists |121| `scripts/jwt-inspect.py` | JWT decode + suspicious-flag triage + optional HMAC wordlist crack (stdlib only) |122123## Toolbox124125| Tool | Install | Purpose |126|---|---|---|127| `ffuf` | `paru -S ffuf` (AUR) or https://github.com/ffuf/ffuf/releases | content/vhost/param fuzzing |128| `seclists` | `paru -S seclists` (AUR; → `/usr/share/seclists`) or clone github.com/danielmiessler/SecLists | wordlists |129| `sqlmap` | `sudo pacman -S sqlmap` | automated SQL injection |130| `mitmproxy` | `sudo pacman -S mitmproxy` | scriptable intercepting proxy |131| Burp Suite | `paru -S burpsuite` (AUR) or upstream community jar | manual proxy, Repeater/Intruder, races |132| `websocat` | `sudo pacman -S websocat` | websocket client + listener |133| `httpie` | `sudo pacman -S httpie` | ergonomic HTTP client |134| `hashcat` | `sudo pacman -S hashcat` | `-m 16500` JWT secret cracking |135| `php` | `sudo pacman -S php` | local mirrors, phar/phpggc payload crafting |136| `git-dumper` | `uv tool install git-dumper` | recover exposed `.git/` |137| `arjun` | `uv pip install --python .venv/bin/python arjun` | hidden parameter discovery |138| `jwt_tool` | clone github.com/ticarpi/jwt_tool + `uv pip install --python .venv/bin/python pycryptodomex` | JWT forgery/attack suite |139| `tplmap` | clone github.com/epinna/tplmap | SSTI detection + auto-RCE |140| `ysoserial` | clone github.com/frohoff/ysoserial + `mvn package` | Java deserialization payloads |141| `phpggc` | clone github.com/ambionics/phpggc | PHP gadget chains (Laravel...) |142| `php_filter_chain_generator` | clone github.com/synacktiv/php_filter_chain_generator | php://filter → RCE chain |143| `Gopherus` | clone github.com/tarunkant/Gopherus | gopher:// SSRF payloads |144| `interactsh-client` | `go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest` | out-of-band callback host |145| browser tool | built into this agent (skill `agent-browser`) | interactive apps, login flows, bot debugging |146147Report files to the user with the flag; log to `work/<event>/flags.md` per the router.