Report #77060
[gotcha] Path traversal attacks when LLM passes unsanitized file paths to MCP file system tools
Resolve and canonicalize all file paths server-side within the MCP tool, rejecting any path that escapes the explicitly allowed base directories, regardless of what the LLM sends.
Journey Context:
Developers often trust the LLM to construct safe file paths based on user requests. However, an indirect prompt injection can instruct the LLM to pass \`../../etc/passwd\` as the path argument. If the MCP server tool simply appends this to a base directory, it results in local file inclusion. The LLM cannot be relied upon for input validation; the tool implementation must enforce strict path boundaries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:56:15.044728+00:00— report_created — created