How Not to Handle Your API Keys: A Love Letter to Developers Ever
A mobile app contained a hardcoded, unrestricted API key for third-party mapping services. Anyone who extracted the key could use it without limits, potentially stealing quota or running up charges on the owner's bill.
Published on meetcyber.net
Dear Developers, We love your work. Really not kidding.
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 the developers hardcoded an API key into the mobile app and did not restrict it by referrer, IP address, or usage limits.
Impact
An attacker could abuse the unrestricted key to steal free quota, abuse the service, or run up charges on the owner's bill; the text does not claim the key was actually abused.
What the attacker needed
Access to the mobile app; ability to inspect app code
The fix
Keys should not be hardcoded in mobile apps; they should be stored securely, restricted by referrer, IP, or endpoint, and monitored with quotas and regular rotation.
How it was found
- Test a mobile app and inspect its codebase.
- Find a hardcoded API key embedded in the app.
- Observe that the key has no referrer, IP, or usage restrictions.
- Confirm the key works without any additional authentication.
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.
An API key is like a password that lets an app use another company's service, such as maps. Here the key was written directly into the app's code, so anyone who downloaded the app could find it. Because the key had no restrictions, they could use the service as if they were the app owner.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.