Finding an api key in a .js file in the comments
A JavaScript file contained an API key and app ID left in code comments, which the author found by manually inspecting the beautified file. The text does not state what an attacker could do with the key.
infosecwriteups.com
Published on infosecwriteups.com
A SMALL TIP FROM MY SIDE: YOU NEED TO USE AUTOMATION AND MANUAL. YOU NEED TO USE BOT.H DON’T SKIP MANUAL TESTING.
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 left sensitive credentials in comments within a publicly served JavaScript file.
What the attacker needed
None
How it was found
- Open a JavaScript file related to the bug bounty target.
- Use a Firefox extension called Beautify javascript to format the code.
- Scroll through the file and look at comments carefully.
- Find an app ID and API key in the comments.
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 file is code that a website sends to your browser, and anyone can read it. Sometimes developers leave notes (comments) in that code, and those notes can accidentally include secret keys. If a secret key is exposed, someone else might be able to use it to access a service, but this write-up does not show that happening.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.