Hidden Tokens, Open Wallets: How I Found Payment API Keys in Prod
A live Stripe publishable key was embedded in a production JavaScript bundle served from a staging payment subdomain. The author claims the key was unrestricted and could create customers and interact with payment endpoints, and that a cache layer kept the file exposed.
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 secret payment API key was hard-coded into client-side JavaScript and shipped to a production-facing host without restrictions on what the key could do.
Impact
The author claims the key allowed creating customers and reading payment data, and that cache poisoning could keep the exposure persistent, though the write-up does not show real customer data or funds being taken.
What the attacker needed
Access to the public site; no account needed
How it was found
- Run subdomain enumeration and probe live hosts to find candidate targets.
- Collect historical and crawled URLs and spot a static JavaScript file on a payments staging host.
- Download the JavaScript file and read it to find an embedded live payment key.
- Send a request to the payment provider's API using the key to check whether it works.
- Test further payment endpoints such as customers and charges to gauge impact.
- Send a request with a spoofed forwarding header to see whether the cached file reflects it.
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 website's JavaScript files are downloaded by every visitor's browser, so anything written into them is public. Here a payment key was left in such a file, and the author says it was not limited to safe actions, so anyone could use it to talk to the payment provider's API. A cache is a copy of a page kept by a server to serve it faster, which can keep a leaked file online even after it is removed.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.