NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2026-39313: MCP-Framework: Unbounded memory allocation in readRequestBody allows denial of service via HTTP transport

highCVSS 4.0 8.7GHSA-353c-v8x9-v7c3

mcp-framework up to 0.2.21 reads the whole HTTP request body into memory with no size limit. A single large POST to the /mcp endpoint of an HTTP-transport server can exhaust memory and crash it, with no authentication. The maxMessageSize setting existed but was never enforced. Upgrade to mcp-framework 0.2.22.

Published Apr 16, 2026 · Updated Apr 24, 2026 · Analysis Oct 30, 2026

What an attacker can do

In src/transports/http/server.ts, readRequestBody() appends each incoming chunk to a string, body += chunk.toString(), and only parses JSON after the request ends. Nothing caps the length. The config defines maxMessageSize, with a 4 MB default in DEFAULT_HTTP_STREAM_CONFIG, but the function never reads it. That gives a false sense of protection.

The read happens before any authentication, and auth is opt-in in mcp-framework, with no auth as the default. Any client that can reach the port can send an oversized POST to /mcp. The reporter measured 50 MB payloads in five local trials, each ending with the memory growing by between 14 MB and 197 MB in under 50 ms. Larger or repeated requests push a Node process past its heap limit, and the process is killed.

The effect is availability only. The server and every MCP tool behind it go down until restarted, and an attacker can repeat the request after each restart. The CVSS 4.0 vector shows no confidentiality or integrity impact. The reporter notes the package has about 60,000 weekly npm downloads.

Who is affected

The mcp-framework npm package at version 0.2.21 and earlier, for servers that use the HTTP stream transport (HttpStreamTransport). Servers built on stdio do not expose this endpoint. Check the version:

npm ls mcp-framework

Check the lockfile as well, since the framework is often a transitive dependency of an MCP server project.

mcp-framework

Ecosystem
npm
Affected
<= 0.2.21
Fixed in
0.2.22
Check
npm ls mcp-framework

How to fix it

Upgrade to mcp-framework 0.2.22:

npm install [email protected]

Commit f97d2bb changes readRequestBody() to keep a running byte count. When the count passes maxMessageSize, which defaults to 4 MB (4,194,304 bytes), it destroys the request and rejects with "Request body exceeds maximum size of N bytes". The commit does not show an HTTP status code. If you cannot upgrade, put a reverse proxy in front of the server that caps request body size, for example nginx client_max_body_size, and keep the port off untrusted networks.

How to tell if you were hit

Look for the process being killed for memory (out-of-memory errors in the Node log, a container OOM kill, or repeated restarts). Check access logs for very large POST requests to /mcp, and for repeated large requests from one client before each crash. On patched versions, oversized requests are rejected with a log of "Request body exceeds maximum size". Watch memory use of the MCP server process for sudden jumps.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The readRequestBody() function in src/transports/http/server.ts concatenates HTTP request body chunks into a string with no size limit, allowing a remote unauthenticated attacker to crash the server via memory exhaustion with a single large HTTP POST request.

Details

File: src/transports/http/server.ts, lines 224-240

private async readRequestBody(req: IncomingMessage): Promise<any> {
    return new Promise((resolve, reject) => {
      let body = '';
      req.on('data', (chunk) => {
        body += chunk.toString();   // No size limit
      });
      req.on('end', () => {
        try {
          const parsed = body ? JSON.parse(body) : null;
          resolve(parsed);
        } catch (error) {
          reject(error);
        }
      });
      req.on('error', reject);
    });
  }

A maxMessageSize configuration value exists in DEFAULT_HTTP_STREAM_CONFIG (4MB, defined in src/transports/http/types.ts line 124) but is never enforced in readRequestBody(). This creates a false sense of security.

PoC

Local testing with 50MB POST payloads against the vulnerable readRequestBody() function:

| Trial | Payload | RSS growth | Time | Result |
| 1 | 50MB | +197MB | 42ms | Vulnerable |
| 2 | 50MB | +183MB | 46ms | Vulnerable |
| 3 | 50MB | +15MB | 43ms | Vulnerable |
| 4 | 50MB | +14MB | 32ms | Vulnerable |
| 5 | 50MB | +65MB | 38ms | Vulnerable |

Reproducibility: 5/5 (100%)

Impact

  • Denial of Service: Any mcp-framework HTTP server can be crashed by a single large POST request to /mcp
  • No authentication required: readRequestBody() executes before any auth checks (auth is opt-in, default is no auth)
  • Dead config: maxMessageSize exists but is never enforced, giving a false sense of security
  • Affected: All applications using mcp-framework HttpStreamTransport (60,000 weekly npm downloads)

CWE-770: Allocation of Resources Without Limits or Throttling Suggested CVSS 3.1: 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)

Suggested Fix

Enforce maxMessageSize in readRequestBody():

private async readRequestBody(req: IncomingMessage): Promise<any> {
    const maxSize = this._config.maxMessageSize || 4 * 1024 * 1024;
    return new Promise((resolve, reject) => {
      let body = '';
      let size = 0;
      req.on('data', (chunk) => {
        size += chunk.length;
        if (size > maxSize) {
          req.destroy();
          reject(new Error('Request body too large'));
          return;
        }
        body += chunk.toString();
      });
      // ...
    });
  }

Disclosure Timeline

This report follows coordinated disclosure. I request a 90-day window before public disclosure.

Reporter: Raza Sharif, CyberSecAI Ltd ([email protected])

Credited to razashariff.

Questions

Does the attacker need to authenticate?

No. The body is read before any authentication check, and auth in mcp-framework is opt-in and off by default.

Does setting maxMessageSize protect me on 0.2.21?

No. The setting exists with a 4 MB default but readRequestBody() never checked it before the fix in 0.2.22.

Does this affect stdio servers?

The flaw is in the HTTP transport's request handler, so it applies to servers using the HTTP stream transport and not to stdio ones.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Other MCP servers and tools vulnerabilities

All Other MCP servers and tools entries