Report #27488
[gotcha] MCP resource templates with URI variable substitution enable path traversal and unauthorized data access through LLM-controlled parameters
Validate and sanitize all URI parameters in resource template substitutions against strict allowlists. Restrict resource URIs to safe path prefixes. Never allow LLM-controlled or user-controlled input to directly construct file paths or URLs. Implement canonical path resolution and boundary checking.
Journey Context:
MCP resources let servers expose readable data via URI templates. If a resource template like 'file:///home/user/data/\{path\}' allows the LLM to control the path variable, it can traverse to 'file:///home/user/.ssh/id\_rsa' or '/etc/passwd'. Resource endpoints are routinely overlooked in security reviews because they are read-only. But read access to sensitive files—SSH keys, .env files, cloud credentials, private documents—is often as damaging as write access. The LLM will happily construct traversal paths if an injected instruction tells it to, and the resource template has no built-in path boundary enforcement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:32:09.301478+00:00— report_created — created