Skip to content
CORS Write-up Beginner

Simple CORS misconfig leads to disclose the sensitive token worth of $$$

An API endpoint that returns a user's authentication token reflected any origin whose hostname ended with the target's domain, so a lookalike domain the attacker could register was trusted. An attacker who owned such a domain could read the token of any visiting logged-in user and use it to authenticate to other API endpoints.

Ramalingasamy Follow

Published on 0xraminfosec.medium.com

Hey fellow hacker’s and Bug hunters , Recently i found some weird CORS misconfiguration in one of my targets.

Ramalingasamy, on 0xraminfosec.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 validated the Origin header with a loose suffix or substring match instead of an exact allowlist, and reflected the supplied origin while allowing credentials.

Impact

An attacker who registered the lookalike domain could read the authentication token of any logged-in user who visited it, and the text says the token authenticates the user to many API endpoints.

What the attacker needed

Attacker registers a lookalike domain; victim visits the attacker's page while logged in

How it was found

  1. Collect subdomains of the target and gather archived URLs for them
  2. Search the URL list for sensitive keywords such as token or password
  3. Find an API endpoint that returns an authentication token
  4. Send a request with an unrelated origin and observe it is rejected
  5. Send a request with a lookalike origin ending in the target domain and observe it is accepted

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 responses. Here the site checked the origin with a loose pattern match, so a domain that merely looked similar was accepted. Because the response also allowed credentials, a malicious page on that lookalike domain could read a logged-in user's token.

What is CORS?

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

More by Ramalingasamy

View all

3 more disclosed reports, best first.

More from Linear

View all

The newest disclosed reports for this program.

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.