79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

Budibase Prototype Pollution Erases MongoDB Filters (CVE-2026-137498)

A proto key erases the filter of a public Budibase MongoDB query, exposing every document; no stable release carries the fix yet.

TL;DR

  • A __proto__ key in a dynamic JSON key of a public Budibase MongoDB query erases the query's filter. The GitHub advisory GHSA-x4w8-596q-fmh7 describes the two-pass enrichment that drops the predicate.
  • Budibase Server 3.39.18 through 4.1.0 is affected when a MongoDB datasource has a PUBLIC query that uses a request parameter as a JSON key. The CVE record lists 3.39.18 to before 4.0.0.
  • The CVE record rates it CVSS v3.1 10.0 Critical and CVSS v4.0 9.9 Critical. No exploitation is known, and the CVE is not in CISA KEV as of 2026-11-27.
  • No stable release carries the fix as of 2026-11-27: commit d04b900 is on master and in the 4.2.0-cloud.3 and later prereleases. See "How do I fix it?" for the workaround.

Am I affected?

A Budibase deployment is exposed when all of these conditions hold:

  • The server runs Budibase 3.39.18 or later without commit d04b900, which covers the 3.39.18 through 4.1.0 releases.
  • A MongoDB datasource is configured in the workspace.
  • A query is exposed to a published app with the execution role PUBLIC.
  • The query uses a request parameter as a JSON key, for example {"{{ key }}":"fixed"}.
  • Recaptcha is disabled for query execution, or the caller can satisfy it.
  • The caller knows the published app ID and the query ID, which appear in the app's normal requests.

The bug needs a query that was built with the dynamic-key feature added in Budibase pull request 18987. A query whose JSON keys are all literal strings is not affected. The advisory also excludes the legacy multi-object string format "{} {}" and says the single-JSON object-backed form is the confirmed case.

Branch Affected versions Fixed version
3.x 3.39.18 to 3.51.0 None; no 3.x release carries commit d04b900
4.x 4.0.0 to 4.1.0 No stable release; the CVE record says 4.0.0, but the v4.0.0, v4.0.1 and v4.1.0 source still carries the flaw

The CVE record lists 4.0.0 as the first unaffected release. The source at v4.0.0, v4.0.1 and v4.1.0 still contains the vulnerable assignment. The public fix commit d04b900 is dated 2026-11-23, after v4.1.0 was published. No stable self-hosted release carries the fix as of 2026-11-27.

Budibase is widely deployed. As of 2026-11-27, the Docker Hub repository had 2,356,973 pulls, the GitHub repository had 28,454 stars, and the @budibase/server package had 20,020 weekly npm downloads. Its last published npm version is 3.38.1.

Check the running version from the container and the package inside it:

docker inspect budibase --format '{{.Config.Image}}'
docker exec budibase sh -c "node -p \"require('/app/packages/server/package.json').version\"" 2>/dev/null

In the Budibase builder, open each query used by a published app and check its execution role. A PUBLIC role on a query that contains a {{ parameter }} key is the exposure.

How do I fix it?

There is no stable Budibase release with the fix as of 2026-11-27. Commit d04b900 is on master and appears in the 4.2.0-cloud.3 and later prereleases. The reliable fix is to remove the PUBLIC execution role until a stable release ships.

  1. Open every published app and every query that uses a request parameter as a JSON key.
  2. Change the query's execution role from PUBLIC to an authenticated role, or remove the query from the published app.
  3. Republish the app and confirm that an unauthenticated request to POST /api/v2/queries/<queryId> now returns 401 instead of data.
  4. If the deployment builds from source, apply commit d04b900 or run master at that commit or later. The only published images that contain it are the v4.2.0-cloud.3 and later prereleases, which are prerelease software.

A second workaround is to reject dangerous keys at the edge. Add a reverse-proxy or web application firewall rule that blocks request bodies to /api/v2/queries/ containing __proto__, prototype or constructor, then test the rule against the advisory's request.

This stops the published payload, but it does not repair the enrichment code, and alternate encodings or keys can slip past a naive filter. Removing the PUBLIC role is the control that closes the path.

What is the root cause?

Budibase enriches a query in two passes. The first pass turns a JSON template such as {"{{ key }}":"fixed"} into an object with the caller's key. The second pass walks that object again and rebuilds it with enrichedQuery[enrichedKey] = .... When the key is __proto__, that assignment invokes the inherited setter instead of creating an own property, so the rebuilt object has no filter at all.

The first pass is in packages/string-templates/src/index.ts at tag 3.44.0. It uses Object.fromEntries, which creates a real own __proto__ data property:

return Object.fromEntries(
  Object.entries(value).map(([key, child]) => [
    processJsonTemplateString(key, context, opts),
    processJsonTemplateValue(child, bindings, context, opts),
  ])
)

