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
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).
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. …
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| @modelcontextprotocol/server-filesystem | npm | < 2.4.0 | 2.4.0 |
| @modelcontextprotocol/server-filesystem | npm | >= 2025.1.14, <= 2026.8.31 | No fix yet |
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
- CriticalMCP Path Traversal Allows Full-Filesystem Read and JWT Secret Exfiltration Leading to Account Takeoverlangflow, langflow-base
- CriticalVibe-Trading FastAPI endpoints permit unauthenticated access, file upload, and an RCE chainvibe-trading-ai
- Critical@zereight/mcp-gitlab: Unauthenticated arbitrary file read via `upload_markdown` enables PAT exfiltration and full account takeover@zereight/mcp-gitlab
- CriticalFlowise RCE via SQL Database Chain Nodeflowise, flowise-components
- CriticalLangroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file callslangroid
- Criticalfast-mcp-telegram: Bearer token path traversal bypasses reserved Telegram session protectionfast-mcp-telegram
- Highfilesystem: --read-only-dir bypass on case-insensitive Linux mounts@modelcontextprotocol/server-filesystem
- High@modelcontextprotocol/server-filesystem vulnerability allows for path validation bypass via colliding path prefix@modelcontextprotocol/server-filesystem
- High@modelcontextprotocol/server-filesystem allows for path validation bypass via prefix matching and symlink handling@modelcontextprotocol/server-filesystem
- Mediumfilesystem: non-UTF-8 allowed directory resolves to a sibling symlink@modelcontextprotocol/server-filesystem
- Mediumfilesystem: --read-only-dir bypass via move_file and intermediate symlinks@modelcontextprotocol/server-filesystem
- Mediumcreate_directory: NFC-twin symlink race creates dirs in --read-only-dir@modelcontextprotocol/server-filesystem
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.