Finding and Exploiting a Firebase Security Rules Vulnerability in
The Firestore security rules for chat messages only checked that a user was authenticated, not that they were a participant in the chat. Any logged-in user could read private messages between other users and modify messages sent by others.
Published on medium.com
Recently, while working on a project called Campus Rides, hosted at campusrides.vercel.app, I decided to perform a security review of the application. The platform allows university students to coordinate shared rides and includes features such as ride booking, chat between users, and notifications.
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
The Firestore rules for messages only checked authentication (isAuth()) and did not verify that the requesting user was a participant of the chat.
Impact
Any authenticated user could read private conversations and modify messages sent by other users, leading to exposure of private data and message tampering.
What the attacker needed
A free account on the platform; knowledge of a chat identifier
The fix
The rules should check that the user is a participant of the chat for reads and that only the sender can update their own messages.
How it was found
- Create three accounts: two to chat privately and one as the attacker.
- Have the two accounts exchange messages in a private chat.
- Capture Firestore traffic in browser developer tools to learn the chat and message identifiers.
- Log in as the attacker account and extract its Firebase authentication token.
- Send a request to the Firestore REST API for the chat messages using the attacker's token.
- Observe that the private messages are returned even though the attacker is not a participant.
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.
Firebase Firestore is a cloud database, and its security rules decide who can read or write data. Here, the rules only asked 'is this person logged in?' instead of 'is this person part of this chat?'. So any user with an account could see and change other people's private messages.
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.