mcp-sanitizer file path sanitizer allows arbitrary absolute paths in the user's home directory
mcp-sanitizer: File Path Sanitizer Permits Arbitrary User-Home Absolute Paths
The GitHub Security Advisory (GHSA-7w82-6f9j-v9jp) discloses that versions of the npm package mcp-sanitizer before 1.4.0 have an improper path restriction vulnerability (CWE-22): its file path validation includes /home/ and /Users/ among the allowed absolute path prefixes, and paths such as /home/alice/.ssh/id_rsa and /home/alice/.aws/credentials return blocked=false when validated by sanitize(). In applications that integrate this library to validate paths for MCP file_reader/file_writer tools, if they trust the returned path and perform reads or writes, an unauthenticated remote attacker can use a single HTTP POST request to read sensitive files such as SSH private keys, AWS credentials, Kubernetes configurations and GPG keys in the user's home directory; dynamic reproduction confirmed the exfiltration of simulated SSH private keys and AWS credentials.
The advisory includes complete call-chain localization and Docker reproduction steps, which teams that integrate mcp-sanitizer to validate MCP file tool paths can use to check for affected versions.