Skip to content
Misconfiguration Write-up Intermediate

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.

Aditya Dixit Follow

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.

Aditya Dixit (@zombie007o), on blog.dixitaditya.com

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

  1. Decompile the APK with apktool.
  2. Search strings.xml for API keys using grep.
  3. Extract the APK and view the certificate with keytool to confirm the SHA1 hash.
  4. Identify the X-Android-Cert and X-Android-Package headers in an app request.
  5. 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.

More by Aditya Dixit

View all

6 more disclosed reports, best first.

More from Google

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.