DbGate `loadReader` `functionName` Injection RCE (CVE-2026-48017)
by romain-deperne · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-48017 / GHSA-hv83-ggc4-v385
- Category
- web
- Affected product
- DbGate (dbgate-api), a web-based database management GUI
- Affected versions
- <= 7.1.8 (fixed in 7.1.9)
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | romain-deperne |
| CVE / Advisory | CVE-2026-48017 / GHSA-hv83-ggc4-v385 |
| Category | web |
| Severity | High |
| CVSS Score | 8.8 (per upstream advisory) |
| Status | PoC |
| Tags | dbgate, nodejs, code-injection, rce, cwe-94, authenticated, database-gui |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | DbGate (dbgate-api), a web-based database management GUI |
| Versions Affected | <= 7.1.8 (fixed in 7.1.9) |
| Language / Platform | Node.js / JavaScript (TypeScript) server; PoC written in Python |
| Authentication Required | Yes (any authenticated user, no special permission needed) |
| Network Access Required | Yes |
Summary
DbGate’s POST /runners/load-reader endpoint takes a functionName parameter and concatenates it directly into a JavaScript template string that is later executed in a forked runner process, without sanitization or validation. An authenticated attacker can break out of the intended dbgateApi.<functionName>(...) call expression and inject arbitrary JavaScript. The forked process nominally sandboxes execution by setting require = null, but this is trivially bypassed via Node’s internal process.binding("spawn_sync"), which still allows spawning real OS processes, yielding remote code execution.
Vulnerability Details
Root Cause
compileShellApiFunctionName() (packages/tools/src/packageTools.ts:33) builds a fully-qualified API call string as `dbgateApi.${functionName}` without validating that functionName is a safe identifier. This string is interpolated into a loader script template in runners.js:64 (`const reader = await ${compileShellApiFunctionName(functionName)}(${JSON.stringify(props)});`) which is then executed in a forked process. Unlike the sibling start() runner, which gates execution behind testStandardPermission('run-shell-script') and platformInfo.allowShellScripting, loadReader() performs no such checks.
Attack Vector
- Attacker authenticates to a DbGate instance as any regular user (no elevated permission required).
- Attacker crafts a
functionNamevalue that closes thedbgateApi.<name>(...)expression early (e.g.toString();<injected JS>//), embedding a call toprocess.binding("spawn_sync").spawn(...). - Attacker sends this payload in a
POST /runners/load-readerrequest. - The server builds and executes the loader script with the injected code, which uses
process.binding("spawn_sync")to spawn/bin/sh -c "<command>", bypassing therequire = nullsandbox restriction. - The shell command executes on the DbGate API host with the server process’s privileges.
Impact
Authenticated remote code execution on the DbGate API host. DbGate is typically deployed with broad network access to internal databases, making this a strong pivot point into an organization’s data tier.
Environment / Lab Setup
Target: DbGate (dbgate-api) <= 7.1.8, reachable HTTP API (default localhost:3000)
Attacker: Python 3 with `requests` (or stdlib urllib), valid low-privilege DbGate account/JWT
Proof of Concept
PoC Script
See
rce_loadreader_functionname_injection.pyin this folder. The upstream writeup is preserved inUPSTREAM_README.md.
| |
The script builds the malicious functionName payload, sends it to POST /runners/load-reader, and the injected spawn_sync call executes the given shell command in the forked runner process on the server.
Detection & Indicators of Compromise
Signs of compromise:
- DbGate API access logs showing
/runners/load-readerrequests with anomalousfunctionNamebodies - Unexpected shell/child processes forked from the DbGate Node.js runner process
- Files or output artifacts created on the DbGate host that correlate with injected shell commands
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade DbGate to 7.1.9 or later, which validates functionName against a strict identifier allow-list before compiling it into the loader script |
| Interim mitigation | Restrict network access to the DbGate API to trusted admins only; disable or closely audit the /runners/load-reader endpoint if upgrading is not immediately possible |
References
- Source repository
- GHSA-hv83-ggc4-v385
- https://nvd.nist.gov/vuln/detail/CVE-2026-48017
Notes
Mirrored from https://github.com/romain-deperne/CVE-2026-48017 on 2026-07-05.
| |