GHSA-f897-62hf-6gxq: MCP TypeScript SDK: HTTP server transports and handlers did not limit request body size or JSON-RPC batch length
High CVSS 7.5
- OSV id
- GHSA-f897-62hf-6gxq
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| @modelcontextprotocol/sdk npm |
>= 1.10.0, < 1.30.1 | 1.30.1 |
| @modelcontextprotocol/server npm |
>= 2.0.0, < 2.1.0 | 2.1.0 |
| @modelcontextprotocol/node npm |
>= 2.0.0, < 2.1.0 | 2.1.0 |
| @modelcontextprotocol/hono npm |
>= 2.0.0, < 2.0.1 | 2.0.1 |
Versions we track that it affects: @modelcontextprotocol/sdk 1.30.0;
How to fix it
@modelcontextprotocol/sdk (npm)
Upgrade @modelcontextprotocol/sdk to 1.30.1 or later.
npm install @modelcontextprotocol/sdk@1.30.1
# if it is an indirect dependency: npm update @modelcontextprotocol/sdk (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
@modelcontextprotocol/server (npm)
Upgrade @modelcontextprotocol/server to 2.1.0 or later.
npm install @modelcontextprotocol/server@2.1.0
# if it is an indirect dependency: npm update @modelcontextprotocol/server (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
@modelcontextprotocol/node (npm)
Upgrade @modelcontextprotocol/node to 2.1.0 or later.
npm install @modelcontextprotocol/node@2.1.0
# if it is an indirect dependency: npm update @modelcontextprotocol/node (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
@modelcontextprotocol/hono (npm)
Upgrade @modelcontextprotocol/hono to 2.0.1 or later.
npm install @modelcontextprotocol/hono@2.0.1
# if it is an indirect dependency: npm update @modelcontextprotocol/hono (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
Not sure whether your project uses an affected version? Check your lockfile below for free.
Details
Summary
In affected versions, MCP servers reachable over HTTP put no limit on the size of a POST body or on the number of messages in a JSON-RPC batch. Large requests could exhaust the server's memory, and one long batch could block it from serving anyone else. No credentials were needed, unless your application authenticates requests before they reach the SDK.
Am I affected?
Yes, if clients you do not fully trust can reach your server over Streamable HTTP. A body parser such as express.json() does not protect you, because it does not limit batch length. Servers that only use stdio are not affected.
Affected versions:
@modelcontextprotocol/sdk1.10.0 through 1.30.0@modelcontextprotocol/server2.0.0@modelcontextprotocol/node2.0.0@modelcontextprotocol/hono2.0.0
Fix
Upgrade to:
- 1.x:
@modelcontextprotocol/sdk1.30.1 or later - 2.x:
@modelcontextprotocol/server2.1.0,@modelcontextprotocol/node2.1.0 and@modelcontextprotocol/hono2.0.1 or later. Upgrade every one you have installed.
Bodies over 4 MiB now get 413, and batches over 100 messages get 400. If your clients send larger bodies, raise the new maxRequestBodySize option.
If you cannot upgrade yet, cap request body size in a reverse proxy.
References
- GHSA-f897-62hf-6gxq on OSV.dev
- Web: https://github.com/modelcontextprotocol/typescript-sdk/security/advisories/GHSA-f897-62hf-6gxq
- Web: https://github.com/modelcontextprotocol/typescript-sdk/pull/2698
- Web: https://github.com/modelcontextprotocol/typescript-sdk/pull/2717
- Web: https://github.com/modelcontextprotocol/typescript-sdk/commit/7b781ed4e25355a25d15974f3c76de81299694ed
- Web: https://github.com/modelcontextprotocol/typescript-sdk/commit/a9f6eb709b85459d01e8f2a9e881fef2621756c1
- Package: https://github.com/modelcontextprotocol/typescript-sdk
- Web: https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/1.30.1
- Web: https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/@modelcontextprotocol/hono@2.0.1
- Web: https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/@modelcontextprotocol/node@2.1.0
- Web: https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/@modelcontextprotocol/server@2.1.0
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.