One Misplaced Header, Thousands of Leaked Sessions: A Bug Bounty
A session-refresh endpoint returned new session cookies but was cached by a CDN without the cookie or a user-context header in the cache key. An attacker could poison the cache with a privileged session cookie so that other users received it.
Free link 🎈
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
The CDN cached a response that set a session cookie because the cache key did not include the Cookie header or the X-User-Context header that the backend used to decide the session.
Impact
Every user hitting the endpoint within the cache lifetime could receive an admin-flavoured session cookie, allowing access to internal user data and support dashboards.
What the attacker needed
Ability to send requests to the endpoint; endpoint returns Set-Cookie; CDN caches the response
How it was found
- Crawl JavaScript files to map authenticated endpoints and log cache-related headers.
- Find the session-refresh endpoint that returns Set-Cookie and lacks Vary: Cookie.
- Send a request as User A and observe a cache MISS with a new session cookie.
- Send the same request as User B and observe a cache HIT returning User A's cookie.
- Send a request with an elevated X-User-Context header to poison the cache with an admin session.
- Use the poisoned session to access internal user APIs and extract JWTs.
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 CDN is a network of servers that stores copies of web responses to speed them up. If a response that sets a login cookie is stored and then given to other people, those people can end up logged in as someone else. Here the cache did not distinguish between different users, so one user's privileged cookie was handed to everyone.
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.