Leaked API Key in Public JavaScript Leads to Potential Abuse
A JavaScript file served from the target's own domain contained a hard-coded API key visible to anyone who fetched the file. The author argues that if the key had write permissions or was tied to a paid service, an attacker could tamper with data, abuse accounts or run up costs, though no exploitation was demonstrated.
On a typical late-night recon session—just me, my terminal, and a cup of coffee—I was passively scanning a few assets on domain.com, a target participating in a public bug bounty program.
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 a secret credential was hard-coded into client-side JavaScript instead of being kept on the server.
Impact
Depending on the key's permissions, an attacker could tamper with data, abuse accounts, exhaust quotas or cause billing costs, but the text does not confirm any of this was possible.
What the attacker needed
Public bug bounty target; no account needed to fetch JS
The fix
Secrets should be removed from client-side code and replaced with environment variables and a backend proxy, with strict scopes and rate limits on any token.
How it was found
- Enumerate subdomains of the target domain passively.
- Probe the subdomains to find which ones respond over HTTP.
- Collect archived URLs and filter for JavaScript files.
- Fetch the JavaScript files and read them by hand.
- Spot the hard-coded API key in a configuration block.
- Report the finding to the bug bounty platform.
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.
Websites send JavaScript files to every visitor's browser, so anything written inside them can be read by anyone. This file contained a secret key, which is like a password that lets software talk to another service. If that key can do more than read public data, a stranger who copies it could act as the site.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.