Authenticated CORS with Access-Control-Allow-Origin: *
An API returned personal information with the CORS header Access-Control-Allow-Origin: * even for authenticated requests. The author found that Chrome's force-cache fetch option would return a cached authenticated response to a cross-origin request, allowing an attacker to read the secret data.
During one of my BugBounty session on a program from YesWeHack I came across an API with with some personal informations and the header Access-Control-Allow-Origin: . Here is how I managed to steal the informations an find a bug in chrome.
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 server sent Access-Control-Allow-Origin: * on authenticated responses, and Chrome's force-cache mode reused a cached authenticated response for a cross-origin request without credentials.
Impact
An attacker could read a victim's secret personal information from a different origin, but only in Chrome; Firefox did not return the cached response.
What the attacker needed
Victim uses Chrome; victim visits attacker page; target sends ACAO: * on authenticated responses
The fix
The server should add a Vary: Cookie header to prevent Chrome from reusing the cached response.
How it was found
- Build a page that fetches the target URL with cache set to force-cache.
- Parse the returned HTML and extract the secret from the textarea.
- Observe that Chrome returns the cached authenticated response containing the secret.
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.
CORS is a browser rule that stops one website from reading data from another website unless the other site explicitly allows it. Here the site used a wildcard that should only allow reading public data, but a bug in Chrome's cache let an attacker read private data that was meant to be protected by a login cookie.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.