Skip to main content

Budibase CVE-2026-45719

| EUVDEUVD-2026-32599 MEDIUM
Code Injection (CWE-94)
2026-05-18 https://github.com/Budibase/budibase GHSA-363w-hvwh-w7m6
6.5
CVSS 3.1 · GitHub Advisory
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate with Builder-role session
  2. Delivery
    Send crafted POST /api/views with malicious calculation payload
  3. Exploit
    Budibase saves injected JavaScript as CouchDB design document reduce field
  4. Execution
    Query the crafted view to trigger reduce evaluation
  5. Persist
    CouchDB SpiderMonkey engine executes injected function
  6. Impact
    Exfiltrate document data via view query response

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The attacker must hold an authenticated Budibase session with Builder role permissions - Builder is a named application role granting significant access including view creation. Exploitation requires submitting a POST request to the /api/views V1 endpoint with a calculation value that is not one of the three valid built-ins (sum, count, stats). The injected code does not execute at submission time - a second step is required: the crafted view must be queried (GET /api/views/<name>?group=true) to trigger CouchDB reduce evaluation. Execution is bounded to CouchDB's SpiderMonkey sandbox: filesystem access, outbound network connections, and OS-level commands are not accessible. The V2 endpoint (POST /api/v2/views) is not affected due to its Joi validation path. Non-default configurations are not required - any Budibase deployment running a vulnerable server version with at least one Builder-role account is susceptible.

Impact

CVSS 6.5 with vector AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N accurately reflects the primary limiting factor: PR:H requires the attacker to already possess Builder-level access, which is a meaningful authentication barrier that significantly constrains the real-world attack surface compared to unauthenticated or low-privilege vectors. S:U (scope unchanged) and the advisory's explicit statement that CouchDB's sandbox blocks filesystem and network access confirm this is not OS-level RCE. The C:H and I:H impact ratings reflect that document data across the database is accessible and injectable via the reduce context, which is serious for multi-tenant deployments. EPSS data was not provided in the input and cannot be assessed. No KEV listing is confirmed, and no public exploit repository was cited - however, the advisory includes step-by-step reproduction curl commands, meaning practical exploitation requires minimal skill for anyone already holding Builder credentials. This vulnerability is best treated as an insider-threat or post-initial-access escalation risk rather than an external perimeter risk.

Exploit ScenarioDerived

