Model Context Protocol TypeScript SDK 出現可造成拒絕服務的 GHSA-f897-62hf-6gxq 漏洞
GHSA-F897-62HF-6GXQ: GHSA-f897-62hf-6gxq: Unbounded Request Body and JSON-RPC Batch DoS in Model Context Protocol TypeScript SDK
Model Context Protocol TypeScript SDK 的 HTTP 傳輸實作及 Express、Hono 中介軟件存在請求本文大小和 JSON-RPC 2.0 批次長度未設上限的漏洞,未經驗證的遠端攻擊者可藉此造成拒絕服務。
GHSA-f897-62hf-6gxq: Unbounded Request Body and JSON-RPC Batch DoS in Model Context Protocol TypeScript SDK
Vulnerability ID: GHSA-F897-62HF-6GXQ
CVSS Score: 7.5
Published: 2026-10-27
The Model Context Protocol (MCP) TypeScript SDK contains an uncontrolled resource consumption vulnerability in its HTTP server transport implementations and middleware adapters. Affected versions fail to enforce upper bounds on incoming HTTP POST request body sizes and JSON-RPC 2.0 batch array lengths. In addition, middleware wrappers for Express and Hono parse request bodies into memory prior to validating Host and Origin headers. Unauthenticated remote attackers can exploit these flaws to trigger Out-Of-Memory (OOM) process crashes or monopolize the single-threaded Node.js event loop.
TL;DR
Unbounded HTTP request body buffering and unrestricted JSON-RPC batch array lengths in the MCP TypeScript SDK allow remote unauthenticated attackers to cause Denial of Service via memory exhaustion or Node.js event loop starvation.
⚠️ Exploit Status: POC
Technical Details
- Advisory ID: GHSA-f897-62hf-6gxq
- Weakness Class: CWE-400 (Uncontrolled Resource Consumption) / CWE-770
- Attack Vector: Network (HTTP POST over Streamable HTTP / Express / Hono / Node)
- CVSS v3.1 Score: 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
- Primary Impact: Denial of Service (V8 Heap OOM Crash & Event Loop Starvation)
- Default Limits Added: 4 MiB Max Request Body Size / 100 Max JSON-RPC Batch Length
- Exploit Status: PoC (Reproduced via unit tests and HTTP streaming scripts)
- KEV Status: Not Listed
Affected Systems
- @modelcontextprotocol/sdk
- @modelcontextprotocol/server
- @modelcontextprotocol/node
- @modelcontextprotocol/hono
- @modelcontextprotocol/express
-
@modelcontextprotocol/sdk: >= 1.10.0, < 1.30.1 (Fixed in:
1.30.1) -
@modelcontextprotocol/server: = 2.0.0 (Fixed in:
2.1.0) -
@modelcontextprotocol/node: = 2.0.0 (Fixed in:
2.1.0) -
@modelcontextprotocol/hono: = 2.0.0 (Fixed in:
2.0.1)
Code Analysis
Commit: 7b781ed
Enforce request body size limits, JSON-RPC batch length caps, and middleware ordering in v2.x branch (PR #2698)
Commit: a9f6eb7
Backport request body size limits, JSON-RPC batch length caps, and middleware ordering to v1.x branch (PR #2717)
Mitigation Strategies
- Upgrade MCP TypeScript SDK packages to patched releases that enforce a 4 MiB default body limit and a 100-message JSON-RPC batch cap.
- Enforce strict HTTP request body size limits (e.g., client_max_body_size 4M) and connection rate limiting at the upstream reverse proxy or WAF layer.
- Require authentication at the network edge or API gateway prior to routing traffic to MCP HTTP server endpoints.
Remediation Steps:
- For v1.x deployments, run: npm install @modelcontextprotocol/sdk@>=1.30.1
- For v2.x deployments, run: npm install @modelcontextprotocol/server@>=2.1.0 @modelcontextprotocol/node@>=2.1.0 @modelcontextprotocol/hono@>=2.0.1
- Verify custom Express or Hono middleware stacks to ensure Host, Origin, and authentication checks execute prior to any body-parsing middleware.
- Configure Nginx or ingress controllers with client_max_body_size 4M; to drop oversized requests before they reach the Node.js application.
References
- GitHub Security Advisory: GHSA-f897-62hf-6gxq
- Repository Security Advisory: GHSA-f897-62hf-6gxq
- Model Context Protocol TypeScript SDK Repository
- Pull Request #2698 (v2.x Patch)
- Pull Request #2717 (v1.x Patch)
- Patch Commit 7b781ed4e25355a25d15974f3c76de81299694ed (v2.x)
- Patch Commit a9f6eb709b85459d01e8f2a9e881fef2621756c1 (v1.x)
- Release 1.30.1
- Release @modelcontextprotocol/server@2.1.0
- Release @modelcontextprotocol/node@2.1.0
- Release @modelcontextprotocol/hono@2.0.1
Read the full report for GHSA-F897-62HF-6GXQ on our website for more details including interactive diagrams and full exploit analysis.
來源:DEV Community · dev.to