UTC
Low

Symlink swap after validation lets the directory-listing tools return entry names from outside allowedDirectories

GHSA-rq2p-q7c4-6g27 · published 2026-11-18

Severity
Low
CVSS score
2.2
Chance of exploitation (EPSS)
No CVE
Fixed in
No fix yet
What it is

The server returns the names and entry types of a directory outside its allowed directories to the MCP client, contrary to the README ("The server may touch only its allowed directories"; "All filesystem operations are restricted to allowed directories"). File contents and metadata are not returned. Where the server's user can list directories that the people able to write the allowed tree cannot, this also crosses an OS-user boundary, as demonstrated. The attack is a race and needs repeated calls. Suggested CVSS 3.1: (2.2).

What to do

No fixed release is listed yet for @modelcontextprotocol/server-filesystem. Limit what it can reach, or stop using it until a fix ships, and follow the source advisory for updates.

The patch below, against e1dc4b18, reads each listing through the anchor the reads already use: readDirectoryInPlace(directory) in pinned-directory.ts enters the validated directory with inDirectory, whose getcwd check refuses a swapped one, and reads .. Errors keep fs.readdir's wording ( , ENOTDIR: …). The three server.ts call sites and searchFilesWithValidation use it. search_files now recurses on the path validatePath returned, while still reporting the requested path. directory_tree and search_files keep readdirWithTimeout as a bounded first read, so a stalled provider folder still times out (#4162) before the synchronous listing runs. …

Affected
PackageRegistryAffectedFixed in
@modelcontextprotocol/server-filesystemnpm< 2.4.02.4.0
@modelcontextprotocol/server-filesystemnpm>= 2025.1.14, <= 2026.8.31No fix yet
Downstream in the Official MCP Registry

2 registered MCP servers install an affected version, by the dependency versions deps.dev resolved for a fresh install. The trace says when.

  • io.github.Wolfe-Jam/WJTTC@modelcontextprotocol/server-filesystem@2025.12.18
  • one.faf/wjttc@modelcontextprotocol/server-filesystem@2025.12.18
See the trace →

The impact, patch and workaround text comes from the advisory, shortened (published by the MCP reference servers project). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.

Sources: GitHub Advisory Database, reviewed and malware advisories (CC BY 4.0, https://github.com/advisories); advisories published by Cursor (https://github.com/cursor/cursor/security/advisories); advisories published by OpenClaw (https://github.com/openclaw/openclaw/security/advisories); advisories published by vLLM (https://github.com/vllm-project/vllm/security/advisories); advisories published by Open WebUI (https://github.com/open-webui/open-webui/security/advisories); advisories published by n8n (https://github.com/n8n-io/n8n/security/advisories); advisories published by Flowise (https://github.com/FlowiseAI/Flowise/security/advisories); advisories published by Langflow (https://github.com/langflow-ai/langflow/security/advisories); advisories published by the MCP Python SDK project (https://github.com/modelcontextprotocol/python-sdk/security/advisories); advisories published by the MCP reference servers project (https://github.com/modelcontextprotocol/servers/security/advisories); advisories published by the MCP Inspector project (https://github.com/modelcontextprotocol/inspector/security/advisories); advisories published by the MCP TypeScript SDK project (https://github.com/modelcontextprotocol/typescript-sdk/security/advisories); advisories published by the MCP Go SDK project (https://github.com/modelcontextprotocol/go-sdk/security/advisories); advisories published by the MCP Java SDK project (https://github.com/modelcontextprotocol/java-sdk/security/advisories); advisories published by the MCP Kotlin SDK project (https://github.com/modelcontextprotocol/kotlin-sdk/security/advisories); advisories published by the MCP Rust SDK project (https://github.com/modelcontextprotocol/rust-sdk/security/advisories); advisories published by the MCP Ruby SDK project (https://github.com/modelcontextprotocol/ruby-sdk/security/advisories); advisories published by the MCP C# SDK project (https://github.com/modelcontextprotocol/csharp-sdk/security/advisories); advisories published by the MCP PHP SDK project (https://github.com/modelcontextprotocol/php-sdk/security/advisories); advisories published by the MCP Registry project (https://github.com/modelcontextprotocol/registry/security/advisories); advisories published by Open Terminal (https://github.com/open-webui/open-terminal/security/advisories); advisories published by MLflow (https://github.com/mlflow/mlflow/security/advisories); CISA Known Exploited Vulnerabilities catalog (CC0). Data as of 2026-12-06. ShieldMap describes how each problem works and how to fix it; it does not publish exploit code. Report a correction to [email protected].