How I Took a Website Completely Offline with a Funky Cache Poison
A cache poisoning vulnerability allowed an attacker to make the entire website unavailable by sending a special header that caused the server to return an empty response, which the CDN then cached for all users. The attacker could poison the cache for all possible cookie combinations, resulting in a full denial of service.
Published on medium.com
Hey everyone, Erfan here! In this write-up, I want to share a fun story about a cache poisoning vulnerability I found that led to a full-blown Denial of Service, knocking the entire site offline for all users.
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 responses based on a small set of predictable cookie values, and the server returned an empty response when a specific header was present, allowing an attacker to poison all cache variants.
Impact
The attack could take the entire website offline for all users by serving a blank page, resulting in a full denial of service.
What the attacker needed
Target uses Next.js and a CDN; CDN caches based on cookies; cookies have limited predictable values; attacker can send HTTP/1.1 requests
How it was found
- Send a request to the login page over HTTP/1.1 with the x-middleware-prefetch header.
- Observe that the server responds with a 200 OK and an empty JSON object.
- Notice that the CDN caches this response for users with the same cookie values.
- Discover that the cookies are chosen from a small set of predictable values, giving only 12 possible combinations.
- Write a script to send the same request for each of the 12 cookie combinations.
- Run the script to poison the cache for all combinations, causing the site to serve the empty page to all users.
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 like a storage room that keeps copies of web pages so they load faster for everyone. If an attacker can trick the cache into storing a broken or empty page, then everyone who visits the site gets that broken page instead of the real one. This report shows how a small header trick combined with predictable cookies let an attacker fill the cache with empty pages, taking the whole site offline.
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.