All vulnerabilities

npm

GHSA-7w82-6f9j-v9jp

mcp-sanitizer: File Path Sanitizer Permits Arbitrary User-Home Absolute Paths

Severity
High 7.5
Published
28 Oct 2026
Last changed
28 Oct 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.4.0
Weakness
Path traversal (CWE-22)
Attack
Over the network · No login needed · No user action needed
Attacker can
Read data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Sources
OSV.dev and GitHub

Description

mcp-sanitizer v1.3.3 explicitly whitelists /home/ and /Users/ as allowed absolute path prefixes in its file path validation logic (src/utils/validation-utils.js:188-196). As a result, paths such as /home/alice/.ssh/id_rsa and /home/alice/.aws/credentials pass through sanitizer.sanitize() with blocked=false, even though they point to highly sensitive files outside any configured safe root. Any consumer application that trusts the sanitized path and passes it to a filesystem read/write operation (e.g., fs.readFile) will expose arbitrary user-home directory files to an unauthenticated network attacker. Dynamic reproduction confirmed exfiltration of a simulated SSH private key and AWS credentials via a single HTTP POST request.

The vulnerability resides in the validateFilePath function inside src/utils/validation-utils.js. When an absolute path falls outside the configured safe root directories, the function performs a secondary check against a hardcoded allowlist:

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
mcp-sanitizernpm · osv:npm:mcp-sanitizer
  • Every version before 1.4.0

About mcp-sanitizer

Weekly downloads (npm)
384npm, 24 Nov 2026

Vulnerabilities in mcp-sanitizer

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
2
Known exploited
0
Search the list for mcp-sanitizer

References