GHSA-qqf5-x7mj-v43p: budibase SQL Injection Vulnerability

HIGH
CVSS 8.4
CWE-89
Published
Advisory Summary

GHSA-qqf5-x7mj-v43p is a HIGH (CVSS 8.4) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting budibase libraries in the npm ecosystem. The issue involves database connector sql injections in postgresql, ms sql, and mysql. Remediation is available by upgrading affected packages to version 3.39.19.

GHSA-qqf5-x7mj-v43p at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qqf5-x7mj-v43p
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product budibase
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix GHSA-qqf5-x7mj-v43p

To remediate this vulnerability, upgrade all affected budibase dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

budibase fixed: 3.39.19
npm install budibase@3.39.19
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls budibase

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-qqf5-x7mj-v43p, inspect your project dependencies using npm:

npm ls budibase

Analyze the terminal output to locate any version of budibase in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.39.19), your application is affected.

Note: The npm ls budibase command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In budibase, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 AS SELECT usename, passwd FROM pg_shadow; --` 3. Save or trigger a connection test. 4. The query executes as: `SET search_path TO "public"; CREATE TABLE pwned AS SELECT usename, passwd FROM pg_shadow; --;` 5. PostgreSQL executes both statements. ### Impact - Full database compromise. The attacker can read `pg_shadow` hashes, call `pg_read_file()`, or execute any DDL/DML. --- ### Vulnerability Type & Title **Microsoft SQL Server Schema Introspection SQL Injection** ### Description & Root Cause Three methods used during schema introspection (`buildSchema`) interpolate user-controlled values directly into SQL strings using single-quote delimiters with no escaping. **Vulnerable Code:** **File:** `packages/server/src/integrations/microsoftSqlServer.ts`, lines 388–414 ```typescript getDefinitionSQL(tableName: string, schemaName: string) { return `select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='${tableName}' AND TABLE_SCHEMA='${schemaName}'` } ``` `schemaName` comes directly from `this.config.schema` (user config). ### Step-by-Step Reproduction 1. Edit an MS SQL Server datasource configuration. 2. Set the schema field to: `dbo'; EXEC xp_cmdshell('whoami'); --` 3. Trigger schema introspection (fetch tables). 4. The OS command executes on the SQL server if `xp_cmdshell` is enabled. ### Impact - Arbitrary SQL execution, potentially leading to OS command execution via `xp_cmdshell`. --- ### Vulnerability Type & Title **MySQL `multipleStatements: true` + `DESCRIBE` Backtick Injection** ### Description & Root Cause The MySQL integration enables `multipleStatements: true`, allowing semicolon-separated multi-statement execution. When introspecting tables, table names are interpolated into a `DESCRIBE` query wrapped in backticks, but the backticks are not escaped. **Vulnerable Code:** **File:** `packages/server/src/integrations/mysql.ts`, lines 172, 305 ```typescript this.config = { ...config, multipleStatements: true, ... } // line 172 ... { sql: `DESCRIBE \`${tableName}\`;` } // line 305 — backtick NOT escaped ``` ### Step-by-Step Reproduction 1. An attacker (or malicious database user) creates a table named ``foo`; DROP TABLE users; --``. 2. In Budibase, an admin triggers schema introspection for the database. 3. Budibase reads the malicious table name from `INFORMATION_SCHEMA.TABLES` and inserts it into the `DESCRIBE` query. 4. The backtick breaks out, and the secondary `DROP TABLE` payload executes. ### Impact - Arbitrary SQL execution triggered during schema discovery. Requires prior database catalog manipulation.

GHSA-qqf5-x7mj-v43p Affected budibase Versions

1 component(s)
Fixed Versions:
3.39.19
Product / Package Ecosystem Affected Versions Fixed Version
budibase
npm
< 3.39.19
3.39.19

References

Frequently Asked Questions

