Exposed and Ignored: How a JavaScript API Key Gave Me Full Cloud
A Google Maps API key was exposed in public JavaScript and had full access to Google Cloud Platform services. An attacker could access sensitive data, list buckets, and achieve blind remote code execution via a cloud function.
Free Link🎈
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 cloud API key with excessive permissions was hardcoded in client-side JavaScript.
Impact
The exposed key gave full infrastructure access, including sensitive data and remote code execution.
What the attacker needed
Publicly accessible JavaScript file; API key with excessive permissions
The fix
Secrets should never be exposed in frontend code; use restricted API keys and rotate them if exposed.
How it was found
- Performed subdomain enumeration and crawled JavaScript files.
- Found a suspicious JavaScript file and inspected it.
- Extracted an exposed API key from the minified code.
- Validated the key using KeyHacks and gcloud commands.
- Explored cloud services and dumped data.
- Achieved blind RCE via a cloud function.
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 secret key meant to be private was left in a public file that anyone can read. This key allowed access to the company's cloud services, so an attacker could read data and even run commands on their servers.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.