Skip to content
Misconfiguration Disclosed report Beginner

Firebase Database Takeover in Zego Sense Android app

A Firebase Realtime Database URL was hardcoded in the Android app's string resources and the database was left publicly readable and writable. An attacker could read the data and overwrite it with arbitrary content.

sheikhrishad0 Follow

Originally disclosed on HackerOne

High 7.5 View original
  • Disclosed after 6 months

Hello Team,

Summary: publicly available Firebase Database (api-project-615509201590.firebaseio.com)

Platform Affected: [android] com.zegocover.zego

Steps To Reproduce:

in res/values/strings.xml

<string name="firebase_database_url">https://api-project-615509201590.firebaseio.com</string>

POC:

Go to https://api-project-615509201590.firebaseio.com/.json
poc.PNG
poc.PNG From the original on HackerOne

Exploit:

import requests
data= {"Exploit":"Successfull", "H4CKED BY": "Sheikh Rishad"}
reponse = requests.put("https://api-project-615509201590.firebaseio.com/.json", json=data)

References:

There are guidelines available by Firebase to resolve the insecurities and misconfiguration, please follow this link: https://firebase.google.com/docs/database/security/resolve-insecurities

Regards, Sheikh Rishad

Impact

This is quite serious because by using this database attacker can use this for malicious purposes and also an attacker can track this database if zego uses it for future perspective and at that time it will be much easier for the attacker to steal the data from this repository and later it will harm the reputation of the zego.

So please immediately change the rule of the database to private so that nobody can able to access it outside.

The original report as published on HackerOne, by sheikhrishad0. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target is the Zego Sense Android application, package com.zegocover.zego, in the Zego bug bounty program on HackerOne. The feature involved is the app's Firebase Realtime Database integration. Firebase Realtime Database is a hosted JSON tree that an app reads and writes over HTTPS; the database URL is embedded in the client, and access control is enforced by the security rules configured for that database rather than by the client. If those rules permit public reads and writes, anyone who knows the URL can use the database directly.

Setup

No accounts, roles or special tooling are described. The researcher worked from the published Android package and inspected its resources. The only precondition is that the Firebase database URL shipped inside the app is reachable from the internet.

Finding it

The database URL is stored as a string resource in the app. In res/values/strings.xml the researcher found:

XML
<string name="firebase_database_url">https://api-project-615509201590.firebaseio.com</string>

That value is the Firebase Realtime Database endpoint for the project. Because the URL is compiled into a client that anyone can download, it is not a secret; the only thing that should protect the data is the database's security rules. The researcher's next step was to check whether those rules allowed unauthenticated access.

Exploitation

Step 1: Read the database root

The researcher requested the root of the database with the .json suffix that the Firebase REST API uses to return the tree as JSON:

Text
Go to https://api-project-615509201590.firebaseio.com/.json
poc.PNG
poc.PNG From the original on HackerOne

The screenshot is the proof of concept for that request. A successful read of /.json means the rules allow public reads at the root.

Step 2: Write to the database

To show that the exposure was not read-only, the researcher wrote to the same root with an HTTP PUT carrying a JSON body:

Python
import requests
data= {"Exploit":"Successfull", "H4CKED BY": "Sheikh Rishad"}
reponse = requests.put("https://api-project-615509201590.firebaseio.com/.json", json=data)

The script sends a PUT to the root .json endpoint with a small JSON object as the body. A PUT to a Firebase location replaces the data at that location, so the script tests whether unauthenticated writes are permitted. Read and write access together mean the database is fully open to anyone who has the URL.

Root cause

The Firebase Realtime Database was left with security rules that do not require authentication, so requests to the REST endpoint are accepted from anyone. The URL is not the problem: it is embedded in the client by design and is discoverable by anyone who unpacks the APK. The mistake is that the rules, which are the actual access control layer, were not restricted to authenticated users. The report does not include the rule set itself, so the exact configuration is not shown; the observed behaviour is consistent with public read and write rules at the root.

Impact

As the researcher puts it, the exposure is serious because an attacker can use the database for malicious purposes, and can keep tracking it if Zego continues to use it, which would make it easier later to steal data from the repository and harm Zego's reputation. The write attempt tests whether data in the database can be modified or replaced by an unauthenticated party, not merely read. The report does not describe what data the database actually held, so the sensitivity of the exposed content is not established in the text.

Fix

The researcher asked for the database rules to be changed to private immediately, so that nobody can access the database from outside, and pointed to Firebase's own guidance on resolving insecure rules:

Text
https://firebase.google.com/docs/database/security/resolve-insecurities

The report does not state which change was ultimately applied.