The second pass is enrichJsonValue() in packages/server/src/sdk/workspace/queries/queries.ts at tag 3.44.0, lines 69 to 81:

const enrichedQuery: Record<string, JSONValue> = {}
for (const key of Object.keys(value)) {
  const fieldValue = value[key]
  if (fieldValue == null) {
    continue
  }
  const enrichedKey = processTemplateString(key, parameters, options)
  enrichedQuery[enrichedKey] = enrichJsonValue(
    fieldValue,
    parameters,
    options
  )
}
return enrichedQuery

enrichedQuery is a normal object, so it inherits Object.prototype. Assigning to enrichedQuery["__proto__"] calls the __proto__ setter, which changes the object's prototype and creates no enumerable property. The function then returns {}. enrichContextObject() repeats the same pattern for the outer query fields at lines 90 to 108.

The empty object reaches the MongoDB adapter unchanged. In packages/server/src/integrations/mongodb.ts at tag 3.44.0, find calls collection.find(json), updateMany calls collection.updateMany(json.filter, ...) and deleteMany calls collection.deleteMany(json.filter, ...). MongoDB treats {} as a filter that matches every document in the collection.

The request reaches that code without a session because of the authorization middleware. packages/server/src/middleware/authorized.ts at tag 3.44.0, lines 141 to 155, returns next() for a PUBLIC resource before it checks ctx.isAuthenticated and before CSRF enforcement:

if (
  !isInternalTable &&
  (resourceRoles.includes(roles.BUILTIN_ROLE_IDS.PUBLIC) ||
    (otherLevelRoles &&
      otherLevelRoles.includes(roles.BUILTIN_ROLE_IDS.PUBLIC)))
) {
  return next()
}

if (!ctx.isAuthenticated) {
  return ctx.throw(401, "Session not authenticated")
}

The flaw was introduced by pull request 18987, merged on 2026-06-16 as commit ee39be01e5b4, which added supported dynamic keys to MongoDB query templates. The advisory records that the behavior is present from 3.39.18.

How is it exploited?

An attacker needs the published app ID and a PUBLIC query ID. Both are visible in the requests the published app makes, so no account is required.

  1. Create or find a published app whose MongoDB query uses a request parameter as a JSON key and has the PUBLIC execution role.
  2. Send a request to the query endpoint with the parameter set to __proto__.
  3. The first enrichment pass creates an own __proto__ property. The second pass assigns that key onto a normal object, so the setter runs and the filter becomes {}.
  4. The adapter passes {} to find, updateMany or deleteMany, and MongoDB applies the operation to every document in the configured collection.
  5. The response returns the matching documents, or reports the number of modified or deleted documents.

The advisory publishes a proof of concept against a local instance with three canary documents. This is the request, trimmed to the essential headers:

curl -i -X POST "http://127.0.0.1:<LOCAL_PORT>/api/v2/queries/<READ_QUERY_ID>" \
  -H "x-budibase-app-id: <PUBLISHED_APP_ID>" \
  -H "Content-Type: application/json" \
  --data-raw '{"parameters":{"key":"__proto__"}}'

The advisory also gives the structured updateMany and deleteMany bodies. It states that the single-JSON object-backed form is confirmed and does not claim the same result for the legacy multi-object string format.

How does the attack flow?

The attack is one unauthenticated request: the PUBLIC role skips the session check, the second enrichment pass drops the filter, and MongoDB applies an empty filter to the whole collection.

