Skip to content
CSRF Write-up Intermediate

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.

Mohamed Sayed Follow

Published on flex0geek.blogspot.com

on August 12, 2021

Mohamed Sayed (Flex), on flex0geek.blogspot.com

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

  1. Open a page in an iframe with a data: URL to run JavaScript with a null origin.
  2. Send a request to the vulnerable endpoint with a JSON body to perform an action.
  3. For the XSS chain, first send a request to open the search tab.
  4. 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.

More by Mohamed Sayed

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.