Head(er) Games: How I Turned CORS Misconfig into a Full Data Dump
The API reflected any origin that contained the trusted domain as a substring, so an attacker could host a page on a lookalike domain and read authenticated user data. The attacker could then use the victim's session to query sensitive GraphQL endpoints and exfiltrate personal and internal information.
Free Link🎈
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 checked the Origin header with a loose substring or regex match instead of an exact allowlist, and also allowed credentials.
Impact
Any authenticated user visiting the malicious site could have their session-protected data silently leaked, including personal details and internal reports, and session tokens could enable account takeover.
What the attacker needed
Victim visits attacker-controlled site; victim is logged in to the target; attacker can host a page on a lookalike domain
The fix
The API should validate the Origin header against an exact allowlist of trusted origins and avoid allowing credentials unless strictly necessary.
How it was found
- Find the API subdomain during recon.
- Notice it returns Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers.
- Host a malicious page on a domain that contains the trusted domain as a prefix.
- Send a request with that Origin and observe it is reflected in the response headers.
- Use JavaScript to fetch sensitive GraphQL data with credentials included.
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 lets a website say which other sites may read its data. Here the API trusted any site whose address merely contained the trusted name, so a fake site could read private data from a logged-in user's account.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.