flowchart LR A["POST /api/v2/queries/:id
key = __proto__"] --> B["PUBLIC role: no session check"] B --> C["First pass: own __proto__ property"] C --> D["Second pass: enrichedQuery[__proto__] assignment"] D --> E["Inherited setter runs: filter becomes {}"] E --> F["MongoDB find / updateMany / deleteMany"] F --> G["Every document read, changed or deleted"]

What can an attacker do?

An unauthenticated attacker can read, modify or delete every document in the collection that the vulnerable query addresses. The exact impact depends on the query verb and on which PUBLIC queries the builder published.

  • A PUBLIC find query discloses every document in its collection, including fields the stored predicate was meant to hide.
  • A PUBLIC updateMany query modifies every document, and the response reports the matched and modified counts.
  • A PUBLIC deleteMany query deletes every document in the collection.

The conditions are specific, and each one matters:

  • The query must be exposed to a published app with the PUBLIC execution role. A query with an authenticated role does not reach the vulnerable path anonymously.
  • The query must use a request parameter as a JSON key. A query with only literal keys never produces the __proto__ assignment.
  • The caller must know the app ID and query ID. Both are disclosed to clients of the published app.
  • Recaptcha must be disabled for query execution, or the attacker must satisfy it.
  • The impact is limited to the collection the query selects. The advisory does not claim arbitrary collection selection.

The advisory does not report exploitation in the wild, and the CVE is not in CISA KEV as of 2026-11-27. The proof of concept is public in the advisory, so reproduction is straightforward on an exposed instance.

Why does the fix work?

The fix creates the property with Object.defineProperty instead of assigning it. defineProperty defines an own data property even when the key is __proto__, so the filter survives the second pass and MongoDB receives the predicate the builder stored.

Commit d04b900 adds a setJsonKey() helper and uses it in both enrichment paths. The diff is against the master branch, where enrichJsonValue() already takes a fourth path argument; the 3.44.0 code shown in the root cause does not have it yet:

+const setJsonKey = (
+  target: Record<string, JSONValue>,
+  key: string,
+  value: JSONValue
+) => {
+  Object.defineProperty(target, key, {
+    value,
+    enumerable: true,
+    writable: true,
+    configurable: true,
+  })
+}
+
@@
-    enrichedQuery[enrichedKey] = enrichJsonValue(
-      fieldValue,
-      parameters,
-      options,
-      [...path, enrichedKey]
+    setJsonKey(
+      enrichedQuery,
+      enrichedKey,
+      enrichJsonValue(fieldValue, parameters, options, [...path, enrichedKey])
     )

The same change covers enrichContextObject(). The commit adds regression tests that require a dynamic __proto__ filter to survive enrichment and a public query to return no rows for the magic key.

The fix is narrow and complete for this path. It does not add a general dangerous-key denylist, and it does not change the PUBLIC authorization shortcut. A future dynamic-key sink that assigns onto a normal object would need the same treatment.

How do I check if I was compromised?

No indicators of compromise are published for this issue. A successful request looks like an ordinary query execution, and Budibase may record only the query ID and the caller's address.

Check the reverse-proxy or application logs for POST requests to /api/v2/queries/ whose body contains __proto__, prototype or constructor. Body logging is often disabled, so also review Budibase's query execution records. Look for PUBLIC queries that returned unusually large result sets or reported a matched count equal to the collection size.

The default nginx access log records the request line, not the body, so a __proto__ payload never appears there. If your reverse proxy logs request bodies (for example, an nginx log format that includes $request_body), search that log:

grep -Ei '(__proto__|prototype|constructor)' /var/log/nginx/body_access.log

A hit is a lead, not proof, because a legitimate client can send the word in a parameter value. Compare the request time with the query's stored predicate and with the collection's document count. If body logging is off, an attempt that succeeded leaves no request-body record.

Timeline

  • 2026-06-16: Budibase pull request 18987 adds supported dynamic JSON keys to MongoDB query templates, introducing the flaw.
  • 2026-11-10: The vendor advisory GHSA-x4w8-596q-fmh7 is published and lists 4.0.0 as the patched version.
  • 2026-11-23: Commit d04b900 adds Object.defineProperty and the regression tests, after the v4.1.0 release.
  • 2026-11-26: The CVE record for CVE-2026-137498 is published.

The fix landed after the 4.1.0 release, so no stable build carried it
Figure 1: The regression was introduced on 2026-06-16, the advisory was published on 2026-11-10, and the public fix commit landed on 2026-11-23. Source: Budibase pull request 18987, GHSA-x4w8-596q-fmh7, commit d04b900 and CVE-2026-137498, checked November 27, 2026

FAQ

Is Budibase Cloud affected?

The advisory covers the server code and does not list a separate status for the hosted service. The 4.2.0-cloud.3 and later prereleases contain the fix, so ask Budibase which build your cloud tenant runs.

Does this affect every Budibase query?

No. The query must be PUBLIC, must use a request parameter as a JSON key, and must run against a MongoDB datasource. A query with literal keys or an authenticated role is not on this path.

Is this the same as CVE-2026-54350?

No. CVE-2026-54350 covered quote-breaking injection in parameter values and was fixed before 3.39.18. This flaw was introduced by the dynamic-key feature added after that fix, and it uses only the literal __proto__ key.

Which MongoDB operations can the attacker reach?

The operation of the vulnerable query. A find query discloses documents, an updateMany query changes them and a deleteMany query deletes them. The attacker cannot switch the verb.

Is there a fixed release I can install today?

No stable release carries the fix as of 2026-11-27. Commit d04b900 is on master and in the v4.2.0-cloud.3 and later prereleases. Remove the PUBLIC execution role until a stable release ships.

Was CVE-2026-137498 exploited in the wild?

No exploitation is known, and the CVE is not in CISA KEV as of 2026-11-27. The advisory publishes a working proof of concept, so an exposed PUBLIC query is easy to test.

References

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog