Write-up / GHSA-7rgq-gccq-qphx

One trailing quote.

The path the server checked wasn’t the path it opened. This is how I found that in the official MCP filesystem server, and what it was really worth.

SeverityModerate · CVSS 4.2
Packageserver-filesystem
Fixed in2.0.1
WeaknessCWE-22 · CWE-436

Verify on GitHub

The short version.

The filesystem server in modelcontextprotocol/servers is only supposed to touch folders you allow. Before every operation it validates the path. I noticed it cleaned the path up before checking it, then used the original, uncleaned path for the real file call.

The clean-up strips a trailing quote or space. So when I asked for /allowed/proj', the check saw /allowed/proj and said yes, while the filesystem opened a different folder that happens to end in a quote.

Two strings, one request.

What the server checks
/allowed/proj'The path I send
normalizePath()Trims spaces, strips the quote
/allowed/projWhat the check sees
Inside allowed dir?Yes. Approved.
What the server opens
/allowed/proj'The same path, untouched
fs.realpath(raw)Runs on the original string
/allowed/proj'A different folder on disk
File operationRead, write or move, outside the allowlist
Both rows start from the same input. They split at the second step, and nothing afterwards brings them back together.

Where it lives.

All of it is in validatePath in src/filesystem/lib.ts. The normalizer:

p = p.trim().replace(/^["']|["']$/g, "");

The check runs on the cleaned copy:

const normalizedRequested = normalizePath(absolute);
const isAllowed = isPathWithinAllowedDirectories(normalizedRequested, allowedDirectories);

The file call runs on the raw one:

const realPath = await fs.realpath(absolute);
return realPath;

There is a second check after realpath, but it runs through the same normalizer, which strips the same character again, so it passes too. Every tool that takes a path goes through this function: read, write, edit, move, list and search.

Proving it.

I imported the real validatePath from the server’s compiled output, made an allowed folder and a sibling whose name ends in a quote, and asked for the sibling:

const allowedProj = path.join(sandbox, "allowed/proj");
const siblingEvil = path.join(sandbox, "allowed/proj'");
await fs.writeFile(path.join(siblingEvil, "SECRET.txt"), "OUTSIDE");

const validated = await validatePath(sandbox + "/allowed/proj'", [allowedProj]);
// validated ends in proj'  — outside the allowlist, and readable

What it was really worth.

I scored it 9.3. The maintainers rescored it to 4.2, and they were right. The only place I could reach was a sibling folder whose name is the allowed folder plus a trailing quote or space, and that folder has to exist already. It is a real boundary break, but a narrow one.

I’d rather tell you that than call it a full sandbox escape.

How it went.

14 Oct 2026

I reproduced it against the latest main.

Oct 2026

I reported it privately through GitHub Security Advisories.

Oct 2026

The maintainers confirmed it on 2.0.0 and wrote a fix.

Oct 2026

Advisory published, fix released in 2.0.1, CVE requested.

The lesson.

Validate the thing you’re going to use, not a cleaned-up copy of it.

The fix does exactly that: it checks the path in the same spelling the filesystem call uses. If you’re on an old date-versioned release (2025.x or 2026.x), your package manager won’t offer 2.0.1 as an upgrade, so install it explicitly.

I used AI assistance while preparing the report, and the advisory says so. The finding, the reproduction and this write-up are mine to answer for.

Back to the surface