Skip to content
CORS Write-up Beginner

How I Earned $$$ in a CORS Exploit Misconfigured

The user profile endpoint reflected any Origin header in Access-Control-Allow-Origin while also allowing credentials, so a malicious site could read authenticated users' sensitive data. An attacker could host a page that fetches the profile with the victim's cookies and exfiltrates the response.

medium.com

Published on medium.com

In this write-up, I’ll walk you through how I discovered a CORS misconfiguration vulnerability on a bug bounty target that led to a $$$ reward. While CORS issues are often overlooked, they can become serious security risks when combined with credentialed endpoints or sensitive API data.

Buvaneshvaran K, 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 reflected the Origin header into Access-Control-Allow-Origin without validating it against an allowlist, and also set Access-Control-Allow-Credentials to true.

Impact

An attacker could read authenticated users' sensitive profile information such as email, name, and internal ID numbers, leading to a privacy violation.

What the attacker needed

Victim is logged in; victim visits attacker-controlled page

The fix

The server should validate the Origin header against a strict allowlist of trusted domains and only reflect those, and should not allow credentials for untrusted origins.

How it was found

  1. Send a request to the user profile endpoint with an Origin header set to an attacker-controlled domain.
  2. Observe that the response reflects that origin in Access-Control-Allow-Origin and includes Access-Control-Allow-Credentials: true.
  3. Create an HTML page that uses fetch with credentials to request the profile endpoint.
  4. Host the page on an attacker domain and have a logged-in victim visit it.
  5. The page reads the profile data and sends it to the attacker.

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 lets a website say which other sites may read its data. Here the site said 'any site' and also allowed cookies to be sent, so a page on an attacker's site could fetch the logged-in user's profile and read it. The fix is to only allow trusted origins.

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.