Skip to content

Test for cache poisoning & deception

Terminal window
cache-detective scan --url https://staging.example.com/ --aggressive

This enables the four checks documented in Cache poisoning & deception: unkeyed header injection, cache deception, error-response caching, and response splitting via cache-key manipulation. Every other check (cacheability, live cache state, CDN fingerprinting, cache key & Vary, response consistency) runs regardless of --aggressive.

Each aggressive check issues extra requests to the live target. --max-aggressive-requests (default 10) is a hard cap per resource, applied even with --aggressive set:

Terminal window
cache-detective scan --url https://staging.example.com/ --aggressive --max-aggressive-requests 4

Testing an authenticated endpoint for cache deception

Section titled “Testing an authenticated endpoint for cache deception”

Cache deception is most dangerous on endpoints that serve per-user content. Pass credentials so the probe hits the endpoint the way a logged-in user would:

Terminal window
cache-detective scan --url https://staging.example.com/account --aggressive \
--bearer "$TOKEN"

If the response is served identically (and cacheably) under a path-confused URL like /account.js or /account/nonexistent.css, you’ll see a Cache deception via path confusion finding (high severity, CWE-524). Combined with credentials, also check for Authenticated response marked cacheable (see Cacheability analysis) — that check runs by default, without --aggressive, since it’s a passive analysis of the response your own request received.

Terminal window
cache-detective scan --url https://staging.example.com/poison --aggressive --show-all-findings

An Unkeyed header injection via X-Forwarded-Host finding means: a marker value sent in that header was reflected into the response, and a completely plain follow-up request received the same poisoned response back. That’s proof the header isn’t part of the cache key at your CDN/reverse-proxy layer — any attacker who can reach the endpoint can plant arbitrary content for other visitors until the cache entry expires or is purged.

See the GitHub Actions guide for gating a build on a specific aggressive-mode finding.