I Found AWS Credentials in a Public JavaScript Bundle. Here’s W
A public JavaScript bundle contained a live AWS access key and a payment gateway token, exposed to any visitor. An attacker could use the key to call the API Gateway, with impact depending on the key's IAM permissions.
Published on medium.com
The browser’s Network tab was still loading when I noticed the main JavaScript chunk was 2.1 MB. That’s not a red flag on its own — modern single-page apps are bloated by default.
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 build-time secret injection: a configuration file containing credentials was imported into the client-side bundle, making the secret publicly downloadable.
Impact
The exposed key could be used to call the API Gateway; the worst case depended on the key's IAM policy, which the author could not see, so the impact could range from calling public endpoints to enumerating or exfiltrating backend data.
What the attacker needed
None
The fix
The credentials were rotated and the fix deployed; the correct pattern is to keep secrets server-side and have the client call your own backend, plus scan build output for secrets.
How it was found
- Download the main JavaScript bundle from the CDN without authentication.
- Format the minified bundle to make it readable.
- Search the formatted bundle for patterns matching AWS access keys and other secrets.
- Identify a configuration object containing an AWS access key, region, endpoint, and a payment token.
- Confirm the key format is valid and that the bundle uses it in production traffic, without using the key.
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 JavaScript bundle is the file your browser downloads to run a website. If a secret like an AWS key is placed in that file, anyone can read it because the file is public. The author found such a key and reported it without using it.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.