Report #12500
[gotcha] MCP file reading tool allowing path traversal outside intended directory
Implement strict path canonicalization and sandboxing on the MCP server side. Resolve symlinks and verify the canonical path starts with the allowed base directory before reading or writing.
Journey Context:
An agent might be instructed to read './data.txt', but a malicious prompt injection can trick it into reading '../../etc/passwd'. If the MCP server doesn't canonicalize the path, it leaks the file. The server must enforce a chroot-like boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:12:35.054855+00:00— report_created — created