Bypassing CORS
The site's CORS policy reflected the Origin header and allowed credentials, but validated it with a loose check that accepted a domain merely ending in the trusted name. An attacker could host a page on a lookalike domain and read the victim's account details cross-origin.
Published on medium.com
{{media:0}}
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 validated the Origin header with a suffix or substring match instead of an exact match against the allowed origin.
Impact
An attacker could read a logged-in victim's account information from another origin, though the victim would need to visit the attacker's page.
What the attacker needed
Victim is logged in; victim visits attacker's page; attacker controls a lookalike domain
The fix
The server should compare the Origin header exactly against a strict allowlist of trusted origins rather than matching by suffix.
How it was found
- Log in to the site and inspect the CORS response headers.
- Try setting the Origin header to an attacker domain, which fails.
- Set the Origin header to the trusted domain followed by the attacker domain.
- Confirm the server accepts that origin.
- Host a page on the attacker domain that fetches the account-detail page and displays the data.
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 one website ask another site's server for data, and the server says which sites are allowed. Here the server allowed any site whose name ended with the trusted domain, so a site like the trusted name plus an attacker's domain was accepted. That let the attacker's page read the victim's account information while the victim was logged in.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.