Report #38303
[gotcha] Path traversal via malicious resource URIs
Canonicalize and validate all file paths resolved from MCP resource URIs. Ensure the resolved path is strictly within an allowed base directory, rejecting paths containing .. or symlinks that escape the sandbox.
Journey Context:
MCP servers exposing filesystem access via resource URIs \(e.g., file:///path/to/file\) often naively append the URI path to a base directory. An attacker \(or compromised agent\) can request file:///../../../etc/passwd, traversing out of the intended directory. Canonicalizing the path before checking the prefix prevents this, whereas simple string prefix checks fail against ../ attacks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:46:10.686839+00:00— report_created — created