Skip to content
Info disclosure Write-up Intermediate

How I Found a Source Map Exposure Leading to an Account Takeover

An exposed JavaScript source map on a production React application revealed internal source code, including that JWT tokens were stored in localStorage and that the backend API had a wildcard CORS policy. An attacker could combine these to steal tokens and make authenticated cross-origin requests, leading to account takeover.

Divakarvasani Follow

Published on systemweakness.com

During a bug bounty research session on a responsible disclosure program run by a large European security services company, I discovered a chain of vulnerabilities stemming from a single misconfiguration — an exposed JavaScript source map on a production application. This writeup covers my methodology, findings, and…

Divakarvasani, on systemweakness.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 production build was configured to generate and serve source maps, and the application stored sensitive tokens in localStorage while the API used a wildcard CORS policy.

Impact

An attacker could steal JWT tokens via any XSS and use them to make authenticated cross-origin API requests, leading to account takeover and access to guard patrol data.

What the attacker needed

Victim logged in; attacker can host a page; victim visits attacker page; XSS or malicious script on domain

The fix

The source map should not be generated in production (e.g., set GENERATE_SOURCEMAP=false), tokens should be stored in httpOnly cookies, and CORS should not allow wildcard origins with credentials.

How it was found

  1. Enumerate subdomains using certificate transparency logs and subfinder.
  2. Detect live hosts and identify a React application.
  3. Check for a source map file and download it.
  4. Extract internal source files from the source map.
  5. Analyse the source code to find JWT storage in localStorage and a hardcoded analytics token.
  6. Test the backend API's CORS policy and observe a wildcard origin.

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.

A source map is a file that helps developers debug minified code by mapping it back to the original source. If it is left publicly accessible, anyone can read the original code. Here, that code showed that login tokens were stored in a place any script on the page could read, and that the API accepted requests from any website. Together, these could let an attacker steal a user's session.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Divakarvasani

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.