Skip to content

AAK-MCPFRAME-001: mcp-framework below 0.2.22 HTTP-body DoS

Severity
MEDIUM
Category
Transport Security (transport-security)
Scanner
agent_audit_kit/scanners/transport_limits.py
Auto-fixable
No.
SARIF name
McpFrameworkHttpBodyDos

What it detects

Project depends on mcp-framework at a version < 0.2.22, or a TS/JS file implements an MCP HTTP transport that concatenates request body chunks into a string without consulting Content-Length or a maxMessageSize guard. CVE-2026-39313 lets an unauthenticated attacker crash the server with a single large POST to /mcp by exhausting process memory. Fixed in 0.2.22.

How to fix

Upgrade mcp-framework to 0.2.22 or newer. For custom transports, enforce a hard body-size cap before accumulating chunks — reject early when Content-Length exceeds your maxMessageSize.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCPFRAME-001

Limitations

Fires on a TypeScript or JavaScript file that reads a request body with req.on('data', ...), for await (... of req) or a function called readRequestBody and appends chunks to a variable named body, data, buf or chunks (a leading underscore allowed, as in this._body), with += of a name or of its .toString(...), or with .push(chunk), in code rather than a comment, and has no size check. A comparison with <, >, <= or >= of total, length or size against a number literal anywhere in the file, such as parts.length > 0, counts as a size check, and an accumulator under another name (raw += chunk) is not matched. A req.on('data', ...) whose first ) comes more than 1,024 characters after the comma, as behind a long comment in the handler, is not read as a body read; on 88,502 TS/JS files it came at most 36 after. The version pin judges a git reference, a tarball and a workspace: spec by the release they name, with releases compared on their first three numbers, so a pre-release of the fix (#v0.2.22-rc.1) reads as the fix, and it does not read a package.json over 2 MB. A source file over 512 KB is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCPFRAME-001.md: the page then shows that text, with the registry reference appended under it.