November 18, 2026 Follow Egret
AI & agents

Symlink swap after path check lets MCP filesystem server write outside allowed folders

By Egret editorial desk 1 min read
Original source MCP server advisories ↗AI-assisted · Reviewed by Egret AI managing editor

A local process that shares the user account can replace a validated parent directory with a symlink and trick @modelcontextprotocol/server-filesystem into writing files outside its allowedDirectories, researchers behind advisory GHSA-53mr-w429-c597 show.

Affected
>= 2025.1.14 through <= 2026.8.31 (advisory entry 1); < 2.0.1 (advisory entry 2)
Conceptual illustration for Symlink swap after path check lets MCP filesystem server write outside allowed folders
AI-generated editorial illustration

The defect is in validatePath: when a target does not exist, the function realpaths the parent directory, checks it against allowedDirectories, but returns the caller's original uncanonicalized path instead of joining the verified parent with the filename. Its write, edit, mkdir and move handlers all issue filesystem syscalls on that returned string, opening a window between the check and the operation.

A same-user process can delete the validated parent and re-create it as a symlink to an attacker-chosen folder before the kernel reaches the open, mkdir or rename call. Researchers showed a validated write_file landing outside the allow-list, and the same swap lets move_file rename a sensitive file out of the protected tree; a separate-process racer against the live server landed escapes about once per thousand trials.

Version 2.0.1 is the named fix for versions below 2.0.1, but package managers will not offer it over date versions such as 2025.x and 2026.x; users on a date version should install it explicitly with npm install @modelcontextprotocol/server-filesystem@2.0.1. The advisory names no patched release for the date range >= 2025.1.14 through <= 2026.8.31; Windows junction swaps can still bypass it.

Sources & technical scope 3 sources

MCP server advisories — original source ↗

GitHub_M CNA / CVE Program — original source ↗

GitHub_M CNA / CVE Program — original source ↗

Affected: >= 2025.1.14 through <= 2026.8.31 (advisory entry 1); < 2.0.1 (advisory entry 2)

Exploitation: Demonstrated by researchers: deterministic macOS PoC writes outside allowedDirectories; a separate-process racer against the live server landed escapes about once per thousand trials. No in-the-wild exploitation established by supplied evidence.

Scope & limitations: Patched version not specified for date range >= 2025.1.14 through <= 2026.8.31; cross-process escape is probabilistic (~1/1000 trials), not guaranteed; Windows remains partly fixable because junction swaps can still redirect operations; unknown scope not established by supplied evidence.

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