From CORS Misconfiguration to Sensitive Data Exposure
The API returned a wildcard Access-Control-Allow-Origin together with Access-Control-Allow-Credentials: true, so any website could read authenticated responses. An attacker could make a logged-in victim visit a malicious page and read private messages, friends lists and fitness goals.
medium.com
Published on medium.com
My name is Montaser Mohsen, and I’m an independent security researcher and bug bounty hunter. I spend a large part of my time analyzing web applications, looking for security flaws that could potentially impact user privacy and platform security.
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 server sent a wildcard Access-Control-Allow-Origin together with Access-Control-Allow-Credentials: true on data endpoints, so it accepted credentialed cross-origin reads from any origin.
Impact
An attacker could read private messages, friends lists and personal fitness goals of a logged-in user through a malicious website; the session cookie itself could not be stolen because of HttpOnly, Secure and SameSite=Lax.
What the attacker needed
Victim is logged in; victim visits attacker page; no special account needed
The fix
The endpoints should allow only trusted origins and must not combine wildcard origins with credentials; the text notes that the endpoints were later updated with stronger protections.
How it was found
- Log in to the platform as a normal user.
- Visit a malicious webpage while still logged in.
- The page sends a cross-origin request with credentials to a data endpoint.
- The server returns the victim's data because of the CORS headers.
- The page reads the response and sends it to the attacker.
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.
Websites normally cannot read data from another site because of a browser rule called the Same-Origin Policy. CORS is a way for a server to relax that rule for chosen other sites. Here the server relaxed it for every site while also allowing logged-in cookies, so a malicious page could fetch the victim's private data.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.