RedSuture research
“allow read: if true” is two permissions, and a field mask isn’t one
Before we point RedSuture at anyone else’s app, we point it at our own. In November we ran it against Botly Pro, an AI chatbot for websites that we build and run. Two scans, two and a half hours apart, found the same weakness twice: our Firestore rules let anyone on the internet read our customers’ chatbot data. The first scan found that the data could be listed. After we fixed that, the second found that each document could still be read in full.
Both issues are fixed and we’ve verified the fixes. Customer names, bot IDs and domains are left out of this post.
The setup
Botly Pro’s widget runs on our customers’ websites. When a visitor opens a site, the widget loads that bot’s published configuration (its name, colours, greeting) straight from Firestore, using the project’s public web config. That’s normal for Firebase apps. The API key and project ID ship in every page, so the security rules are the only thing between the internet and the data.
Each bot had two documents that the widget needed to read without anyone signing in:
botly_configs/{botId}: the bot’s published configuration and, in the same document, its knowledge base, meaning the text taken from the customer’s site that the AI uses to answer questions.botly_licenses/{botId}: whether the bot is paid for, and which domains it may run on.
The rules for both said:
match /botly_configs/{botId} {
allow read: if true;
...
}The intent was “anyone who knows a bot’s ID can load it.” The rule says more than that.
Finding 1: anyone could list every customer’s data
The agents read the public Firebase config from the site, then called the Firestore REST API with no account and no token:
GET https://firestore.googleapis.com/v1/projects/<project-id>/databases/(default)/documents/botly_configs?pageSize=100
→ 200 OK, every bot configuration in the projectThe same request worked for botly_licenses. To show the gap was specific to these two collections, the agents made the same request for a collection with proper rules (our leads collection) and got 403 Missing or insufficient permissions.
At the time, that one request returned every bot’s configuration and licence in the project: 6 bot configurations and 3 licence records belonging to 3 accounts. They included each bot’s full knowledge base (one was 22 KB), business contact details, the domains each bot ran on, and whether it was paid for. The scan rated it high (CVSS 7.5) and reported it with the requests above as proof.
Why it happened. read is shorthand for two operations: get (one document by its ID) and list (queries, including “give me everything”). We meant to allow the first and allowed both.
Fix 1, deployed 32 minutes after the report:
match /botly_configs/{botId} {
allow get: if true; // the widget loads one bot by its ID
allow list: if isAdmin(); // nobody can enumerate customers
}Finding 2: one document by ID still gave away everything
We ran the scan again that afternoon. Listing now failed with 403, as it should. So the agents looked at how the widget reads a single bot. They read its JavaScript bundle and found the request it makes:
GET .../documents/botly_configs/{botId}?mask.fieldPaths=configThe mask.fieldPaths=config part asks Firestore to return only the config field, which is the public part. But a mask isn’t a permission. The client chooses it, so an attacker simply leaves it off:
GET .../documents/botly_configs/{botId}
→ 200 OK, the whole document, including the private knowledge baseKnowing a bot’s ID was enough, and every bot ID is in the embed snippet on its customer’s website. Anyone visiting a customer’s site could read the knowledge base behind their bot. The scan rated it high (CVSS 7.5).
Why it happened. Firestore rules decide whether a document can be read. They can’t hide some of its fields. Once get is allowed, every field comes with it. We’d mixed data for two audiences (every website visitor, and only our own backend) in one document, and then relied on the client to ask for less.
Fix 2, two days later: split the data by who may read it.
// Published config: only what already ships in the customer's embed snippet.
match /botly_configs/{botId} {
allow get: if true;
allow list: if isAdmin();
}
// Private knowledge base: no browser may read it. Only our backend (Admin SDK) and admins.
match /botly_knowledge/{botId} {
allow read: if isAdmin();
...
}We moved the knowledge bases into botly_knowledge, removed them from the public documents, and changed the backend to read them with the Admin SDK, which isn’t subject to the rules.
Verified on 4 December
We checked the live project again, without signing in:
| Request | Before | Now |
|---|---|---|
List botly_configs | 200, every configuration | 403 |
List botly_licenses | 200, every licence | 403 |
| Get one config by ID | 200, including the knowledge base | 200, public fields only (botId, config, kbVersion, ownerUid, timestamps) |
| Get one knowledge base by ID | not separate yet | 403 |
Timeline (UTC)
| When | What |
|---|---|
| 17 Oct | Rules deployed with allow read: if true on both collections |
| 25 Nov, 09:50 | First scan starts |
| 25 Nov, 10:12 | Scan reports finding 1 (listing) with proof |
| 25 Nov, 10:44 | Fix 1 deployed (get and list split) |
| 25 Nov, 12:18 | Second scan starts |
| 25 Nov, 12:39 | Scan reports finding 2 (field mask bypass) with proof |
| 27 Nov, 09:40 | Fix 2 deployed (private data moved to its own collection) |
| 4 Dec | Both fixes verified on the live project |
Check your own project in two minutes
Find your project ID in your web app’s Firebase config (it’s public), then try these without signing in. Only test projects you own.
1. Can anyone list a collection?
curl -s -o /dev/null -w "%{http_code}\n" \
"https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_COLLECTION?pageSize=1"200 means anyone can enumerate it. You want 403, unless the collection really is meant to be public.
2. Does a public document carry private fields?
Fetch one document you expect to be public, without a mask, and look at the field names:
curl -s "https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_COLLECTION/SOME_ID" \
| python3 -c "import sys,json; print(sorted(json.load(sys.stdin).get('fields', {})))"If you see anything you wouldn’t show a stranger, move it to a document that only your backend or the owner can read.
3. Read your rules for these patterns
allow read: if truewhere you meant “fetch by ID”: writeallow get: if true;and keeplistrestricted.allow read: if request.auth != nullon data that belongs to one user: any signed-in user (and anyone can sign up) can read everyone’s. Check ownership, for exampleresource.data.ownerUid == request.auth.uid.- Code that relies on
select(),mask.fieldPathsor “the app never asks for that field.” Your app may never ask for it, but an attacker can.
What we took from it
- Nothing looked wrong. Every screen worked and every customer saw the right bot. The exposure was in a path no user ever takes: talking to the database directly.
- Proof changed how fast we moved. Each finding came with the exact request that showed the data. We deployed the first fix 32 minutes after reading it.
- The re-test found what the first fix missed. Without the second scan, finding 2 would still be live.