← All tracks
Web InfrastructureCache Deception6 labsAdvanced4h practice

Cache Deception

A private page saved under a public name.

“The account page was never public, but the CDN stored it at /account/profile.css and served it to anyone who asked.”

RFC 9111: HTTP CachingRFC 3986: Uniform Resource Identifier syntax and normalizationOWASP Web Security Testing Guide: Web Cache DeceptionOWASP ASVS v4.0.3, chapter 14: configuration and cache controlsCDN vendor documentation for cache keys, origin headers and path normalization
The mental model
A cache is a second authorization boundary. The origin decides who may see a response; the cache decides which URL key that response belongs to. If the two disagree about what is private, a private response can be stored under a public key.

CDNs commonly cache responses by file extension or path pattern while the origin routes by path prefix. Appending a static-looking suffix such as .css, ;.css or an encoded slash makes the CDN treat a personalized page as a static asset. The origin still renders the victim's data, and the cache stores it under an attacker-known key. The attacker then requests that key without a session and receives the private body.

The victim only opens a link on the trusted site. The attacker never touches the session; the cache does the disclosure after the victim has already left.

Threat model

What is actually at stake?

Before touching a payload, map the assets, the actors and the boundary that is supposed to protect them. A finding only becomes a vulnerability when you can connect the failed boundary to a real asset.

Assets

  • Personal account data such as email, balance, support notes or API tokens
  • Administrator or support pages rendered for a privileged session
  • One-time links, password reset pages and invitation acceptance pages
  • Any response whose body depends on a Cookie, Authorization header or session state

Actors

  • Unauthenticated attacker who can send crafted links to users
  • Malicious or curious user who can observe cache behavior on shared infrastructure
  • Insider or downstream proxy operator who can read cache keys and stored objects
  • Automated scanner or bot that visits links before a human reviews them

Trust boundaries

  • Browser to CDN edge
  • CDN edge to origin load balancer
  • Origin router to application controller
  • Application controller to template renderer and session store
  • Cache storage shared across tenants or customers

Abuse cases

  • Append .css to an authenticated account URL and have the CDN store the personalized body
  • Use a semicolon or encoded slash so the cache sees a static file while the origin sees the account route
  • Exploit case sensitivity where the cache rule matches .CSS but the origin route ignores case
  • Place the asset-looking value in a query parameter that the cache ignores in its key
  • Trigger the victim through a link on the trusted domain, then read the cached page anonymously
PrerequisitesHTTP caching: Cache-Control, Age, Vary, ETag and shared versus private cachesHow a CDN maps a request path to an origin request and a cache keyPath parsing differences: extensions, semicolons, encoded slashes, dot segments and case sensitivitySession cookies and authenticated response generationBurp or an intercepting proxy with the ability to replay requests with and without cookies
Request anatomy

Follow the decision, not the payload

Every family has a moment where trusted data becomes an authorization, parsing or state decision. Learn to point at that moment in the request path.

  1. 01

    Route

    The application serves a private page at a path such as /account/profile and renders data from the victim's session.

  2. 02

    Disagree

    The CDN decides cacheability from a suffix or pattern, while the origin router decides the resource from a prefix or normalized path.

  3. 03

    Poison

    The victim opens a crafted URL like /account/profile.css. The origin returns the private profile, and the CDN stores it because the path looks static.

  4. 04

    Store

    The private body is written under a cache key the attacker knows, often with a long TTL and without Vary: Cookie.

  5. 05

    Retrieve

    The attacker requests the same key without a session and receives the stored private body from the edge, never reaching the origin's authorization check.

Case study

PayPal web cache deception (2017)

Omer Gil, public PayPal cache deception disclosure, 2017
Context

A researcher tested whether PayPal's edge cache would store authenticated account pages when a static-looking suffix was appended to the URL. The CDN treated paths ending in .css as cacheable assets, while the origin continued to serve the signed-in account page.

