
- by x32x01 ||


A userās private feed normally lives at
https://site.com/newsfeed
.But if someone induces the user to visit
https://site.com/newsfeed/foo.jpg
, the cache sees the [.jpg] and caches the response. Then, an attacker can fetch that cached URL and see the userās private feed.
How Attackers Exploit It
1. Flexible routing: Many frameworks treat /newsfeed/foo.jpg
the same as /newsfeed
.2. Extension tricks caching: The [.jpg] convinces the cache to store it-even if itās dynamic.
3. Takeover: The attacker can then access the cached content and see or leak sensitive data.
Real-World Example
Cloudflareās own blog uses this scenario:The site dynamically serves /newsfeed behind the scenes.
Requesting
/newsfeed/foo.jpg
returns the same content-but with a [.jpg] suffix.Cloudflare sees [.jpg] and caches it. The attacker later retrieves it.
š Bypass & Detection
Bypass: Attackers craft a URL like/private/data.jpg
that routes to sensitive content. Once cached, everyone can access it.Detecting: Watch for suspicious URLs ending in image/script extensions ([.jpg], [.css], [.js]) that return user-specific pages, and check cache headers like Age:, or missing Cache-Control: no-store.
š” How to Defend
1. Strict routing
Ensure your application does not treat /path/foo.extension the same as /path-reject or 404 unpredictable suffixes. Adding route anchors prevents this.2. Correct headers
For dynamic content, always send:Cache-Control: private, no-store, no-cache
So caches and browsers won't store it.
3. Server/Proxy rules
Implement rules at CDN or proxy (e.g., Cloudflareās Cache Deception Armor) to verify that file extensions match their content typesāpreventing this type of deception.4. Be cautious with "Cache Everything"
Features like Cloudflareās āCache Everythingā may override safeguards. Use them only when youāre certain content is static and safe to cache.5. Vary and Cache Key Control
Ensure headers like User-Agent, cookies, and others are properly managedāeither blocked or explicitly included in the cache key (via Vary
Summary Table
Step What Happens Defense1
/newsfeed/foo.jpg
returns private content Reject invalid suffixes2 Cache sees [.jpg] and caches it Add Cache-Control: private/no-store
3 Attacker fetches it Use proxy safeguards, match extensions & types

Itās a sneaky attack that tricks CDNs or proxies into caching private content by adding fake ā[.jpg]ā or ā[.css]ā endings.

An attacker could force your private data into public cache-just by tricking a user into clicking a deceptive link.
š How to prevent it:
⢠Use strict routing-no flexible suffixes
⢠Add Cache-Control: private, no-store on dynamic pages
⢠Activate CDN defenses like Cloudflareās Cache Deception Armor
⢠Donāt use āCache Everythingā without caution
Stay safe, configure wisely!
