{"answers":{"affected":"2 open source packages ship an affected version, including @saltcorn/server.","exploited":"There is no known exploitation of GHSA-cfqx-f43m-vfh7 in the wild and no public exploit code.","fix":"Upgrade @saltcorn/server to 1.0.0-beta.14 or later.","what":"GHSA-cfqx-f43m-vfh7 is a path traversal vulnerability in @saltcorn/server, published on 3 Oct 2024. An attacker needs administrator access to exploit it, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-cfqx-f43m-vfh7 and fix it if it is affected.\n\nWhat it is: GHSA-cfqx-f43m-vfh7 is a path traversal vulnerability in @saltcorn/server, published on 3 Oct 2024. An attacker needs administrator access to exploit it, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-cfqx-f43m-vfh7 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @saltcorn/server (npm): affected all versions; fixed in 1.0.0-beta.14\n- @saltcorn/server (npm): affected all versions; fixed in 1.0.0-beta.14\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-cfqx-f43m-vfh7/ (Markdown: https://insights.sbomify.com/GHSA-cfqx-f43m-vfh7/index.md)","id":"GHSA-cfqx-f43m-vfh7","markdown":"https://insights.sbomify.com/GHSA-cfqx-f43m-vfh7/index.md","name":"GHSA-cfqx-f43m-vfh7","record":{"aliases":[],"analysis":{"component_type":"web_application","fix_type":"patch","impacts":["data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"Saltcorn server","requires_auth":"high_privilege","summary":"An admin user can list arbitrary files and directories on the server via path traversal in the mobile app build endpoint.","user_interaction":"not_required","vuln_class":"path_traversal"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### 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) =\u003e {\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) =\u003e 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**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`.","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"@saltcorn/server arbitrary file and directory listing when accessing build mobile app results","id":"GHSA-cfqx-f43m-vfh7","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"path_traversal","year":"2024"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["1.0.0-beta.14"],"introduced":["0"],"last_affected":[],"package":"@saltcorn/server","purl":null,"source":"GHSA-cfqx-f43m-vfh7"},{"ecosystem":"npm","fixed":["1.0.0-beta.14"],"introduced":["0"],"last_affected":[],"package":"@saltcorn/server","purl":"pkg:npm/%40saltcorn/server","source":"GHSA-cfqx-f43m-vfh7"}],"products":null,"published":"2024-10-03","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"An admin user can list arbitrary files and directories on the server via path traversal in the mobile app build endpoint.","url":"https://insights.sbomify.com/GHSA-cfqx-f43m-vfh7/"}