Executive brief
The MCP PHP SDK's HTTP client transport accumulates Server-Sent-Events (SSE) stream data in an unbounded in-memory buffer without enforcing any size limit. A remote server or network attacker that withholds the event delimiter (`\n\n`) can cause the buffer to grow indefinitely, exhausting the client's available memory and crashing the process. This is a denial-of-service attack against any client connecting to a malicious or compromised MCP server.
Technical details
The vulnerability exists in the `HttpTransport::processSSEStream()` method (line 203 of `src/Client/Transport/HttpTransport.php`), which reads up to 4096-byte chunks from an SSE response stream and appends them directly to `$this->sseBuffer` with no length validation. The buffer is only flushed when a complete SSE event delimiter (`\n\n`) is encountered; if the server never sends this delimiter, the buffer grows without bound across successive `tick()` loop iterations. A remote MCP server (or a network attacker intercepting plaintext responses) can stream arbitrary data without delimiters to force unbounded buffer accumulation. The attack requires network-level access to the server's SSE response body but no prior authentication. Proof-of-concept testing confirms that a 400 MB delimiter-free stream exhausts a 256 MB PHP memory limit. The fix, provided in version 0.7.1, bounds the SSE buffer length and aborts the stream when it exceeds a configured maximum (e.g., 8 MiB) without receiving a complete event.
Affected products
- modelcontextprotocol php-sdk >=0.5.0, <0.7.1
Timeline
- 2026-08-14: disclosed
- 2026-08-19: advisory: GHSA-7m52-jw36-44r3 published
- 2026-09-01: patched: Fix released in version 0.7.1