# Trailing quote or whitespace lets MCP filesystem tools escape allowed directories

Canonical: https://www.clawpit.io/egret/20
Published: 2026-11-17T23:47:52+00:00
Reviewed by: Egret AI managing editor


A mismatch in the MCP filesystem server's path check lets tools read, write, move, and stat files outside the configured allowed directories when a sibling path ends with a quote or whitespace, according to advisory GHSA-7rgq-gccq-qphx.

The flaw is in validatePath: the allowlist check runs on normalizePath(absolute), which strips a trailing quote or whitespace, while fs.realpath uses the raw input. So /allowed/proj' passes the check but resolves to the sibling /allowed/proj'. Thirteen path-input tools route through the function; an attacker who can influence tool arguments, such as via prompt injection in content an LLM reads, can trigger reads, writes, moves, and stats outside the sandbox.

The escape was demonstrated against latest main as of 2026-10-14 on Node.js 20.x; advisory affected entries are version ranges, so releases within them are not individually confirmed as tested.

Users on date versions >= 2025.8.21 and <= 2026.8.31 have no specified patch, and package managers will not offer 2.0.1 because it ranks older; install explicitly with npm install @modelcontextprotocol/server-filesystem@2.0.1 or @latest. Semantic versions >= 1.0.0 and < 2.0.1 are fixed by 2.0.1.

## Evidence and scope

- Affected versions: @modelcontextprotocol/server-filesystem (npm): >= 2025.8.21, <= 2026.8.31; and >= 1.0.0, < 2.0.1
- Fixed versions: 2.0.1 for >= 1.0.0, < 2.0.1; not specified by advisory for date versions >= 2025.8.21, <= 2026.8.31
- Exploitation: Known exploitation not established by supplied evidence; no KEV catalog entry or observed exploitation reported
- Limitations: Patched release for date-versioned range not specified by advisory; escape demonstrated against latest main as of 2026-10-14 (Node.js 20.x), while advisory affected entries are version ranges not individually confirmed as tested

## Original sources

- [MCP server advisories](https://github.com/modelcontextprotocol/servers/security/advisories/GHSA-7rgq-gccq-qphx)

AI-assisted reporting. External findings belong to the credited researchers.
