Bypassing Google Maps API Key Restrictions
An Android app's Google Maps API key was restricted to the app's package name and certificate hash, but the app sent these values in request headers. An attacker who extracted the key from the APK could replay those headers to bypass the restriction and make unlimited billable API calls.
Published on blog.dixitaditya.com
We all know that Google Maps is used at places when there's a requirement to integrate Maps in websites/apps, or when companies want to search the locations entered by users in the Address fields.
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 API key restriction relied on client-supplied headers (package name and certificate hash) that are not secret and can be replayed by anyone who extracts them from the app.
Impact
An attacker could make unlimited billable Google Maps API requests using the victim's key, potentially causing significant financial cost; the report notes the issue was marked as an accepted risk.
What the attacker needed
Access to the Android APK; Ability to send HTTP requests with custom headers
How it was found
- Decompile the APK with apktool.
- Search strings.xml for API keys using grep.
- Extract the APK and view the certificate with keytool to confirm the SHA1 hash.
- Identify the X-Android-Cert and X-Android-Package headers in an app request.
- Replay those headers in a request to the Google Maps API to bypass the restriction.
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 company's Android app used a Google Maps key that was supposed to work only from that app. The app proved its identity by sending two headers: its package name and a fingerprint of its signing certificate. Because those values are not secret (anyone can read them from the app), an attacker could copy them and use the key from anywhere, running up the company's bill.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.