Report #48769
[gotcha] File system MCP tools allow path traversal through relative paths like \`../../etc/passwd\`
Resolve all file paths provided as tool arguments against a strict base directory and reject paths that attempt to traverse outside the allowed scope \(e.g., using \`os.path.realpath\` and checking \`startswith\(base\_dir\)\`\).
Journey Context:
Agents often ask file reading tools to open files based on user input. If the MCP server doesn't canonicalize and sandbox the path, the LLM can be tricked \(via prompt injection\) into requesting files outside the intended project directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:20:16.931059+00:00— report_created — created