Exploiting Firestore Database Rules: A Pathway to Data Breaches
A Firestore collection had a security rule that allowed any reader to read every document, so the author could dump other users' records. The author used a public API key plus their own session token to query the database directly and retrieve the whole collection.
In the world of cloud-based applications, Firebase Firestore provides a flexible and scalable NoSQL database solution. However, like any powerful tool, it comes with its own set of risks if not properly configured.
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 read rule on the collection was set to allow all readers rather than checking that the requester's user ID matched the document owner.
Impact
Any authenticated user could read every document in the affected collection, exposing other users' personal and account data.
What the attacker needed
A valid account on the app; the public Firestore API key; the user's own session token
The fix
The read rule should require an authenticated user whose ID matches the document owner, as the author's corrected rule shows.
How it was found
- Find the Firestore API key inside a password reset link received by email.
- Log in and intercept the user's own session ID from the application's requests.
- Query the Firestore REST endpoint with only the API key and observe an unauthorised response.
- Repeat the query adding the session ID as a bearer token.
- Receive the full collection contents, including other users' records.
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.
Firestore is a cloud database that apps talk to directly from the browser. Its security rules decide who may read or write each record. Here a rule said anyone may read, so one logged-in user could pull everyone's data.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.