Discovery

By requesting a URL such as /myaccount/home.css with a victim session and then fetching it without cookies, the researcher received the victim's personal account information from the cache.

Impact

Personal and account information could be disclosed to an unauthenticated attacker who could lure a user to the crafted URL. The bug required user interaction but no special privileges.

Root cause

The cache and the origin used different rules to classify the same request. Cacheability was inferred from the URL suffix instead of the response's sensitivity and headers.

Fix

Stop caching authenticated responses, honor private and no-store headers at the edge, normalize paths consistently, and cache only explicit static prefixes.

Read it as a chain: discovery → failed decision → impact → fix. Then ask which link would have broken earliest.

Attacker lens

A repeatable testing sequence

  1. Find an authenticated page that reflects account data, a token, an email or a support secret.
  2. Compare the CDN cache rule with the origin route parser: extension, prefix, semicolon, encoded slash, query string and case sensitivity are common disagreements.
  3. Make the victim load the crafted URL, or wait for a real user to open it, so the authenticated response passes through the cache.
  4. Request the exact same key anonymously and compare the body, headers and age with a fresh private response.
  5. Prove impact with the exposed data, not with the presence of a cache header alone.

Where smart people get fooled

  • A cache-control: private header on the response is only effective if the CDN actually honors it; verify the stored object.
  • Appending .css may be normalized by the origin but preserved by the cache, or the reverse; test the exact bytes on both sides.
  • Encoded slashes, semicolons, case changes and trailing dots are separate parser decisions, not interchangeable payloads.
  • A cached error page or a public asset is not cache deception; the stored response must contain data the attacker could not obtain directly.
Detection engineering

What would the logs show?

A control is stronger when someone can see it fail. These signals are starting points for a detection rule, not a complete SIEM use case.

  • Authenticated requests whose paths end in static extensions, semicolons or encoded slashes
  • Cache HIT responses for URLs that also return personalized fields when a session is present
  • A single client requesting an account path with and without a session in a short window
  • CDN cache keys that omit Cookie or Authorization while the origin varies on them
  • Private data appearing in responses with Age greater than zero
Starter query
index=cdn sourcetype=access_combined | eval asset_like=if(match(uri, "\.(css|js|png|jpg|gif|svg|woff2?)(;|$)") OR match(uri, "%2f|%252f|;"),1,0) | eval private_path=if(match(uri, "^/(account|profile|admin|billing|settings)"),1,0) | where asset_like=1 AND private_path=1 | stats count values(uri) values(cache_status) by clientip, status | where count > 3
The defender's move

Fix the decision, then prove it stays fixed

  • Mark every authenticated response Cache-Control: private, no-store and Vary: Cookie, and make the CDN honor origin headers.
  • Cache only an explicit allowlist of static routes after canonicalizing the path; never infer cacheability from a suffix.
  • Normalize and reject ambiguous path encodings at the edge so the origin and the CDN agree on one resource key.
  • Strip session cookies from static asset routes and add regression tests that request private pages with asset-like suffixes.
Vulnerable patterntypescript
// CDN rule: cache every path ending in a static extension
if (path.endsWith('.css') || path.endsWith('.js')) {
  response.setHeader('Cache-Control', 'public, max-age=86400');
}
return renderAccountPage(request.session.user);
Safer patterntypescript
const STATIC_PREFIXES = ['/assets/', '/static/', '/fonts/'];
const normalized = new URL(request.url, 'https://app.example').pathname;
const isStatic = STATIC_PREFIXES.some((prefix) => normalized.startsWith(prefix));
if (!isStatic || request.session) {
  response.setHeader('Cache-Control', 'private, no-store');
  response.setHeader('Vary', 'Cookie, Authorization');
}
return renderAccountPage(request.session.user);

Cacheability must be a property of the response and an explicit route allowlist, not a guess based on the URL suffix. Normalize the path once at the edge and pass the same canonical value to the origin.

