You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implemented the fix for modelcontextprotocol/rust-sdk issue #1271 in crates/rmcp/src/transport/streamable_http_server/tower.rs. In validate_standard_headers, the InitializeRequest arm no longer returns Ok(()) blindly: a supplied Mcp-Method header is now checked against the body method (initialize), tolerating absence but rejecting contradiction with a header_mismatch JSON-RPC error (HTTP 400), mirroring the existing validate_header_matches_init_body pattern used for MCP-Protocol-Ve...
Analysis
Vulnerability Type: Header Validation Bypass Severity: High
Description
The initialize handshake was accepting contradictory Mcp-Method headers without validation, allowing middleboxes that route on headers to be exploited. The patch adds validation to reject supplied Mcp-Method headers that contradict the body method, preventing routing confusion between the header and actual request body that could lead to request smuggling or authentication bypass.
Affected Code
if matches!(&req.request, ClientRequest::InitializeRequest(_)) {
return Ok(());
}
Proof of Concept
POST /mcp HTTP/1.1
Content-Type: application/json
Mcp-Method: tools/list
Mcp-Protocol-Version: 2026-07-28
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2026-07-28", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}}
Before patch: Returns HTTP 200 and creates session despite contradictory header
After patch: Returns HTTP 400 with error code -32020 (header_mismatch)
Activity