Skip to content
Cache bugs Write-up Beginner

Web Cache Deception : Comment j’ai volé la clé API d’un utilisateur avec Burp Suite

The web server ignored extra path segments and served the private account page, while the CDN cache treated the URL as a static file and stored the response publicly. An attacker could make a victim visit a crafted URL and then read the victim's cached private page, including their API key.

kernraphael664 Follow

Published on medium.com

Aujourd’hui je vais vous expliquer comment j’ai résolu mon premier lab de Web Cache Deception sur PortSwigger Web Security Academy. Cette vulnérabilité permet à un attaquant de voler des données privées d’un utilisateur en trompant le système de cache d’un serveur web.

Gerard lonzi, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the cache keyed on the full URL including the static-looking extension, while the origin server ignored the extra path segment and returned the private page, so the private response was cached publicly.

Impact

An attacker could steal a victim's private account data, including their API key, by luring them to a crafted URL and then reading the cached response.

What the attacker needed

A victim who visits an attacker-controlled page; a cache that stores responses by URL extension; the origin server ignoring extra path segments

The fix

Private pages should be served with Cache-Control: no-store, and the cache should not ignore extra path segments when deciding what to store.

How it was found

  1. Log in and confirm the account page contains a private API key.
  2. Send the account request to Repeater and add an arbitrary path segment; the server returns the same page.
  3. Add a static extension to the path and observe a cache miss with a short max-age.
  4. Repeat the request within the cache lifetime and observe a cache hit, confirming the flaw.
  5. Deliver a script that redirects the victim to the crafted URL.
  6. Visit the same crafted URL to read the victim's cached account page and API key.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A cache is a storage layer that keeps copies of web pages to serve them faster. Here the server and the cache disagreed about what a URL meant: the server returned the private account page, but the cache saw a file ending in .js and saved that private page for anyone to read. The attacker tricked the victim into loading the URL, then fetched the same URL to see the victim's private data.

What is Cache bugs?

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.

Similar reports

View all

Same bug class and techniques, clearest first.

Web cache poisoning and deception

The lesson behind this report.

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.