Critical Media Takeover: How a Base64-Encoded QA Secret Compromi
A private API key for a media hosting service was embedded in a QA frontend JavaScript bundle, only Base64-encoded. An attacker could decode it and use it to list, delete, or overwrite production media assets.
Published on vanshrathorebughunter.medium.com
In modern web architecture, the line between frontend code and backend secrets is constantly blurred by complex build tools and dynamic chunking. Recently, while diving deep into a prominent tech company’s infrastructure, I uncovered a critical vulnerability that perfectly illustrates this risk.
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 private API key was included in a client-side build (via an environment variable) and only obfuscated with Base64 encoding, which is trivially reversible.
Impact
An attacker could delete all media files (causing denial of service), deface assets, or host malware on the trusted domain, potentially affecting production web and mobile apps.
What the attacker needed
Access to the QA subdomain; ability to download and inspect JavaScript files
The fix
The exposed key was revoked after the report, and developers should avoid embedding private keys in client-side code, using public keys with backend-generated signatures instead.
How it was found
- Download the static frontend assets from the QA subdomain.
- Search the JavaScript chunks for environment variables and API tokens.
- Find the Base64-encoded private key in the Angular main bundle.
- Decode the Base64 string to obtain the plaintext key.
- Use the key in a GET request to list files and confirm access.
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 that gives full control over a company's media files was hidden in a public website's code. The developers tried to hide it by encoding it, but encoding is easily reversed, so anyone could find and use the key.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.