The Filesystem MCP server is usually the first one people add. You give it a folder, and the agent can read and write inside that folder and nowhere else. In a web3 dev setup it matters more than most, because it runs as your user, and your user can read ~/.foundry/keystores and ~/.ssh.
In March 2025 Elad Beber at Cymulate found two ways out of that folder in Anthropic's reference server, the one in the modelcontextprotocol/servers repo. Both were fixed on 1 July 2025 in version 2025.7.1 and published as CVE-2025-53110 and CVE-2025-53109, which Cymulate calls EscapeRoute (Cymulate's write-up). Neither needed a memory bug. One was a startsWith(), the other a catch block.
This was the containment check before the fix:
const isAllowed = allowedDirectories.some(dir => normalizedRequested.startsWith(dir));
With /private/tmp/allow_dir allowed, /private/tmp/allow_dir_evil starts with the same string, so it passes. So does any sibling whose name extends the allowed one: project-old next to project, app.bak next to app. That's CVE-2025-53110.
../ doesn't get you out here. The server runs path.resolve on the request before the check, so allow_dir/../../etc/passwd becomes /etc/passwd and fails. The way out is a sibling with a longer name. The fix compares against the directory plus a separator, so the request has to start with /private/tmp/allow_dir/ or be the directory itself (commit d00c60d).
The server did resolve symlinks. After the prefix check it ran fs.realpath and checked the real path too. The problem was the error handling around it (trimmed):
try {
const realPath = await fs.realpath(absolute);
if (!allowedDirectories.some(dir => normalizePath(realPath).startsWith(dir))) {
throw new Error("Access denied - symlink target outside allowed directories");
}
return realPath;
} catch (error) {
// For new files that don't exist yet, verify parent directory
const parentDir = path.dirname(absolute);
// ...realpath(parentDir) passes the prefix check...
return absolute;
}
The catch was meant for files that don't exist yet. It caught every error, including the "symlink target outside" one thrown a few lines up. Then it checked the symlink's parent, which sits inside the allowed folder, and returned the symlink's own path. The tool then read or wrote through the link to wherever it pointed. That's CVE-2025-53109.
Cymulate chained the two: create allow_dir_evil (passes the prefix check), put test -> /etc/sudoers inside it, and ask the agent to read it. For code execution on macOS they pointed a symlink at a plist in ~/Library/LaunchAgents and had the server write it, so their command ran at the next login.
The July 2025 fix catches only ENOENT and rethrows anything else. write_file started creating files with the wx flag, which fails if anything, a symlink included, already sits at that name, and otherwise wrote a temp file and renamed it over the name. A rename replaces the link instead of following it.
The server has no tool that creates a symlink. In Cymulate's demo a second local user made it in /private/tmp. On a developer machine the likelier source is whatever else writes into the folder you shared. Git checks out symlinks as real symlinks by default on macOS and Linux, and archives can carry them too. So on a version before 2025.7.1, if the allowed folder was a repo you cloned, the repo's author had a say in where the agent could reach. I wrote more about cloned repos in Your repo is not trusted context.
GitHub's advisories rate both CVEs 7.3 on CVSS 4.0, and Cymulate scored the symlink one 8.4. The number matters less than who the server runs as. It runs as you, so once the boundary fails it reaches what you can.
In October and November 2026 the same server got seven more advisories. Two repeat the 2025 mistake, a check run on one string and the operation on another:
/allowed/proj', a sibling of /allowed/proj, passed. Fixed in 2.0.1. realpath, and new files went through the link to outside the folder. Fixed in 2.0.1.
Four are races. The server checked the resolved path and then used the path again by name, so a directory swapped for a symlink in between redirected the call. They hit the new-file fallback above (GHSA-53mr-w429-c597, writes, fixed in 2.0.1), the source of move_file (GHSA-7m4x-rv66-mxhh, fixed in 2.3.0), read_text_file (GHSA-p9cv-8g75-4xcg, fixed in 2.3.0) and the listing tools (GHSA-rq2p-q7c4-6g27, fixed in 2.4.0). Each needs a local process that can rename things inside the allowed folder while the server runs.
The last one needs less. list_directory_with_sizes ran stat on every entry, which follows symlinks, so a symlink already in the folder, like one that came with a cloned repo, leaked the size of a file outside it (GHSA-hhwq-wxfx-cj7g, fixed in 2.0.1).
Since 2.4.0, on Linux and macOS, the server anchors reads, writes and listings to the directory it validated. Its README says it can't do that on Windows, where a process that can write in the folder can still win the race on a parent directory.
The package used date versions up to 2026.8.31 and then moved to plain version numbers. The 2026 advisories list no fix for the date line. And 2.4.1 is a lower version number than 2026.8.31, so a lockfile, an exact date pin or a ^2026.8.31 range never moves to it, and npm update won't either. If your client config or lockfile has a date version, change it by hand and pin the new one:
"args": ["-y", "@modelcontextprotocol/server-filesystem@2.4.1", "/Users/me/code/my-project"]
--confine-roots (2.2.0 and later). The server logs the effective directories to stderr at startup and on every change, so read that line once./tmp and a repo you just cloned both have other writers. A folder only you and the agent write to removes the setup every one of these bugs needed.node_modules from its store. get_file_info reports a hardLinks count, and more than 1 means the file has other names.--read-only drops every write tool, and --read-only-dir <path> makes one folder read-only while the others stay writable.openat2 with RESOLVE_BENEATH makes the kernel refuse a path that leaves a directory (Linux 5.6+), but Node's fs doesn't expose it, so for this server the boundary you can add sits outside it. The Docker image runs as the unprivileged node user and only sees the folders you mount under /projects, with ro on a mount for read-only. Mount the project folder, not your home directory.
Adapted from a piece our team published on zealynx.io. This version corrects how both bypasses worked (../ was resolved before the prefix check, and the symlink's real path was checked but the refusal was swallowed by the catch block), adds what the fix changed, the 2026 advisories, the version-line switch and the server's current options, and drops the OWASP mapping.
I wrote this with help from AI for drafting and editing. The opinions and the audit experience are mine.