Bypass CORS Filter leads to CSRF Application Wide
The application checked the Origin header to prevent CSRF but accepted a null Origin, allowing cross-site requests. The author chained this with a self-XSS to make it exploitable and noted it could be used for CSRF application-wide.
Published on flex0geek.blogspot.com
on August 12, 2021
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's origin validation treated a null Origin as trusted or failed to reject it, instead of only allowing explicitly listed origins.
Impact
An attacker could perform actions such as deleting, adding, or opening files on behalf of a logged-in user, and could chain it with a self-XSS to achieve XSS; the text does not demonstrate a full CSRF exploit against a victim.
What the attacker needed
Victim is logged in; victim visits attacker page; browser sends null Origin
The fix
The server should reject requests with a null Origin and only accept explicitly allowed origins, and should also use CSRF tokens.
How it was found
- Open a page in an iframe with a data: URL to run JavaScript with a null origin.
- Send a request to the vulnerable endpoint with a JSON body to perform an action.
- For the XSS chain, first send a request to open the search tab.
- After a delay, send a second request to set the XSS payload in the search field.
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 often check the 'Origin' header to ensure requests come from their own pages, not from an attacker's site. Here, the check could be bypassed by sending a request with a null Origin, which browsers do when a page is loaded from a data: URL inside an iframe. This let the attacker make the application perform actions on behalf of a logged-in user.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.