Report #87126
[gotcha] MCP resource template URI parameters enable path traversal or SSRF
Validate and sanitize all URI parameters in MCP resource templates. Restrict allowed URI schemes \(e.g., only \`file://\` within a confined base path, block \`http://\` to internal networks\). Implement path allowlists. Never pass user- or LLM-controlled strings directly into resource URIs without normalization and boundary checks.
Journey Context:
MCP resource templates use URI patterns like \`file:///projects/\{name\}/docs\` where \`\{name\}\` is substituted at runtime. If the parameter is not validated, path traversal \(e.g., \`name=../../etc/passwd\`\) or SSRF \(e.g., pointing to internal services via \`http://\`\) becomes trivially exploitable. The MCP spec defines resource templates but leaves input validation entirely to the server implementation. Developers treat the URI template as simple string substitution without considering that the LLM — or a user prompting the LLM — can supply arbitrary values for template parameters. The LLM has no concept of 'valid path' and will happily pass traversal sequences.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:49:50.801464+00:00— report_created — created