All write-ups

Eight Vulnerabilities in a Firebase Production App — Authorised Engagement

A walkthrough of the methodology used during an authorised penetration test of a Firebase and Next.js production application. Eight vulnerabilities found, two rated Critical.

penetration-testingfirebaseweb-appIDORauthorised-engagement

Disclosure notice: This engagement was conducted under a signed authorisation agreement. The client name and any identifying details have been redacted. Specific exploit steps, payloads, and raw report content are available on request under NDA. Nothing in this post is sufficient to reproduce an attack against any system.


Background

The target was a production web application built on Firebase, Next.js, and Vercel. The client needed a security review before a planned user growth push. The scope covered the full application — authentication, data storage rules, API endpoints, and client-side logic. Eight vulnerabilities were identified across the engagement, two of which were rated Critical.

The common thread

Before going through the individual findings, it is worth naming the pattern that runs through most of them.

Nearly every high-severity vulnerability came down to one question: does the server verify that the user making a request actually owns the resource they are asking for?

In practice, this meant taking a request that referenced my own data through an ID, swapping that ID for someone else's, and watching what came back. If the server returned their data instead of an error, ownership was not being checked. That single technique — substituting identifiers to test authorisation logic — uncovered the majority of the critical and high-severity findings.

Findings overview

1. Unrestricted Firestore Read (Critical)

Firestore's REST API accepts authenticated requests directly. After capturing a valid Firebase ID token from a login request, I sent GET requests to the REST endpoint for each likely collection name. Collections that returned a 200 with data had no read rules applied. Collections with proper rules returned 403.

Several sensitive collections were open, including user records, business accounts, and payment data. Any authenticated user could read documents they had no legitimate access to.

2. Unrestricted Firestore Write (Critical)

With read access confirmed, the next question was whether the same token could write. Sending PATCH requests to open documents revealed that the server was not checking document ownership before allowing modifications. An authenticated user could overwrite another user's data.

3 and 7. IDOR on User and Business Accounts (High)

The unrestricted collections exposed a list of real user and business IDs. Substituting my own ID with another user's in document-specific requests returned their records without error. The same technique applied to business accounts by swapping the value of the activeAccountId field — the server accepted and processed the substituted ID.

4. Missing Rate Limiting on Login (Medium)

Using Burp Intruder to send repeated login attempts with incorrect credentials revealed no meaningful throttling. The application did eventually respond differently after a certain number of attempts, but the threshold was high enough that an automated credential-stuffing attack would not be stopped in a practical sense.

5. Credentials Passed in URL (High)

During the login flow, the email address and password were being sent as GET parameters rather than in the POST request body. This means credentials appear in server access logs, browser history, and any proxy sitting between the client and server.

6. Client-Side Price Control on Purchases (High)

The purchase request included an amount field that was set by the client and sent directly to the server. Intercepting and modifying this value showed that the server was not independently calculating the expected price. Server-side validation was later added as part of the remediation.

Impact

The two Criticals represented the highest-risk findings. Open Firestore rules on sensitive collections meant that any registered user could read payment records and personal data belonging to other users, and could write to documents they did not own. Combined with the IDOR findings, an attacker could enumerate accounts, extract data at scale, and modify records — all with a standard authenticated session.

Remediation

The core fix across most findings was the same: move trust to the server. Specific recommendations included:

  • Writing Firestore security rules that scope read and write access to request.auth.uid == resource.data.userId at minimum
  • Validating ownership server-side on every document request, not relying on client-supplied IDs
  • Moving credentials to the POST body and enforcing HTTPS-only transmission
  • Implementing rate limiting and account lockout on the authentication endpoint
  • Recalculating purchase amounts server-side using authoritative pricing data

What this engagement reinforced

Firestore's security model puts the full responsibility for access control on the developer. The rules file ships open by default in some project templates, and it is easy to leave it that way during rapid development. A single rule misconfiguration exposes the entire collection to any authenticated user.

The broader lesson is that client-supplied identifiers should never be trusted for authorisation decisions. The server needs to independently verify that the authenticated user has the right to access or modify the specific resource being requested — every time.


Full report available on request under NDA. Contact via the links below.