GHSA-cfqx-f43m-vfh7: @saltcorn/server @saltcorn/server Arbitrary File And Directory Vulnerability
MODERATEGHSA-cfqx-f43m-vfh7 is a MODERATE (CVSS 4.9) @saltcorn/server arbitrary file and directory vulnerability (CWE-548: Exposure of Information Through Directory Listing) affecting @saltcorn/server libraries in the npm ecosystem. The issue involves @saltcorn/server arbitrary file and directory listing when accessing build mobile app results. Remediation is available by upgrading affected packages to version 1.0.0-beta.14.
GHSA-cfqx-f43m-vfh7 at a Glance
Security Impact
CVSS: 4.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N).
How to Fix GHSA-cfqx-f43m-vfh7
To remediate this vulnerability, upgrade all affected @saltcorn/server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @saltcorn/server@1.0.0-beta.14
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @saltcorn/server
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-cfqx-f43m-vfh7, inspect your project dependencies using npm:
npm ls @saltcorn/server
Analyze the terminal output to locate any version of @saltcorn/server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0-beta.14), your application is affected.
Note: The npm ls @saltcorn/server command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-548: Exposure of Information Through Directory Listing, where the product inappropriately exposes a directory listing with an index of all the resources located inside of the directory. In @saltcorn/server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-cfqx-f43m-vfh7 Affected @saltcorn/server Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@saltcorn/server
|
npm |
< 1.0.0-beta.14
|
1.0.0-beta.14
|
References
Frequently Asked Questions
What is GHSA-cfqx-f43m-vfh7?
Which @saltcorn/server versions are affected?
What version fixes GHSA-cfqx-f43m-vfh7?
Is @saltcorn/server affected?
What is the CVSS score of GHSA-cfqx-f43m-vfh7?
What CWE is associated with GHSA-cfqx-f43m-vfh7?
How can I check npm dependencies for GHSA-cfqx-f43m-vfh7?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cfqx-f43m-vfh7",
"modified" : "2024-10-03T19:46:43Z",
"published" : "2024-10-03T19:46:42Z",
"aliases" : [ ],
"summary" : "@saltcorn/server arbitrary file and directory listing when accessing build mobile app results",
"details" : "### Summary\n\nA user with admin permission can read arbitrary file and directory names on the filesystem by calling the `admin/build-mobile-app/result?build_dir_name=` endpoint. The `build_dir_name` parameter is not properly validated and it's then used to construct the `buildDir` that is read. The file/directory names under the `buildDir` will be returned. \n\n### Details\n\n- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/routes/admin.js#L2884-L2893\n\n```js\nrouter.get(\n \"/build-mobile-app/result\",\n isAdmin,\n error_catcher(async (req, res) => {\n const { build_dir_name } = req.query; // [1] source\n const rootFolder = await File.rootFolder();\n const buildDir = path.join(\n rootFolder.location,\n \"mobile_app\",\n build_dir_name // [2]\n );\n const files = await Promise.all(\n fs\n .readdirSync(buildDir) // [3] sink\n .map(async (outFile) => await File.from_file_on_disk(outFile, buildDir))\n );\n [...]\n })\n);\n```\n\n### PoC\n\n- log into the application as an admin user\n- visit the following url: `http://localhost:3000/admin/build-mobile-app/result?build_dir_name=/../../../../../../../../`\n\n\n**NOTE**: it's possible to only see file and directory names but not to download their content.\n\n### Impact\n\nInformation disclosure\n\n### Recommended Mitigation\n\nResolve the `buildDir` and check if it starts with `${rootFolder.location}/mobile_app`.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@saltcorn/server"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.0-beta.14"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.0.0-beta.13"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/saltcorn/saltcorn/security/advisories/GHSA-cfqx-f43m-vfh7"
}, {
"type" : "WEB",
"url" : "https://github.com/saltcorn/saltcorn/commit/81adaf78430a9b59804894574d67d2a0c7bb3dc5"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/saltcorn/saltcorn"
}, {
"type" : "WEB",
"url" : "https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/routes/admin.js#L2884-L2893"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-548" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-03T19:46:42Z",
"nvd_published_at" : null
}
}