What is GHSA-qqf5-x7mj-v43p?
GHSA-qqf5-x7mj-v43p is a security vulnerability in budibase involving Database Connector SQL Injections in PostgreSQL, MS SQL, and MySQL under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which budibase versions are affected?
Affected versions include releases prior to 3.39.19 across affected packages: budibase.
What version fixes GHSA-qqf5-x7mj-v43p?
Upgrading to 3.39.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is budibase affected?
Yes, budibase is affected in releases prior to 3.39.19. Upgrade your dependency to 3.39.19 or later.
What is the CVSS score of GHSA-qqf5-x7mj-v43p?
GHSA-qqf5-x7mj-v43p has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with GHSA-qqf5-x7mj-v43p?
GHSA-qqf5-x7mj-v43p is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check npm dependencies for GHSA-qqf5-x7mj-v43p?
Run the dependency tree command: 'npm ls budibase'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qqf5-x7mj-v43p",
  "modified" : "2026-06-18T17:24:47Z",
  "published" : "2026-06-18T17:24:47Z",
  "aliases" : [ ],
  "summary" : "budibase: Database Connector SQL Injections in PostgreSQL, MS SQL, and MySQL",
  "details" : "### Summary\nThis 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`).\n\n### Details\n\n### Vulnerability Type & Title\n**PostgreSQL `SET search_path` SQL Injection**\n\n### Description & Root Cause\nThe `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.\n\n**Vulnerable Code:**\n**File:** `packages/server/src/integrations/postgres.ts`, lines 355–358\n\n```typescript\nconst search_path = this.config.schema\n  .split(\",\")\n  .map(item => `\"${item.trim()}\"`)                // NO escaping of embedded \"\nawait this.client.query(`SET search_path TO ${search_path.join(\",\")};`)\n```\n\n`node-postgres` sends this via the **simple query protocol**, which supports multi-statement execution with semicolons.\n\n### Step-by-Step Reproduction\n1. Edit a PostgreSQL datasource configuration.\n2. Set the schema field to:\n   `public\"; CREATE TABLE pwned AS SELECT usename, passwd FROM pg_shadow; --`\n3. Save or trigger a connection test.\n4. The query executes as:\n   `SET search_path TO \"public\"; CREATE TABLE pwned AS SELECT usename, passwd FROM pg_shadow; --;`\n5. PostgreSQL executes both statements.\n\n### Impact\n- Full database compromise. The attacker can read `pg_shadow` hashes, call `pg_read_file()`, or execute any DDL/DML.\n\n---\n\n### Vulnerability Type & Title\n**Microsoft SQL Server Schema Introspection SQL Injection**\n\n### Description & Root Cause\nThree methods used during schema introspection (`buildSchema`) interpolate user-controlled values directly into SQL strings using single-quote delimiters with no escaping.\n\n**Vulnerable Code:**\n**File:** `packages/server/src/integrations/microsoftSqlServer.ts`, lines 388–414\n\n```typescript\ngetDefinitionSQL(tableName: string, schemaName: string) {\n  return `select * from INFORMATION_SCHEMA.COLUMNS\n          where TABLE_NAME='${tableName}' AND TABLE_SCHEMA='${schemaName}'`\n}\n```\n\n`schemaName` comes directly from `this.config.schema` (user config).\n\n### Step-by-Step Reproduction\n1. Edit an MS SQL Server datasource configuration.\n2. Set the schema field to: `dbo'; EXEC xp_cmdshell('whoami'); --`\n3. Trigger schema introspection (fetch tables).\n4. The OS command executes on the SQL server if `xp_cmdshell` is enabled.\n\n### Impact\n- Arbitrary SQL execution, potentially leading to OS command execution via `xp_cmdshell`.\n\n---\n\n### Vulnerability Type & Title\n**MySQL `multipleStatements: true` + `DESCRIBE` Backtick Injection**\n\n### Description & Root Cause\nThe MySQL integration enables `multipleStatements: true`, allowing semicolon-separated multi-statement execution. When introspecting tables, table names are interpolated into a `DESCRIBE` query wrapped in backticks, but the backticks are not escaped.\n\n**Vulnerable Code:**\n**File:** `packages/server/src/integrations/mysql.ts`, lines 172, 305\n\n```typescript\nthis.config = { ...config, multipleStatements: true, ... }  // line 172\n...\n{ sql: `DESCRIBE \\`${tableName}\\`;` }  // line 305 — backtick NOT escaped\n```\n\n### Step-by-Step Reproduction\n1. An attacker (or malicious database user) creates a table named ``foo`; DROP TABLE users; --``.\n2. In Budibase, an admin triggers schema introspection for the database.\n3. Budibase reads the malicious table name from `INFORMATION_SCHEMA.TABLES` and inserts it into the `DESCRIBE` query.\n4. The backtick breaks out, and the secondary `DROP TABLE` payload executes.\n\n### Impact\n- Arbitrary SQL execution triggered during schema discovery. Requires prior database catalog manipulation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "budibase"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.39.19"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Budibase/budibase/security/advisories/GHSA-qqf5-x7mj-v43p"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Budibase/budibase"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-18T17:24:47Z",
    "nvd_published_at" : null
  }
}