Regression tests a reviewer would ask for

Private page with a static suffix is not cached

GivenA signed-in user requests /account/profile.css

WhenThe response passes through the CDN

ThenThe response carries Cache-Control: private, no-store and a later anonymous request reaches the origin and is denied

Semicolon and encoded slash variants are rejected

GivenRequests for /account/profile;.css and /account%2fprofile.css

WhenThe edge normalizes the path

ThenThey resolve to the account route, remain uncached and require a session

Static allowlist only

GivenAn arbitrary path ending in .css outside /assets or /static

WhenThe cache evaluates the request

ThenThe path is not eligible for shared caching even if the origin returns 200

Cache key includes session variance

GivenTwo requests to the same URL, one with a session and one without

WhenBoth pass through the cache

ThenThe authenticated response is never served to the anonymous request

False positives

What this finding is not

Strong testers kill their own findings before someone else does. These are the shortcuts that turn a real bug into a weak report — or a false alarm into a wasted escalation.

  • The URL ends in .css but the origin returns 401 or a login page; no private data was stored.
  • The response is cached but contains only public static content, so there is no confidentiality impact.
  • The cache stores a personalized error page with no user-specific data; rate it as a lower-severity information leak only if it reveals something sensitive.
  • The attacker must already know the victim's session cookie or a one-time token; that is a different vulnerability, not cache deception.
Working vocabulary

Terms you should be able to use precisely

Shared cache
A cache such as a CDN or reverse proxy that stores one response for many users, so key mistakes become cross-user disclosure.
Cache key
The normalized request attributes a cache uses to decide whether two requests refer to the same stored response.
Cache deception
Tricking a cache into storing a private response under a public-looking key, then retrieving it without authorization.
Cache poisoning
Storing an attacker-controlled response for other users; deception steals a victim's response, poisoning alters what others receive.
Path normalization
Resolving dot segments, encodings, separators and case so that every layer agrees on the resource identifier.
Vary
A response header that tells caches which request headers change the representation, such as Cookie or Authorization.
Interview drill

Answer these without reciting a payload

How is cache deception different from cache poisoning?

Poisoning stores attacker-controlled content that other users later receive. Deception stores a victim's private response under a key the attacker can request, so the attacker reads data rather than injecting it.

Why is checking Cache-Control on the origin not enough?

The CDN may ignore, override or strip origin headers, and it may decide cacheability before it sees the response. Verify the actual stored object and the edge configuration.

What is the single most reliable fix?

Do not shared-cache authenticated responses at all, and cache only an explicit allowlist of static routes after canonicalizing the path.

Knowledge check

Can you separate the mechanism from the payload?

Four questions, graded on the server. Answers and explanations are released only after you submit, and signed-in learners keep a best score.

4 questions
01Which condition makes cache deception possible?
02An attacker appends .css to an account page. What should the cache do?
03Which header most directly tells a shared cache not to store a response?
04What is the best validation that a cache deception fix works?
الخلاصة الموسّعة
لماذا هذا مهم؟

Cache Deception ليست ثغرة في التخزين نفسه، بل في اختلاف تفسير الرابط بين الـCDN والأصل. قد يرى الـCDN أن المسار ينتهي بـ.css فيخزّنه، بينما يرى التطبيق أنه صفحة حساب خاصة فيعيد بيانات الجلسة. الحل العملي: منع التخزين المشترك لكل استجابة تعتمد على Cookie أو Authorization، وتطبيع المسار مرة واحدة عند الحافة، والسماح بقائمة صريحة من البادئات الثابتة فقط. اختبر دائمًا بنسختين: طلب مصادق وطلب مجهول لنفس المفتاح، وتأكد أن الثاني لا يصل إلى جسم الأول.

If the edge cache disappeared tomorrow, would the same path confusion still expose data through logs, analytics or a downstream proxy?