In-depth references
The following reference materialsLoad on demand, select the corresponding file based on the challenge type identified in Phase 2:
- Server-side injection (SQLi/SSTI/LFI/XXE/SSRF) → references/server-side.md
- Server-side execution (command injection/RCE/file upload/CRLF) → references/server-side-exec.md
- Advanced server-side (Race Condition/HTTP smuggling/cache poisoning) → references/server-side-advanced.md
- Deserialization (PHP/Java/Python/Node/.NET) → references/server-side-deser.md
- Authentication and access (passwords/MFA/OAuth/IDOR/logic flaws) → references/auth-and-access.md
- JWT attacks (none/weak key/JWK injection/algorithm confusion) → references/auth-jwt.md
- Authentication infrastructure (LDAP/Kerberos/SAML/certificates) → references/auth-infra.md
- Client-side (XSS/CSP bypass/DOM/CSS injection) → references/client-side.md
- Advanced client-side (Unicode folding XSS/CSS font exfiltration/CSP nonce bypass/postMessage) → references/client-side-advanced.md
- Node.js and prototype chain pollution → references/node-and-prototype.md
- CVE exploit collection (Log4Shell/Gitea/Grafana etc.) → references/cves.md
- Web3/blockchain (Solidity/reentrancy/flash loan) → references/web3.md
- Server-side injection 2 (XXE in depth/GraphQL exploitation/variable injection) → references/server-side-2.md
- Server-side execution 2 (OPcache webshell/disable_functions bypass/LD_PRELOAD) → references/server-side-exec-2.md
- Advanced server-side 2 (SSRF→Docker/Rogue MySQL/URL parsing discrepancies/LaTeX RCE) → references/server-side-advanced-2.md
- SQLi in depth (second-order injection/Shift-JIS encoding/PCRE backtracking to bypass WAF/QR code injection) → references/sql-injection.md
- Web practical notes (common pitfalls/debugging techniques/quick judgment) → references/field-notes.md
- HTTP response analysis techniques → references/response-analysis.md
- Flag extraction methodology → references/flag-extraction.md
CTF Web challenges and real penetration testing are fundamentally different: the objective is clear (get the flag), the vulnerability is intentionally placed, and there is usually only one entry point. This methodology helps you quickly identify the challenge type and choose the shortest path.
Core mental model
The essence of CTF is puzzle solving. The author intentionally left an attack path, and your task is to find it.
Key principles:
- Breadth before depth — spend 2-3 rounds quickly surveying the whole picture, then go deep into specific vulnerabilities
- Clue-driven — the result of each step tells you what to do next
- 3-round rule — if a method has been tried for 3 rounds with no substantial progress, switch direction
- Don't guess blindly — if brute force is needed, it means you may have gone in the wrong direction (CTF usually has a clever solution)
Phase 1: Rapid reconnaissance (1-3 rounds)
Execute by priority (not all of it; if you find something, stop and analyze):
-
Visit the homepage —
http_requestGET the homepage and observe:- What kind of application is it? (login page/blog/shop/API)
- What functions does it have? (search/upload/register/comment)
- Are there any hints at the bottom of the page/in comments?
-
View the source code — check the HTML source code (not the rendered page):
- HTML comments
<!-- hint: ... --> - Hidden form fields
<input type="hidden"> - API paths and variables in JavaScript
- Referenced JS/CSS file paths
- HTML comments
-
Path probing — Check common paths:
/robots.txt— Often hides sensitive paths with forbidden access/flag,/flag.txt,/flag.php/.git/,/.svn/— Source code disclosure/backup.sql,/www.zip,/源码.tar.gz/admin,/login,/api
-
Fingerprinting —
httpx -tech-detectorcurl -sIIdentify the tech stack
Phase 2: Challenge Type Identification and Strategy Selection
Based on reconnaissance results, quickly categorize:
| What you see | What it might be | Next step |
|---|---|---|
| Search box/query parameters | SQL injection | Read sql-injection-methodology |
| Login page | Weak passwords/SQL injection/JWT | First follow the CSRF-safe login flow, then try SQLi |
| File upload functionality | File upload vulnerability | Read file-upload-methodology |
| Template rendering/user input echo | SSTI/XSS | Try {{7*7}} and ${7*7} |
| File path parameter in URL | LFI/directory traversal | Try ../../etc/passwd |
| Deserialized data (base64 cookie) | Deserialization RCE | Read deserialization-methodology |
| API endpoint + JSON | IDOR/authorization bypass | Read idor-methodology |
| JWT token(eyJ...) | JWT attack | Read jwt-attack-methodology |
| Source code visible (.git disclosure, etc.) | Source code audit | Read ctf-source-audit |
| ping/curl functionality | Command injection | Read command-injection-methodology |
| XML input/SOAP | XXE | Read xxe-injection-methodology |
| URL/file path parameter | SSRF | Read ssrf-methodology |
Phase 2.5: CSRF-Safe Login Flow (Critical!)
Many web applications (DVWA, WordPress, etc.) have login forms with CSRF tokens (user_token、csrf_token、_token and other hidden fields).If you do not first GET to obtain the token and then POST within the same session, login will fail even if the password is correct.
Correct flow (http_request automatically manages cookies)
Example
1. GET /login.php ← 获取页面,自动保存 session cookie
2. 从响应 HTML 提取 user_token 值
3. POST /login.php ← 自动携带同一 session cookie
body: username=admin&password=password&Login=Login&user_token=<提取的值>
4. 验证:响应不再是登录页面(body 大小变化、出现 Welcome/Dashboard)
Common pitfalls
- New session for each request — If GET and POST are not in the same session, token validation will inevitably fail (the server-side token is bound to the session)
- Token name is not fixed — It may be
user_token、csrf_token、_token、csrfmiddlewaretoken - Token is in a meta tag —
<meta name="csrf-token" content="...">, not necessarily in the form - Configuration needs to be changed after login(such as DVWA security level) — You must continue operating in the same session, otherwise the change will be lost
Determine whether login succeeded
- Response body size changes significantly (e.g., 1523→7274 bytes)
- Appearance of keywords such as
Welcome、Dashboard、Logoutand other keywords - No longer appears
Loginform
Phase 3: Exploitation
- SQL injection:UNION SELECT preferred, EXTRACTVALUE as fallback
- Command injection:Directly cat /flag.txt, don't bother with a reverse shell
- When continuous interaction is needed (reverse shell/SSH/database), use the
interactive_sessiontool instead of bash+nc - LFI:read /flag.txt directly, don't read /etc/passwd first
- fake flag —
flag{test}is not the real flag;multi-layer vulnerability — use LFI to get the source code, then dig for a second hole - WAF bypass — case/double-write/comment
/*!select*/;encoding — URL/double/Unicode
Phase 4: Strategy switching
- Tried 5 variants of the same payload without success → change direction
- SQL injection confirmed but cannot read files → the flag is in the database
- Feels like "almost there" but it doesn't work → the most dangerous signal, step back and re-examine
Vulnerability type determination
- Observe functionality: a display feature is not SQL injection (it's not a query), it may be SSTI/XSS
Efficiency trap
- When the complete data has no length limit, segmented extraction is not needed
- Segmented concatenation is error-prone, and manual concatenation carries risk