Misconfigured Firebase Database or Storage
Firebase Security Rules give anyone, or any signed-in user, access to the app's database or storage, so its data can be read, and often changed, directly.
| Severity | High |
| CVSS 3.1 | 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N Open in the calculator |
| CVSS 4.0 | 8.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-732: Incorrect Permission Assignment for Critical Resource |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1530 Data from Cloud Storage |
| Category | Broken Access Control |
Description
Mobile applications that use Firebase talk directly to the Firebase Realtime Database, Cloud Firestore and Cloud Storage for Firebase, using project details bundled in the application. These details, including the API key, are not secrets: Firebase relies on Security Rules, written by the developer and deployed with the project, to decide who may read and write each path, document or file. The weakness arises when those rules allow public access, such as a Realtime Database rule of ".read": true, test mode rules that allow all access until a date, or rules that accept any signed-in user (auth != null) while anyone can create an account or sign in anonymously.
Anyone on the internet who extracts the project details from the application can then read the data the rules expose, with no authentication or user interaction, and download it in bulk with simple requests. This commonly includes other users' personal data, messages, uploaded documents and images, and sometimes internal configuration or credentials, and exposure of personal data may need to be handled as a personal data breach. Where write access is also open, an attacker can alter or delete records, plant content that other users are shown, or upload files to the project's storage at the organisation's cost.
The weakness is identified by extracting the project details from the application package (the values from google-services.json in an Android application's resources, or GoogleService-Info.plist in an iOS application) and querying the services directly. A Realtime Database that returns data, rather than a permission denied error, when .json is appended to its address is publicly readable, and similar requests to the Firestore and Cloud Storage REST interfaces show whether documents and files can be listed or read. Write access, and the access gained by creating an account through the Firebase Authentication interface with the bundled API key, are then tested without altering existing data.
Remediation
Rewrite the Security Rules so that access is denied unless a rule explicitly grants it to the right user:
- Grant access per user or per role, for example by matching the path or document owner to
auth.uidorrequest.auth.uid, rather than allowing any request or any signed-in user. Use custom claims or stored role records for shared data. - Remove test mode and other time-limited open rules, and validate the shape, type and size of written data in the rules.
- Do not treat sign-in as authorisation where email sign-up or anonymous sign-in is enabled, as anyone can create an account with the bundled API key.
- Enforce App Check for the database, Firestore and Storage to reject requests that do not come from the genuine application. This reduces scripted abuse but does not replace correct rules.
- Keep rules in version control, test them with the Firebase Local Emulator Suite before deployment, and deploy them with the Firebase CLI.
Review what was exposed while the rules were open, check for data altered or files uploaded by others, and assess whether a personal data breach occurred. Confirm the fix by repeating the unauthenticated requests and the requests from a second test account, which should all be refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.