Security guidance: tool-input file paths written without containment (arbitrary file write class)
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
- 65/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- security
Hướng nghiên cứu
Bắt đầu bằng cách tìm tài liệu phía máy chủ hướng dẫn cho công cụ; issue không nêu tệp hay bài kiểm thử nào. Thêm một mục giải thích cách phân giải các đường dẫn do công cụ cung cấp bên trong thư mục gốc của workspace và từ chối đường dẫn tuyệt đối cũng như đường dẫn thoát ra ngoài bằng .., kèm một ví dụ. Công việc được xem là hoàn tất khi tài liệu có hướng dẫn về giới hạn phạm vi đường dẫn; helper tùy chọn resolveWithin(root, p) cần có phạm vi và thiết kế riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
While auditing the MCP server ecosystem (1,654 npm-backed servers
deep-scanned with MCP-aware CodeQL taint analysis), I found a recurring,
independently-rediscovered class: a tool declares a path-shaped input
(output_path, local_path, output_dir) as an unconstrained string and passes
it to path.resolve()/path.join() then fs.writeFileSync, with no workspace
containment. Because an MCP tool caller is frequently an LLM acting on
untrusted content, the path is attacker-influenced via indirect prompt
injection - no human chooses it. Result: arbitrary file write and
destructive overwrite (authorized_keys, rc files, configs).
Prevalence in the scanned sample is material (path-traversal flows present
in a measurable share of servers; aggregate scorecard available). Several
affected servers even shipped a containment helper for one sink and left
the tool-input writes raw.
This is a server-author footgun, not an SDK bug, but the SDK is the natural
place to prevent it at scale. Proposed, in order of increasing
intrusiveness:
- A short "Writing files from a tool safely" section in the server-author
docs, with the containment pattern (resolve against a workspace root,
reject absolute and ".." escapes). - Optionally, an exported
resolveWithin(root, p)helper so authors do not
hand-roll it (several who did, got it wrong).
I can open the docs PR with the guidance text and an example. Full
methodology and the CodeQL pack that finds this are public at
github.com/stillmarcus24/mcp-security-research. No unfixed server is named;
findings are under coordinated disclosure.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.8k
- Fork
- 2.5k
- Merge trung bình
- 6 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/typescript-sdk
-
v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Có thể đã có người làm @mgoldsborough đã nhận 6 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyCó thể đã có người làm @Tidehyc đã nhận 7 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsCó thể đã có người làm @yunusemrejs đã nhận 12 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/typescript-sdk
Issue tương tự
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openclaw/openclaw#212827 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Use one constant for the 10,000-character input limitCó thể đã có người làm @NginxL đã nhận hôm nay. Đang mởgood first issue refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aniru-dh21/snap-validate#51 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies effort: small good first issue priority: low
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
TMHSDigital/screencast-mcp#509 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
from-review tech-debt testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
blamechris/chroxy#9520 ·
Maintainer thường phản hồi trong vòng 1 ngày