Skip to content
CORS Write-up Beginner

How I Leaked Sensitive User Data Using CORS in a HackerOne Progra

The server reflected any supplied Origin header in Access-Control-Allow-Origin and also set Access-Control-Allow-Credentials to true, allowing cross-origin requests with credentials. An attacker could host a malicious page that makes authenticated requests to a protected endpoint and reads sensitive data such as shopping cart contents.

Figurx Follow

Published on medium.com

A while ago, while visiting my hometown on holiday, I felt that familiar itch: the urge to test something. With no gear on me, I borrowed my nephew’s dusty laptop, pulled an old monitor from my parents’ closet, and logged into HackerOne.

Figurx, 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

Impact

An attacker could read sensitive data from a victim's authenticated session, such as shopping cart contents, and potentially exfiltrate it; other tested endpoints were not affected.

What the attacker needed

Victim logged in; victim visits attacker page

How it was found

  1. Log in to the target site with a valid account in one browser tab.
  2. Save a malicious HTML page that makes a credentialed fetch request to the protected cart endpoint.
  3. Host the page locally using a simple web server.
  4. In the same browser session, open a new tab and navigate to the hosted page.
  5. Observe that the page successfully retrieves and displays sensitive response data.

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 websites may read its responses. Here the site trusted every website, so a page on any domain could ask for the user's private data using their logged-in cookies. The attacker just needed the victim to visit a malicious page while logged in.

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.