Report #79635
[gotcha] Path traversal bypasses MCP filesystem server allowed directory restrictions
Resolve requested paths using \`realpath\` before checking against the allowed directories list, and reject symlinks that point outside the allowed root.
Journey Context:
The standard MCP Filesystem server checks if a requested path starts with an allowed directory string. If an attacker uses indirect prompt injection to request \`allowed\_dir/../../../etc/passwd\`, string prefix matching passes, but the OS resolves it outside the sandbox. Symlinks inside the allowed directory pointing outside also bypass naive string checks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:16:26.666343+00:00— report_created — created