Sitemap

๐Ÿ” I Found a Hardcoded Google API Key in a Popular Food App (and It Was Too Easy ๐ŸŸ๐Ÿ”‘)

2 min read4 days ago

--

โ˜• โ€œWoke up, scanned an APK, found a secret. Just hacker things.โ€

While playing around with my custom APK vulnerability scanner (yes, I made one โ€” because why not?), I stumbled upon a pretty critical bug in a popular food delivery app with millions of downloads. The kind of bug that would make a security triager say:

โ€œBro, are you serious?โ€

Letโ€™s walk through the finding, how I automated it, and why hardcoding secrets is a huge no-no.

๐Ÿšจ Vulnerability: Hardcoded Google API Key

Yup. Plaintext. In the APK. Just chilling in strings.xml like it pays rent.

๐Ÿ” Pattern:

AIza[0-9A-Za-z\\-_]{35}

Thatโ€™s the signature of a Google API Key. If it isnโ€™t properly restricted, it can lead to:

  • Free rides for attackers on your Google Cloud bill
  • Firebase access (in worst cases)
  • Quota exhaustion
  • And chaos in general

โš™๏ธ My Scanner Did This (in Seconds)

Hereโ€™s how my automated scanner flagged it:

grep -Eo 'AIza[0-9A-Za-z\-_]{35}' res/values/strings.xml

Output:

[Critical] Hardcoded Google API Key found
File: res/values/strings.xml
Key: AIzaSyD4XxY1xYwJpK0lm2nQdW9aB3s_KmBkT-AE

(๐Ÿ”’ Redacted here. Iโ€™m not that guy.)

๐Ÿงช Manual PoC

  1. Decompile the APK:
apktool d appname.apk -o app_decompiled

2. Navigate to:

app_decompiled/res/values/strings.xml

3. Search for the pattern:

grep -Eo 'AIza[0-9A-Za-z\-_]{35}' strings.xml

Thatโ€™s it. No root. No MITM. Just some CLI magic. ๐Ÿ˜Ž

๐Ÿง  Impact: Itโ€™s Not Just a String

  • ๐Ÿ”ฅ API key abuse (Maps, Directions, Places, Firebase, etc.)
  • ๐Ÿ’ธ Financial loss (you pay, attacker plays)
  • ๐Ÿงต Data leakage (if tied to Firebase, oh boy)
  • ๐Ÿ“‰ Brand damage (especially when the bug bounty report says: โ€œFound in 5 minutes.โ€)

๐Ÿ›ก๏ธ How Devs Should Fix This

  1. Never store secrets in client-side code โ€” ever.
  2. Use a backend proxy to sign and forward requests securely.
  3. If you must keep it on the device, use Android Keystore, encrypt it, and restrict access.
  4. Restrict the API key via:
  • SHA-1 + package name (for Android)
  • IP or referrer (for web/server)

๐Ÿ’ก Bonus: Automate Like a Pro

This is literally the kind of bug you can automate 100%:

  • Create a regex dictionary of common secrets
  • Recursively scan all decompiled XML and Smali files
  • Flag and log anything juicy
  • Add severity rating based on regex hit + file path

(I can share the full scanner code if this post gets enough love. ๐Ÿ˜)

โ˜• Hackerโ€™s Note:

Itโ€™s not about finding random bugs โ€” itโ€™s about finding real-world exploitable issues that an attacker can abuse, and that a triager wonโ€™t ignore. This one was:

  • Easy to find
  • Realistically dangerous
  • And absolutely avoidable

๐Ÿง  Security is not a feature. Itโ€™s a process. One grep at a time.

--

--

AIwolfie
AIwolfie

Written by AIwolfie

Cybersecurity enthusiast โ˜• | Ethical hacker | Bug bounty hunter | Sharing insights on vulnerabilities to help make the web a safer place.

No responses yet