Cache Deception Armor · Cloudflare Cache (CDN) docs
This is Cloudflare's documentation for Cache Deception Armor, a cache rule that stops attackers from tricking the CDN into caching a logged-in user's personal page under a fake static-file URL. It checks that a file's extension matches its returned Content-Type and skips caching when they don't line up.
- The attack works when an origin serves the same dynamic page for a fake path like /newsfeed/foo.jpg, so Cloudflare caches the user's personalized response by default.
- Cache Deception Armor keeps caching for real static assets but refuses to cache any response where the extension and Content-Type mismatch.
- Responses typed application/octet-stream are exempt, and harmless mismatches like .jpg served as image/webp are allowed.
An attacker can trick a logged-in user into loading a URL that looks like a static file, such as /newsfeed/foo.jpg, but actually returns that user's personalized page. The trick works when the origin server ignores the extra path segment and serves the parent page anyway. Because the URL ends in .jpg, Cloudflare's default caching treats it as a static asset and stores the response. The attacker then requests the same URL and gets the cached copy of the victim's private content. Nothing is hacked in the usual sense; the cache is just doing what it was told to do.
Cloudflare's defense is a cache rule called Cache Deception Armor. You keep caching real static assets, but the rule checks that the file extension matches the Content-Type the origin actually returns. If /newsfeed is served as text/html but the URL claims to be a .jpg, that mismatch is the warning sign, and Cloudflare declines to cache the response. Two exceptions keep the rule from breaking normal traffic: responses marked application/octet-stream are exempt, since that type tells browsers to download rather than render, and a few harmless mismatches like .jpg served as image/webp or .gif as video/webm are allowed through.
The practical takeaway is that the fix lives in two places. Turning on Cache Deception Armor closes the gap at the CDN layer without code changes. But the root cause is an origin that answers requests for nonexistent paths with real content, so tightening routing on the origin side is worth doing too. Anyone running authenticated pages behind a CDN should check whether their app does this.