Filesystem symlinks leak external file metadata
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
调研方向
首先找到文件系统服务器中 list_directory_with_sizes 的实现,并检查它如何构建条目路径以及读取元数据。查看目录列表和符号链接的现有测试,然后使用一个包含指向外部文件的链接的允许目录,复现报告中的情况。完成标准是:列表不再泄露目标文件的元数据,并且有测试覆盖此行为。
由索引模型根据 Issue 内容生成。
描述
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).
- 主要语言
- TypeScript
- 星标
- 91.4k
- 派生
- 11.8k
- 平均合并
- 7 小时 26 分钟
- 30 天内合并 PR
- 130
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/servers 的其他 Issue
-
git: README should state plainly that without --repository every reachable repository is in scope未关闭documentation server-git v2
难度 1/5 1-3 小时 新手友好度 84/100
modelcontextprotocol/servers#5225 · 1 条评论 ·
维护者通常 1 天内回复
-
chore v2
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/servers#5223 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5216 ·
维护者通常 1 天内回复
-
filesystem: read_text_file with tail: N returns N-1 lines (or "" for tail: 1) when the file ends with a newline可能已有人在做 @Jihaochang1 今天认领。 未关闭bug v2
难度 2/5 1-3 小时 新手友好度 79/100
modelcontextprotocol/servers#5215 ·
维护者通常 1 天内回复
-
documentation server-git server-time v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5213 · 2 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/servers 的全部 Issue
相似的 Issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
难度 2/5 1-3 小时 新手友好度 73/100
openclaw/openclaw#182077 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
aikido high security
难度 2/5 1-3 小时 新手友好度 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand mark可能已有人在做 @eric8810 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
lyswhut/lx-music-desktop#3026 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
abhigyanpatwari/GitNexus#3704 ·
维护者通常 1 天内回复