An authenticated Budibase user with Builder role submits a POST /api/views request with a calculation value containing a crafted JavaScript function string (e.g., stats"); } function(keys,values,rereduce){ return values; } //). Budibase saves this as the reduce field in a CouchDB design document without validation. When the view is subsequently queried - by the attacker or any user - CouchDB's SpiderMonkey engine executes the injected function, returning document field values from the reduce context to the caller, enabling database content exfiltration. The advisory includes working curl-based reproduction steps, making this exploitable by any Builder-role user without advanced tooling.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 18, 2026

CouchDB reduce injection in Budibase's V1 Views API (POST /api/views) allows authenticated Builder-role users to embed arbitrary JavaScript into CouchDB design document reduce functions via the unsanitized calculation parameter, resulting in code execution within CouchDB's SpiderMonkey sandbox on every subsequent view query. Affected versions are all releases of @budibase/server prior to 3.38.1, confirmed by GHSA-363w-hvwh-w7m6. No public exploit has been identified at time of analysis, and no CISA KEV listing exists, though the advisory includes detailed reproduction steps that substantially lower the exploitation barrier for users who already hold Builder privileges.

RemediationAI

Upgrade @budibase/server to version 3.38.1 or later. This release includes the security commit '[Security] Validate legacy view calculations' (PR #18759) which adds an allowlist check - validating calculation against ["sum", "count", "stats"] before interpolation - and is available at https://github.com/Budibase/budibase/releases/tag/3.38.1. The full advisory with fix guidance is at https://github.com/Budibase/budibase/security/advisories/GHSA-363w-hvwh-w7m6. For deployments that cannot patch immediately, restrict the Builder role to fully trusted internal personnel only, as this is the sole prerequisite for exploitation. Additionally, consider blocking external access to the POST /api/views endpoint at the network perimeter or API gateway layer; note this will prevent legitimate Builder users from creating V1 views remotely and may require internal workflow adjustments. Adding a Joi validator to the V1 route matching the V2 endpoint's viewValidator() is also recommended as a defense-in-depth measure alongside patching.

Affected VersionsENISA

budibase < 3.38.1

Affected Packages

npm @budibase/server fix: 3.38.1
euvd budibase fix: 3.38.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The affected component is the npm package @budibase/server, specifically viewBuilder.ts (line 213) and the V1 route handler in view.ts (line 45). CouchDB design documents support reduce functions in two modes: built-in aliases prefixed with underscore (e.g., _sum, _count, _stats) executed as native C reducers, and arbitrary JavaScript strings evaluated by CouchDB's embedded SpiderMonkey engine. The vulnerable interpolation reduce: \_${calculation}\`` passes user input directly into this field without validation. When the submitted value does not match a known built-in, CouchDB treats the full string as a JavaScript function and evaluates it during view queries. CWE-94 (Improper Control of Generation of Code) is the correct root cause classification - user-controlled data flows into a code execution context without sanitization. Notably, the map function path in the same file is correctly hardened using JSON.stringify and a TOKEN_MAP allowlist; only the reduce path was left unprotected. The V2 endpoint (POST /api/v2/views) uses Joi schema validation via viewValidator() and is not affected.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

GitHub Advisory PRIMARY 6.5 MEDIUM
AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

Attack Vector
Network
Attack Complexity
Low
Privileges Required
High
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

DescriptionGitHub Advisory

Security Advisory: CouchDB Reduce Injection via Unsanitized Calculation Parameter in V1 Views API

Affected Software: Budibase Affected Component: packages/server/src/api/controllers/view/viewBuilder.ts, packages/server/src/api/routes/view.ts CWE: CWE-94 (Improper Control of Generation of Code) Discovery Date: 2026-03-24

---

Summary

The V1 Views API (POST /api/views) accepts a calculation parameter from the request body that is interpolated directly into a CouchDB reduce function definition without validation. Although an internal SCHEMA_MAP object defines the valid calculation types (sum, count, stats), no actual validation is performed against this map before the value is used in string interpolation.

A user with Builder permissions can inject arbitrary JavaScript code that will be executed within the CouchDB JavaScript engine when the view is queried.

---

Affected Component

Route: POST /api/views (V1 legacy views endpoint) File: packages/server/src/api/routes/view.ts, line 45

js
.post("/api/views", viewController.v1.save)

Note: This route has no Joi request body validator, unlike the V2 views endpoint which uses viewValidator().

Vulnerable code: packages/server/src/api/controllers/view/viewBuilder.ts, line 213

js
const reduction = field && calculation ? { reduce: `_${calculation}` } : {}

return {
  meta: { field, tableId, groupBy, filters, schema, calculation, ... },
  map: `function (doc) { ... }`,
  ...reduction,    // <-- unvalidated calculation string becomes CouchDB reduce
}

---

Vulnerability Detail

The viewBuilder function constructs a CouchDB design document view definition. It correctly sanitizes all inputs that flow into the map function string (using JSON.stringify for field names and a strict TOKEN_MAP allowlist for filter operators).

However, the calculation parameter follows a different path:

  1. User submits calculation via POST /api/views request body
  2. No Joi validator is present on this V1 route
  3. viewBuilder receives calculation as a raw string
  4. It is interpolated as: ` reduce: _${calculation} `
  5. This reduce definition is saved to a CouchDB design document
  6. When the view is queried, CouchDB evaluates the reduce value

CouchDB's behavior for reduce functions:

  • Values starting with _ followed by a known built-in (_sum, _count, _stats) are executed as native reducers
  • Any other value is treated as a JavaScript function string and executed in CouchDB's SpiderMonkey JS engine

The SCHEMA_MAP object in the same file defines sum, count, and stats as valid keys, but this map is only used for schema construction - it is never used as an input validator for the calculation parameter.

---

Steps to Reproduce

Prerequisites: Authenticated session with Builder role permissions.

1. Send a crafted view creation request:

bash
curl -X POST https://<budibase-instance>/api/views \
  -H "Content-Type: application/json" \
  -H "Cookie: <builder-session-cookie>" \
  -d '{
    "name": "test_view",
    "tableId": "<valid-table-id>",
    "field": "amount",
    "calculation": "stats\"); } function(keys,values,rereduce){ var data = \"\"; for(var i in this) { data += i + \"=\" + this[i] + \",\"; } return data; } //"
  }'

2. Query the created view:

bash
curl https://<budibase-instance>/api/views/test_view?group=true \
  -H "Cookie: <builder-session-cookie>"

3. Expected result: The injected JavaScript function executes in CouchDB's JS context during reduce evaluation. The function can:

  • Enumerate objects available in the CouchDB sandbox
  • Access document data from the reduce values parameter
  • Return arbitrary data in the view response

Simplified test: To verify the injection point without complex payloads:

json
{
  "name": "calc_test",
  "tableId": "<valid-table-id>",
  "field": "amount",
  "calculation": "INVALID_NOT_A_BUILTIN"
}

This produces reduce: "_INVALID_NOT_A_BUILTIN". CouchDB will reject this as neither a valid built-in nor a valid function, confirming that arbitrary strings reach the reduce evaluator.

---

Impact

  • Code execution: Arbitrary JavaScript runs in CouchDB's SpiderMonkey sandbox
  • Data access: The reduce function receives all matching document values, allowing data exfiltration across the database
  • Scope limitation: CouchDB's JS sandbox prevents filesystem or network access - this is not OS-level RCE
  • Authentication required: Attacker must have Builder role, which already grants significant application access
  • Persistence: The injected reduce function persists in the design document and executes on every view query

---

Recommended Fix

Add an allowlist validation in viewBuilder before the reduce interpolation:

typescript
const VALID_CALCULATIONS = ["sum", "count", "stats"];

if (calculation && !VALID_CALCULATIONS.includes(calculation)) {
  throw new Error(`Invalid calculation type: ${calculation}`);
}

const reduction = field && calculation ? { reduce: `_${calculation}` } : {};

Additionally, add a Joi validator to the V1 views route to match the V2 endpoint:

typescript
// In packages/server/src/api/routes/view.ts
.post("/api/views", v1ViewValidator(), viewController.v1.save)

---

Additional Context

The V2 views API (POST /api/v2/views) uses viewValidator() with Joi schema validation and a separate calculation handling path. This finding is specific to the V1 legacy endpoint which lacks equivalent input validation.

The map function string in the same code is properly protected - all user inputs reaching it are escaped via JSON.stringify() or validated against a strict TOKEN_MAP allowlist. Only the reduce path is affected.

Threat Intelligence Overview

EPSS Score
0.0%
Top 93% exploitable
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

32
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy