November 18, 2026 Follow Egret
AI & agents

Trailing quote or whitespace lets MCP filesystem tools escape allowed directories

By Egret editorial desk 1 min read
Original source MCP server advisories ↗AI-assisted · 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.

Affected
@modelcontextprotocol/server-filesystem (npm): >= 2025.8.21, <= 2026.8.31; and >= 1.0.0, < 2.0.1
Fixed
2.0.1 for >= 1.0.0, < 2.0.1; not specified by advisory for date versions >= 2025.8.21, <= 2026.8.31

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.

Sources & technical scope 1 source

MCP server advisories — original source ↗

Affected: @modelcontextprotocol/server-filesystem (npm): >= 2025.8.21, <= 2026.8.31; and >= 1.0.0, < 2.0.1

Fixed: 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

Scope & 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

External findings belong to the credited researchers.
Egret — Back to top Egret