Skip to content
Info disclosure Write-up Intermediate

From APK to Firebase Tokens: Analyzing a Hardcoded API Key in an Android App

A Firebase API key was hardcoded in a production Android APK. The researcher used it to generate Firebase Installation authentication tokens without any authentication, which could expand the attack surface if backend services are misconfigured.

basithkpabdul25 Follow

Published on medium.com

During a mobile application security assessment, I identified a Firebase configuration embedded inside a production Android APK. By reverse engineering the application, I was able to extract a Google Firebase API key and use it to generate valid Firebase Installation authentication tokens.

4b6o0t, on medium.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 Firebase API key was embedded in the client app without restrictions on which apps or services could use it, allowing unauthenticated token generation.

Impact

The exposed key allowed unauthenticated generation of Firebase tokens, which could potentially lead to abuse of push notifications, access to misconfigured databases, exposure of files, or manipulation of remote config if backend rules are weak.

What the attacker needed

Access to the Android APK; no authentication required

The fix

The API key should be restricted to specific Android apps using the SHA-1 fingerprint, and Firebase Security Rules should be enforced.

How it was found

  1. Decompile the APK using apktool.
  2. Search the decompiled resources for the Firebase API key.
  3. Validate the key with a Google APIs discovery request.
  4. Send a request to the Firebase Installations API with the key and app ID.
  5. Observe that a Firebase Installation ID, auth token, and refresh token are returned.

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 a string that identifies an app to a service, like a name badge. Here it was left inside the app's files, so anyone who downloaded the app could find it. The researcher showed that this key could be used to get temporary login tokens from Firebase, Google's app backend service, without needing a password.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.