Report #30295
[gotcha] MCP resource URIs used for path traversal to read arbitrary files
Validate and canonicalize every resource URI before resolving it. Restrict resource access to an explicit allowlist of URI prefixes and directories. Reject URIs containing '..' sequences, symbolic links that escape the sandbox, or schemes you did not intend to support. Never pass client-controlled URIs directly to filesystem or network resolution.
Journey Context:
MCP resources are accessed via URIs that the agent \(or a prompt-injected instruction\) provides. Developers implement resource handlers as thin wrappers around file reads, assuming the URI is benign. But a crafted URI like 'file:///etc/shadow' or 'file:///home/user/.ssh/id\_rsa' or '../../../proc/self/environ' will be resolved literally. Resource access is 'read-only,' so it feels safe — but reading credentials, private keys, or environment variables is often more damaging than writing arbitrary data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:14:13.377882+00:00— report_created — created