Skip to content
CORS Write-up Beginner

A Tiny CORS Header That Quietly Undid Years of Security Work

A production API was configured with a wildcard CORS origin, allowing any website to read authenticated responses. An attacker could trick a logged-in user into visiting a malicious page and steal their data.

medium.com

Published on medium.com

On a Friday afternoon, a developer pushed a tiny change to a config file. It was the kind of update nobody expects to matter — a single line meant to fix a browser error during testing.

1$ Mistake, 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

The API's CORS configuration used a wildcard origin instead of an explicit trusted domain, so browsers allowed any site to read authenticated responses.

Impact

For several weeks, any authenticated user could have had personal or business data harvested by visiting a malicious site; the text does not mention any defence that blocked this.

What the attacker needed

Victim is logged in; victim visits a malicious site; no special tools needed

The fix

The wildcard origin should be replaced with an explicit allowlist of trusted domains, and configuration checks should prevent wildcards from reaching production.

How it was found

  1. A user visits a malicious or compromised website while logged in.
  2. The site's JavaScript sends requests to the API using the user's browser.
  3. The browser includes the user's session cookies automatically.
  4. The API returns real user data because the session is valid.
  5. The wildcard CORS header lets the malicious site read the response.

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 data from another website. Here, the API told every browser it was fine to share responses with any site. So a bad website could quietly fetch a logged-in user's data using their own browser.

What is CORS?

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

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.