Breaking the Same-Origin Policy: A Dive into a CORS Misconfigurat
An authenticated API endpoint reflected any supplied Origin in its CORS response headers while also allowing credentials, so a malicious site could read a logged-in user's account data. An attacker could host a page that fetches the endpoint with cookies included and silently exfiltrate user IDs, emails, subscription status and balance details.
Published on infosecwriteups.com
Free Article Link: Click for free!
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 reflected the request's Origin header into Access-Control-Allow-Origin without validating it against an allowlist, and combined this with Access-Control-Allow-Credentials set to true.
Impact
Any logged-in user who visited an attacker's page could have their account data, including personal and financial details, silently read and stolen, with no interaction required.
What the attacker needed
Victim logged in to the target site; victim visits an attacker-controlled page
The fix
The server should return only a fixed, allowlisted origin in Access-Control-Allow-Origin and should not enable credentials unless strictly necessary; the text does not say whether this was fixed.
How it was found
- Find an authenticated API endpoint that returns user-specific data.
- Send a request to it with an attacker-controlled Origin header added manually.
- Inspect the response headers for the reflected origin and the credentials flag.
- Confirm the response body contains sensitive authenticated data, proving the browser would let a malicious site read it.
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.
Browsers normally stop one website from reading data returned by another website, a rule called the Same-Origin Policy. CORS is a set of response headers a server uses to say which other sites are allowed to read its responses. Here the server simply echoed back whatever site the request claimed to come from and also allowed cookies, so any website could read the victim's private account data while they were logged in.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.