Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Filesystem symlinks leak external file metadata

Đang mở Phù hợp với người mới
#5,217 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
backend, security

Hướng nghiên cứu

Bắt đầu bằng cách tìm phần triển khai list_directory_with_sizes của máy chủ hệ thống tệp và kiểm tra cách hàm tạo đường dẫn cho các mục cũng như đọc siêu dữ liệu. Xem các bài kiểm tra hiện có về danh sách thư mục và liên kết tượng trưng, sau đó tái hiện trường hợp được báo cáo bằng một thư mục được phép có chứa liên kết đến tệp bên ngoài. Hoàn tất khi danh sách không còn để lộ siêu dữ liệu của tệp đích và hành vi này được bao phủ bằng một bài kiểm tra.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug v2
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
  1. Start the filesystem server with one allowed directory.
  2. 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"
  1. 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).
Ngôn ngữ chính
TypeScript
Star
91.4k
Fork
11.8k
Merge trung bình
7 giờ 36 phút
Pull request đã merge (30 ngày)
126

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/servers

Tất cả issue của modelcontextprotocol/servers

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.