GHSA-726g-59wr-cj4c

Suggest an improvement
Source
https://github.com/advisories/GHSA-726g-59wr-cj4c
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-726g-59wr-cj4c/GHSA-726g-59wr-cj4c.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-726g-59wr-cj4c
Aliases
Published
2026-03-09T16:56:26Z
Modified
2026-03-10T18:46:23Z
Severity
  • 8.6 (High) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N CVSS Calculator
Summary
@budibase/server: Command Injection in PostgreSQL Dump Command
Details

Location: packages/server/src/integrations/postgres.ts:529-531

Description

The PostgreSQL integration constructs shell commands using user-controlled configuration values (database name, host, password, etc.) without proper sanitization. The password and other connection parameters are directly interpolated into a shell command.

Code Reference

    const dumpCommand = `PGPASSWORD="${
      this.config.password
    }" pg_dump --schema-only "${dumpCommandParts.join(" ")}"`

Attack Vector

An attacker who can control database configuration values (e.g., through compromised credentials or configuration injection) can inject shell commands. For example:

  • Password: password"; malicious-command; echo "
  • Database name: db"; rm -rf /; echo "

Impact

  • Remote code execution
  • System compromise
  • Data exfiltration

Recommendation

  1. Use environment variables for sensitive values instead of command-line arguments
  2. Validate and sanitize all configuration values
  3. Use proper escaping for shell arguments
  4. Consider using a PostgreSQL library's native dump functionality instead of shell commands

Example Fix

import { execFile } from "child_process"
import { promisify } from "util"
const execFileAsync = promisify(execFile)

// Use execFile with proper argument handling
const env = {
  ...process.env,
  PGPASSWORD: this.config.password
}

const args = [
  "--schema-only",
  "--host", this.config.host,
  "--port", this.config.port.toString(),
  "--username", this.config.user,
  "--dbname", this.config.database
]

try {
  const { stdout } = await execFileAsync("pg_dump", args, { env })
  return stdout
} catch (error) {
  // Handle error
}
Database specific
{
    "cwe_ids": [
        "CWE-77",
        "CWE-78"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-09T16:56:26Z",
    "nvd_published_at": "2026-03-09T20:16:07Z",
    "severity": "HIGH"
}
References

Affected packages

npm / @budibase/server

Package

Name
@budibase/server
View open source insights on deps.dev
Purl
pkg:npm/%40budibase/server

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
3.23.32

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-726g-59wr-cj4c/GHSA-726g-59wr-cj4c.json"