Your Browser Trusts Websites More Than It Should
A server reflected any Origin header back in its CORS response along with credentials, allowing an attacker's website to read a victim's private account data using the victim's logged-in session. The author describes this as a trust mistake where the server fails to validate origins against an allow list.
medium.com
Published on medium.com
I still remember the first time I found a CORS bug. I was testing an API endpoint that returned a user’s private account details.
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 reflects the Origin header without validating it against a strict allow list, and also allows credentials.
Impact
An attacker could read private user data such as profile information, tokens, or session details, and in worst cases use a leaked token to take over the account.
What the attacker needed
Victim visits attacker's page; victim logged into target site; server reflects Origin and allows credentials
The fix
The server should validate the Origin header against a strict allow list, avoid wildcards with credentials, and not trust subdomains by default.
How it was found
- Send a request to a sensitive endpoint with a random Origin header.
- Check if the response reflects that Origin in Access-Control-Allow-Origin.
- Check if Access-Control-Allow-Credentials is true.
- If both are present, the endpoint is vulnerable to cross-origin data theft.
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 use a rule called CORS to decide which other websites are allowed to read their data. If a site is misconfigured, it may trust any website that asks, so a malicious page you visit can quietly read your private information from another site where you are logged in.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.