Filesystem symlinks leak external file metadata
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start by locating the filesystem server implementation of list_directory_with_sizes and inspect how it builds entry paths and reads metadata. Check the existing tests for directory listings and symlinks, then reproduce the reported case with an allowed directory containing a link to an outside file. Done when the listing no longer exposes the target file's metadata and the behavior is covered by a test.
Written by the indexing model from the issue text.
Description
Which server?
filesystem (@modelcontextprotocol/server-filesystem)
Server version
0.6.3
How did you run the server?
Not applicable (a repository-level report)
Transport
stdio
Protocol era
Not sure
MCP client and version
n/a
Steps to reproduce
- Start the filesystem server with one allowed directory.
- Create a file outside the allowed directory and a symlink to it inside the allowed directory:
tmp="$(mktemp -d)"
mkdir "$tmp/allowed"
printf 'MCP-FILESYSTEM-SYMLINK-METADATA-MARKER\n' > "$tmp/outside-secret.txt"
ln -s "$tmp/outside-secret.txt" "$tmp/allowed/leaks-outside-size"
- Call the MCP tool for the allowed directory:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_directory_with_sizes",
"arguments": {
"path": "/tmp/example/allowed",
"sortBy": "name"
}
}
}
The vulnerable code validates only args.path, then runs fs.readdir(validPath, { withFileTypes: true }), builds entryPath = path.join(validPath, entry.name), and calls fs.stat(entryPath).
Expected behavior
Directory listings that claim to operate only inside allowed directories should not follow symlink entries to targets outside the allowed tree. The tool should use lstat, or resolve each entry and enforce the same containment check before reading target metadata.
Actual behavior
A local reproduction created an allowed directory containing a symlink to an external file. The directory-entry metadata path followed the symlink:
allowed directory=/tmp/manual_mcp_filesystem_symlink_metadata_ldkba6qc/allowed
outside target=/tmp/manual_mcp_filesystem_symlink_metadata_ldkba6qc/outside-secret.txt
symlink entry=/tmp/manual_mcp_filesystem_symlink_metadata_ldkba6qc/allowed/leaks-outside-size
os.lstat symlink size=71
os.stat followed target size=39
outside target actual size=39
formatted listing=[FILE] leaks-outside-size 39 B
The reported listing size matches the outside target file size, not the symlink entry metadata.
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory form).
- Dominant language
- TypeScript
- Stars
- 91.4k
- Forks
- 11.8k
- Avg merge
- 7h 26m
- Merged PRs (30d)
- 130
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/servers
-
git: README should state plainly that without --repository every reachable repository is in scopeOpendocumentation server-git v2
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/servers#5225 · 1 comment ·
Maintainers usually reply within 1 day
-
chore v2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/servers#5223 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/servers#5216 ·
Maintainers usually reply within 1 day
-
filesystem: read_text_file with tail: N returns N-1 lines (or "" for tail: 1) when the file ends with a newlinePossibly taken @Jihaochang1 claimed this 1 day ago. Openbug v2
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
modelcontextprotocol/servers#5215 ·
Maintainers usually reply within 1 day
-
documentation server-git server-time v2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/servers#5213 · 2 comments ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/servers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
Maintainers usually reply within 1 day
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)Possibly taken @illya-havsiyevych claimed this today. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
epam/ai-dial-chat#9566 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
はさみアイコンを修正するOpenbug
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
area: core
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day