CVE-2026-109527
Unbounded HTTP request body buffering leads to memory exhaustion.
- CVSS 7.5
- CWE-770
- Resource Management
- Remote
The Model Context Protocol Python SDK is the official Python SDK for Model Context Protocol servers and clients. In mcp versions before 1.29.1 and from 2.0.0a1 through 2.0.1, the Streamable HTTP session manager, SSE message endpoint, and OAuth authorization-server routes buffer complete HTTP request bodies without enforcing a maximum size. An unauthenticated remote client able to reach an affected endpoint can send a large declared or streamed request body that consumes multiple times the body size in process memory and can repeatedly exhaust memory or terminate the server. Stdio-only servers and deployments with an effective upstream request-size limit are not affected, and applications that use StreamableHTTPServerTransport directly remain responsible for enforcing their own limit. The standard SDK server applications and session managers are fixed in versions 1.29.1 and 2.1.0.
- CWE
- CWE-770
- CVSS base score
- 7.5
- Published
- 2026-10-14
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Model Context Protocol Python SDK
- Fixed by upgrading
- Yes
Solution
Upgrade the SDK to mcp ≥ 1.29.1 or ≥ 2.1.0 to apply the fix.
Vulnerable code sample
import asyncio
from mcp.http import StreamableHTTPServerTransport, Request, Response
MAX_BODY = 10 * 1024 * 1024 # 10 MB limit (for illustration)
class EchoServer:
def __init__(self, host='127.0.0.1', port=8080):
self.transport = StreamableHTTPServerTransport(host, port)
async def handle(self, request: Request) -> Response:
# VULNERABLE: reads entire request body into memory without size check
body = await request.read()
return Response(200, body=body)
async def start(self):
await self.transport.serve(self.handle)
def run(self):
asyncio.run(self.start())Patched code sample
import asyncio
from mcp.http import StreamableHTTPServerTransport, Request, Response
MAX_BODY = 10 * 1024 * 1024 # 10 MB limit
class EchoServer:
def __init__(self, host='127.0.0.1', port=8080):
self.transport = StreamableHTTPServerTransport(host, port)
async def handle(self, request: Request) -> Response:
# FIX: enforce maximum request body size before buffering
content_length = request.headers.get('Content-Length')
if content_length is None or int(content_length) > MAX_BODY:
return Response(413, body=b'Request Entity Too Large')
body = await request.readexactly(int(content_length))
return Response(200, body=body)
async def start(self):
await self.transport.serve(self.handle)
def run(self):
asyncio.run(self.start())Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Add Streamable HTTP request body limits (#3095) (modelcontextprotocol/python-sdk)
src/mcp/server/lowlevel/server.py,src/mcp/server/lowlevel/server.py · Server.streamable_http_app,src/mcp/server/mcpserver/server.py,src/mcp/server/mcpserver/server.py · MCPServer.run#3,src/mcp/server/mcpserver/server.py · MCPServer.run_streamable_http_async,src/mcp/server/mcpserver/server.py · MCPServer.streamable_http_app,src/mcp/server/streamable_http_manager.py,src/mcp/server/streamable_http_manager.py · StreamableHTTPASGIApp.__call__,src/mcp/server/streamable_http_manager.py · StreamableHTTPSessionManager.handle_request,src/mcp/server/streamable_http_manager.py · StreamableHTTPSessionManager.__init__ - [v1.x] Apply the request body limit to the SSE and OAuth endpoints (#3344) (modelcontextprotocol/python-sdk)
src/mcp/server/auth/routes.py,src/mcp/server/auth/routes.py · cors_middleware,src/mcp/server/auth/routes.py · create_auth_routes,src/mcp/server/fastmcp/server.py,src/mcp/server/fastmcp/server.py · FastMCP.sse_app,src/mcp/server/sse.py,src/mcp/server/sse.py · SseServerTransport.handle_post_message,src/mcp/server/sse.py · SseServerTransport.__init__,src/mcp/server/streamable_http_manager.py,src/mcp/server/transport_security.py - Apply the request body limit to the SSE and OAuth endpoints (#3336) (modelcontextprotocol/python-sdk)
src/mcp/server/auth/routes.py,src/mcp/server/auth/routes.py · create_auth_routes,src/mcp/server/lowlevel/server.py,src/mcp/server/mcpserver/server.py,src/mcp/server/mcpserver/server.py · MCPServer.run#2,src/mcp/server/mcpserver/server.py · MCPServer.run_sse_async,src/mcp/server/mcpserver/server.py · MCPServer.sse_app,src/mcp/server/sse.py,src/mcp/server/sse.py · SseServerTransport.handle_post_message,src/mcp/server/sse.py · SseServerTransport.__init__,src/mcp/server/streamable_http_manager.py,src/mcp/server/transport_security.py - [v1.x] Add Streamable HTTP request body limits (#3101) (modelcontextprotocol/python-sdk)
src/mcp/server/fastmcp/server.py,src/mcp/server/fastmcp/server.py · FastMCP.streamable_http_app,src/mcp/server/fastmcp/server.py · FastMCP.__init__,src/mcp/server/streamable_http_manager.py,src/mcp/server/streamable_http_manager.py · StreamableHTTPSessionManager.handle_request,src/mcp/server/streamable_http_manager.py · StreamableHTTPSessionManager.__init__
Cite this entry
@misc{vaitp:cve2026109527,
title = {{Unbounded HTTP request body buffering leads to memory exhaustion.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-109527},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-109527/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
