budibase: Database Connector SQL Injections in PostgreSQL, MS SQL, and MySQL
Date: 2026-06
Affected: npm/budibase
Attack vector: sql-injection
Category: vulnerability-disclosure
Severity: High
CWE: CWE-89
CVSS: 8.4 (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H)

### Summary This advisory covers three distinct SQL Injection vulnerabilities within Budibase's database connectors (PostgreSQL, Microsoft SQL Server, and MySQL). Because user-controlled schema and table configurations are interpolated directly into raw SQL queries without proper escaping or parameterization during database introspection, an authenticated administrator can break out of string delimiters. This allows for arbitrary DDL/DML execution, database compromise, and potential underlying OS command execution (e.g., via MS SQL `xp_cmdshell`). ### Details ### Vulnerability Type & Title **PostgreSQL `SET search_path` SQL Injection** ### Description & Root Cause The `schema` datasource config field is interpolated directly into a raw SQL statement without proper escaping. Double quotes inside the schema name are not escaped, allowing an attacker to break out of the string literal and inject arbitrary SQL. **Vulnerable Code:** **File:** `packages/server/src/integrations/postgres.ts`, lines 355–358 ```typescript const search_path = this.config.schema .split(",") .map(item => `"${item.trim()}"`) // NO escaping of embedded " await this.client.query(`SET search_path TO ${search_path.join(",")};`) ``` `node-postgres` sends this via the **simple query protocol**, which supports multi-statement execution with semicolons. ### Step-by-Step Reproduction 1. Edit a PostgreSQL datasource configuration. 2. Set the schema field to: `public"; CREATE TABLE pwned


Mitigations:

Architectural layers (MAESTRO):