Variants to test

  1. Root read on other apps. Extract firebase_database_url (or google_app_id and related values) from an APK's strings.xml and request the root with /.json. A positive result is a JSON body containing data rather than a permission-denied error.
  2. Write check. Send a PUT to a harmless, clearly named node with a small JSON body, as in the report. A positive result is a successful response and the value being readable back afterwards.
  3. Deeper nodes. If the root is denied, try child paths that the app is known to use. A positive result is any node that returns data without authentication.
  4. Other Firebase products. The same pattern applies to other client-embedded endpoints; a positive result is any endpoint that answers unauthenticated requests with data or accepts writes.

Hunting notes

This class of bug hides in client-side configuration: string resources, manifest metadata and generated config files inside mobile packages, where backend URLs are compiled in and treated as non-secret. During recon, the signal is a Firebase database URL in the app's resources; the quick confirmation is a request to the root .json endpoint, and the difference between a denied and an open database is immediate. The researcher demonstrated impact by showing an unauthenticated read of the root and providing a script to write to it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

An Android app called Zego Sense (package name com.zegocover.zego) uses a service called Firebase Realtime Database to store data. Firebase is a Google product that gives apps a ready-made online database. The app talks to that database over the internet, and the address of the database is written inside the app itself.

Normally a database like this is protected by rules that say who is allowed to read and write. In this case the rules appeared to be left open: the address returned data without logging in, and the researcher provided a script to write to it. The researcher found the address inside the app, opened it in a browser, saw the data, and then provided a script to write a small entry.

This is a beginner-friendly walkthrough of that report. Every request and every line of code below is copied exactly from the report.

Background: the words you need first

Before the steps, a few ideas explained from zero.

  • API: a way for one program to talk to another over the internet. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself; you ask through the waiter, and the kitchen answers. Here the "waiter" is a web address that accepts requests and returns data.
  • Firebase Realtime Database: a database hosted by Google that stores data as a tree of JSON (a text format for structured data, like a nested list of labelled values). Apps read and write it over HTTPS, the same secure web protocol your browser uses.
  • Security rules: the settings on the Firebase database that decide who may read and who may write. This is the real lock on the door. The app itself is not the lock, because anyone can download the app.
  • Client: the program on the user's side, here the Android app. Anything shipped inside a client can be seen by anyone who downloads it, so an address stored in the app is not a secret.
  • APK: the installable file of an Android app. It is a kind of zip archive, so its contents, including text files, can be opened and read.
  • res/values/strings.xml: a text file inside an Android app that holds fixed pieces of text and configuration values, such as addresses the app uses.
  • .json suffix: Firebase's web interface returns the database contents as JSON when you add .json to the address. It is a convenience for reading the tree from a browser or a script.
  • HTTP PUT: one of the standard request types on the web. A GET asks for data; a PUT sends data and replaces whatever is at that address. If a PUT succeeds without a login, the door is open for writing.
  • Unauthenticated: without proving who you are. No username, no password, no login token.

The target

The target is the Zego Sense Android application, package com.zegocover.zego, in the Zego bug bounty program on HackerOne. A bug bounty program is a scheme where a company invites outside researchers to look for security problems and report them, sometimes for a reward.

The feature involved is the app's Firebase Realtime Database integration. The database address is embedded in the app, and access control is enforced by the security rules configured for that database, not by the app. If those rules permit public reads and writes, anyone who knows the address can use the database directly.

Setup

No accounts, roles or special tooling are described. The researcher worked from the published Android package and inspected its resources. The only precondition is that the Firebase database address shipped inside the app is reachable from the internet.

In plain terms: download the app, open it like a zip file, look at its text files, and see whether the address inside answers when you visit it.

Finding it

The database address is stored as a string resource in the app. In res/values/strings.xml the researcher found:

XML
<string name="firebase_database_url">https://api-project-615509201590.firebaseio.com</string>

Line by line:

  1. <string ...> is an Android resource entry: a named piece of text the app can use.
  2. name="firebase_database_url" is the label of the entry. The name itself tells you it holds the Firebase database address.
  3. The text between the tags is the address itself, https://api-project-615509201590.firebaseio.com, which is the Firebase Realtime Database endpoint for the project.

Why this step matters: because the address is compiled into a client that anyone can download, it is not a secret. The only thing that should protect the data is the database's security rules. So the researcher's next step was to check whether those rules allowed unauthenticated access.

Exploitation

Step 1: Read the database root

The researcher requested the root of the database with the .json suffix that the Firebase REST API uses to return the tree as JSON:

Text
Go to https://api-project-615509201590.firebaseio.com/.json
poc.PNG
poc.PNG From the original on HackerOne

What this means: "root" is the top of the tree, the whole database rather than one branch. Adding /.json asks Firebase to hand back the contents as JSON text. You can do this in an ordinary browser: paste the address into the address bar and press Enter.

The screenshot is the proof of concept for that request. A successful read of /.json means the rules allow public reads at the root. A "node" is one branch or entry in the tree.

Step 2: Write to the database

To show that the exposure was not read-only, the researcher wrote to the same root with an HTTP PUT carrying a JSON body:

Python
import requests
data= {"Exploit":"Successfull", "H4CKED BY": "Sheikh Rishad"}
reponse = requests.put("https://api-project-615509201590.firebaseio.com/.json", json=data)

Line by line:

  1. import requests loads requests, a popular Python library for making web requests. Python is a programming language; a library is a bundle of ready-made code you can reuse.
  2. data= {"Exploit":"Successfull", "H4CKED BY": "Sheikh Rishad"} builds a small JSON object with two labels and two values. This is the content that will be written.
  3. reponse = requests.put("https://api-project-615509201590.firebaseio.com/.json", json=data) sends a PUT request to the root .json address, with the object as the body. The result is stored in a variable named reponse (spelled that way in the report).

Why a PUT: a PUT to a Firebase location replaces the data at that location. So a successful response would indicate that unauthenticated writes are permitted as well. Read and write access together mean the database is fully open to anyone who has the address.

Root cause

The Firebase Realtime Database was left with security rules that do not require authentication, so requests to the REST endpoint are accepted from anyone. The address is not the problem: it is embedded in the client by design and is discoverable by anyone who unpacks the APK. The mistake is that the rules, which are the actual access control layer, were not restricted to authenticated users. The report does not include the rule set itself, so the exact configuration is not shown; the observed behaviour is consistent with public read and write rules at the root.

An everyday comparison: the address is like a street address printed on a leaflet. Printing it is fine. Leaving the front door unlocked is the problem.

Impact

As the researcher puts it, the exposure is serious because an attacker can use the database for malicious purposes, and can keep tracking it if Zego continues to use it, which would make it easier later to steal data from the repository and harm Zego's reputation. The write attempt tests whether data in the database can be modified or replaced by an unauthenticated party, not merely read. The report does not describe what data the database actually held, so the sensitivity of the exposed content is not established in the text.

Fix

The researcher asked for the database rules to be changed to private immediately, so that nobody can access the database from outside, and pointed to Firebase's own guidance on resolving insecure rules:

Text
https://firebase.google.com/docs/database/security/resolve-insecurities

That link is Google's documentation page explaining how to close off an insecure database. The report does not state which change was ultimately applied.

Variants to test

These are other checks in the same spirit, for anyone learning this pattern.

  1. Root read on other apps. Extract firebase_database_url (or google_app_id and related values) from an APK's strings.xml and request the root with /.json. A positive result is a JSON body containing data rather than a permission-denied error.
  2. Write check. Send a PUT to a harmless, clearly named node with a small JSON body, as in the report. A positive result is a successful response and the value being readable back afterwards.
  3. Deeper nodes. If the root is denied, try child paths that the app is known to use. A positive result is any node that returns data without authentication.
  4. Other Firebase products. The same pattern applies to other client-embedded endpoints; a positive result is any endpoint that answers unauthenticated requests with data or accepts writes.

Hunting notes

This class of bug hides in client-side configuration: string resources, manifest metadata and generated config files inside mobile packages, where backend addresses are compiled in and treated as non-secret. During recon (the early stage of looking around), the signal is a Firebase database address in the app's resources; the quick confirmation is a request to the root .json endpoint, and the difference between a denied and an open database is immediate. The researcher demonstrated impact by showing an unauthenticated read of the root and providing a script to write to it.

Glossary

  • API: a way for one program to talk to another over the internet, like a waiter taking your order to the kitchen.
  • APK: the installable file of an Android app; it is a zip-like archive whose contents can be opened and read.
  • Bug bounty program: a scheme where a company invites outside researchers to find and report security problems.
  • Client: the program running on the user's side, here the Android app.
  • Firebase Realtime Database: a Google-hosted database that stores data as a JSON tree and is read and written over HTTPS.
  • HTTP PUT: a web request type that sends data and replaces whatever is at the target address.
  • HTTPS: the secure version of the web protocol used by browsers and apps.
  • JSON: a text format for structured data, made of labelled values and nested lists.
  • Node: one branch or entry in a database tree.
  • Recon: the early stage of exploring a target to find useful information.
  • REST API: a web interface that uses standard request types such as GET and PUT on addresses.
  • Root: the top level of the database tree, containing everything below it.
  • Security rules: the settings on a Firebase database that decide who may read and who may write.
  • String resource: a named piece of text stored in an Android app's resource files.
  • Unauthenticated: without proving who you are, with no login or token.
  • res/values/strings.xml: a text file inside an Android app holding fixed text and configuration values.

More from Zego

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.