Skip to content
Leaked secrets Write-up Beginner

From JS File to Jackpot: How I Found API Keys and Secrets Hidden in Production Code

The author found exposed Stripe secret and Firebase API keys in publicly accessible JavaScript files. They validated the keys, showing they could access Stripe customer data and Firebase project data.

infosecwriteups.com

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, developers hardcoded sensitive API keys directly into client-side JavaScript files.

Impact

An attacker could access sensitive Stripe transaction data and Firebase project data, including customer emails and database names.

What the attacker needed

Publicly accessible JavaScript files; keys embedded in those files

How it was found

  1. Gather subdomains and live hosts, then extract JavaScript file URLs.
  2. Filter out common library files and focus on custom JavaScript files.
  3. Download all JavaScript files and search for keywords like apikey, token, secret.
  4. Validate the Stripe key by making an API request to list charges.
  5. Validate the Firebase key by adding it to a test config and accessing project 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.

JavaScript files that run in your browser can contain secret keys if developers are careless. Here, the author found a Stripe secret key and a Firebase API key in such files. These keys let anyone who finds them access payment and database information.

What is Leaked secrets?

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

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.