Cracking SameSite for a $2,000 Web Cache Deception
The homepage was cached by a proxy and included the authenticated user's JWT in its JavaScript, so an attacker could trick a victim into visiting a unique URL and then retrieve the cached page to steal the token. The attacker bypassed SameSite=Lax cookie restrictions by forcing a top-level navigation, allowing full account takeover.
medium.com
Published on medium.com
I recently received an invitation to test a booking platform. The platform supports self-signup and is hosted entirely on cloud infrastructure.
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 application cached a response that contained user-specific sensitive data (the JWT) without marking it as private, and the cache key did not account for the user's session.
Impact
An attacker could steal the JWT of any user who visits the malicious page, leading to full account takeover; the attack worked despite SameSite=Lax because top-level navigation includes cookies.
What the attacker needed
Victim visits attacker-controlled page; victim is authenticated; attacker can host a page
The fix
The application was fixed according to the timeline.
How it was found
- The attacker identifies that the homepage response includes the user's JWT and is cached (X-Cache: MISS then HIT).
- The attacker crafts a URL with a unique cache buster parameter to isolate the victim's cached response.
- The attacker hosts a malicious page that uses a meta refresh to force a top-level navigation to the crafted URL.
- The victim visits the attacker's page, which redirects them to the target homepage with the cache buster, causing their authenticated response to be cached.
- The attacker visits the same crafted URL and receives the victim's cached response, extracting the JWT.
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 web cache is a temporary storage that saves copies of web pages to serve them faster. Here, the homepage was saved with the user's secret login token (JWT) inside it, so anyone who could access that saved copy could log in as that user. The attacker made victims visit a special link that caused their page to be saved, then the attacker visited the same link to read the saved page and steal the token.
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.