Skip to content
Leaked secrets Write-up Beginner

Package of Problems: How a Frontend NPM Library Leaked Internal

A staging frontend served JavaScript source map files publicly, which contained a live Stripe secret key and an internal admin API bearer token. An attacker could use these keys to access Stripe customer data and internal admin endpoints.

iski Follow

Published on infosecwriteups.com

Free Link 🎈

Iski, on infosecwriteups.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 build process failed to exclude secrets from production bundles and did not strip source maps, and environment variables were not properly set.

Impact

The exposed keys allowed full access to Stripe customer data and internal admin user listings, potentially leading to data breaches and further compromise.

What the attacker needed

Publicly accessible source map files; Secrets included in frontend build

The fix

The report does not state that the issue was fixed, but it should be fixed by removing source maps from production, excluding secrets from frontend builds, and properly setting NODE_ENV to production.

How it was found

  1. Find a staging site via subdomain enumeration.
  2. Download the publicly accessible JavaScript source map file.
  3. Search the map file for secrets using grep.
  4. Verify the Stripe key by making an API request.
  5. Use the internal admin token to access an admin API endpoint.

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.

Source maps are files that help developers debug their code by mapping minified code back to the original. If these files are publicly accessible, they can reveal secrets like API keys that were accidentally included in the code. Here, the keys allowed access to sensitive systems.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by iski

View all

186 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.