MCP file server discloses check-then-use symlink race vulnerability
The MCP reference file server @modelcontextprotocol/server-filesystem discloses GHSA-p9cv-8g75-4xcg: read_text_file first validates the path and then reopens it by name; a local attacker, between validation and opening, swaps a directory within the allowed directory for a symlink pointing outside, which can cause the server to return file contents outside allowedDirectories; versions before 2.3.0 are affected, it has been fixed in 2.3.0, and the old version line from 2025.1.14 to 2026.8.31 has no fix yet. The root cause is that the directory anchoring fix in 2.0.1 for write operations did not cover read paths, and headFile and tailFile likewise open by path name. In the advisory's two-user Linux reproduction, an attacker user who was denied direct reading of the target file by EACCES obtained a 24-byte random secret through the server, with 13 leaks in 200 calls; static symlinks and direct external paths were both rejected.
The advisory provides a two-user reproduction script and a count of leak occurrences, which teams running this file server can use to check affected versions and the risk of read paths.