Skip to content
CORS Write-up Intermediate

How a Single Server Mistake Broke Our CORS Policy

The API reflected a second Origin header alongside the legitimate one in Access-Control-Allow-Origin while allowing credentials, so a malicious site could read the token response cross-origin. The author states they tried to exploit it but failed, so no actual theft is demonstrated.

yr9364536 Follow

Published on medium.com

Before we start I tried to exploit this Cors ,but I failed so do not report it unless you successful exploited it.

Yahia Ibrahim khamis, on medium.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 concatenated multiple Origin header values into the allow-list instead of rejecting duplicate Origin headers or validating against a strict allow-list.

Impact

A malicious site could potentially read the token response cross-origin with the victim's credentials, but the author states they failed to exploit it, so real impact is unconfirmed.

What the attacker needed

Victim visits attacker page; victim has an active session cookie; attacker can send duplicate Origin headers

How it was found

  1. Observe a request to the API token endpoint that carries an Origin header from the login subdomain.
  2. Try common origin bypass tricks such as subdomain prefixes, suffixes, null and encoded variants, none of which worked.
  3. Add a second Origin header with an attacker domain before the legitimate one.
  4. Observe the response reflecting both origins in Access-Control-Allow-Origin with credentials allowed.

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 stops one website from reading responses from another site unless the server explicitly allows it. This server echoed back an attacker-supplied origin in its allow-list together with credentials, which would let a malicious page read the victim's token. The author says they could not actually exploit it, so the real-world impact is unproven.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by yr9364536

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.