Skip to content
Cache bugs Write-up Intermediate

When a Login Page Became a Trap: My Discovery of a Web Cache Dec

A login endpoint returned personalised HTML containing a CSRF token, and appending a .js extension caused the CDN to cache that response. An attacker could trick a victim into visiting the crafted URL, then retrieve the cached page to obtain the victim's token and potentially take over the account.

Anshubind Follow

Published on medium.com

Some bugs scream for attention. Others whisper quietly in the background… until you notice something that just doesn’t feel right.

Anshubind, 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 CDN cached dynamic HTML based on the URL ending in .js, while the origin server returned the personalised login page for that path without setting no-store headers.

Impact

An attacker could trick a victim into visiting the crafted URL, then retrieve the cached response to obtain the victim's CSRF token, potentially leading to account takeover or CSRF attacks.

What the attacker needed

Victim clicks a crafted link; CDN caches the personalised response

The fix

The report recommended setting Cache-Control: no-store on auth routes, blocking fake static extensions, allowlisting cacheable paths, respecting origin headers, and reviewing all auth endpoints; it does not state whether these were implemented.

How it was found

  1. Send a GET request to the login endpoint with a .js extension appended.
  2. Observe that the server returns the full login page with a CSRF token.
  3. Check the response header and see CF-Cache-Status: HIT, indicating the page was cached.
  4. Refresh and confirm the cached response is still served.

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 content delivery network (CDN) is a service that stores copies of web pages to serve them faster. This report shows that the CDN mistakenly stored a personalised login page, including a secret token used to protect forms, because the URL looked like a static file. An attacker could then fetch that stored copy and use the token to act as the victim.

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.

More by Anshubind

View all

15 more disclosed reports, best first.

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.