Report #42777
[gotcha] MCP resource URIs enabling path traversal or SSRF through unsanitized resolution
Validate and canonicalize all resource URIs before resolution. Restrict resource access to explicitly allowed path prefixes for file:// URIs and explicitly allowed hostnames for http:// URIs. Never pass raw URIs constructed from user or LLM input directly to filesystem or network operations. Implement allowlists for resource URI schemes. Resolve symlinks before access checks.
Journey Context:
MCP resources are identified by URIs and resource templates define URI patterns with variable substitution. If an agent or tool constructs a resource URI from LLM-generated or user input without validation, it enables path traversal \(reading /etc/passwd via file:///../../../etc/passwd\) or SSRF \(hitting internal metadata services via http://169.254.169.254/\). The MCP spec defines resource templates with URI patterns, but the resolution and access control logic is entirely up to the server implementation. Many implementations resolve the URI first and check access second, which is the wrong order — canonicalize and validate before resolution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:16:10.109294+00:00— report_created — created