XSS on out of scope domain? CORS is your secret weapon!
An XSS vulnerability existed on an out-of-scope subdomain, and the main in-scope domain had a CORS misconfiguration that allowed any subdomain to make credentialed requests. By chaining the XSS with the CORS misconfiguration, an attacker could read sensitive user data from the in-scope domain.
Published on c4rrilat0r.medium.com
Hello everyone, and welcome to my second Medium post! I hope you enjoy and find it helpful.
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 main domain's CORS policy reflected any subdomain in the Access-Control-Allow-Origin header and allowed credentials, combined with an XSS on a subdomain.
Impact
An attacker could steal sensitive user data from the in-scope domain by exploiting the XSS on the out-of-scope subdomain, as demonstrated by retrieving user information.
What the attacker needed
XSS on an out-of-scope subdomain; In-scope domain with CORS allowing all subdomains and…; Victim visits the XSS page
How it was found
- Find an XSS vulnerability on an out-of-scope subdomain.
- Search for an in-scope domain that allows CORS from any subdomain and allows credentials.
- Test the CORS misconfiguration using the XSS domain as the origin.
- Craft an XSS payload on the out-of-scope subdomain to fetch sensitive data from the in-scope domain.
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.
Cross-Site Scripting (XSS) lets an attacker run their own JavaScript in a victim's browser on a website. Cross-Origin Resource Sharing (CORS) is a browser rule that controls whether a page from one site can read data from another site. Here, a less important subdomain had XSS, and the main site trusted all subdomains for CORS, so the attacker could use the XSS to read private data from the main site.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.