CVE-2026-33946: MCP Ruby SDK Insufficient Session Binding Allows SSE Vulnerability

HIGH
Advisory Identifier: GHSA-qvqr-5cv7-wh35
CWE-384 CWE-639
Published
Advisory Summary

CVE-2026-33946 is a HIGH insufficient session binding allows sse vulnerability (CWE-384: Session Fixation) affecting MCP Ruby SDK libraries in the RubyGems ecosystem. The issue involves insufficient session binding allows sse stream hijacking via session id replay. Remediation is available by upgrading affected packages to version 0.9.2.

CVE-2026-33946 at a Glance

CVE Identifier CVE-2026-33946
GHSA Identifier GHSA-qvqr-5cv7-wh35
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-384: Session Fixation
Affected Product MCP Ruby SDK
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2026-33946

To remediate this vulnerability, upgrade all affected MCP Ruby SDK dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mcp fixed: 0.9.2
Upgrade mcp to 0.9.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mcp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-33946, inspect your project dependencies for MCP Ruby SDK:

inspect dependencies for mcp

Analyze the terminal output to locate any version of MCP Ruby SDK in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-384: Session Fixation, where authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions. In MCP Ruby SDK, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The Ruby SDK's [streamable_http_transport.rb](https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server/transports/streamable_http_transport.rb) implementation contains a session hijacking vulnerability. An attacker who obtains a valid session ID can completely hijack the victim's Server-Sent Events (SSE) stream and intercept all real-time data. ### Details **Root Cause** The StreamableHTTPTransport implementation stores only one SSE stream object per session ID and lacks: - Session-to-user identity binding - Ownership validation when establishing SSE connections - Protection against multiple simultaneous connections to the same session ### PoC #### Vulnerable Code **File**: streamable_http_transport.rb - [L336-L339](https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server/transports/streamable_http_transport.rb#L336-L339): ``` def store_stream_for_session(session_id, stream) @mutex.synchronize do if @sessions[session_id] @sessions[session_id][:stream] = stream # OVERWRITES existing stream else stream.close end end end ``` #### Attack Scenario **Step 1**: Legitimate Session Establishment ``` POST / (initialize) → receives session_id: "abc123" GET / with Mcp-Session-Id: abc123 → SSE stream connected ``` Step 2: Session ID Compromise - An attacker obtains the session ID through various means (out of scope for this analysis) **Step 3**: Stream Hijacking ``` GET / with Mcp-Session-Id: abc123 @sessions["abc123"][:stream] = attacker_stream `# Victim's stream is REPLACED (silently disconnected) ``` **Step 4**: Data Interception - ALL subsequent tool responses/notifications go to the attacker - The legitimate user receives no data and has no indication of the hijacking #### Technical Details The vulnerability happens: **Client 1 connects (GET request)** ``` proc do |stream1| # ← Rack server provides stream1 for client 1 @sessions[session_id][:stream] = stream1 # Stored end ``` **Client 2 connects with SAME session ID (Attack!)** ``` proc do |stream2| # ← Rack provides stream2 for client 2 @sessions[session_id][:stream] = stream2 # REPLACES stream1! end ``` **Now when the server sends notifications:** ``` @sessions[session_id][:stream].write(data) # Goes to stream2 (attacker!) # stream1 (victim) receives nothing ``` **Comparison: Python SDK Protection** The Python SDK prevents this vulnerability by rejecting duplicate SSE connections: **Refer**: https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/streamable_http.py#L680-L685 ``` if GET_STREAM_KEY in self._request_streams: # pragma: no cover response = self._create_error_response( "Conflict: Only one SSE stream is allowed per session", HTTPStatus.CONFLICT, ) ``` When a duplicate connection attempt is detected, the Python SDK returns an HTTP 409 Conflict error, protecting the existing connection. **Recommended Mitigations** **For SDK Maintainers** - Implement User Binding: All SDKs should bind session IDs to authenticated user identities where possible. Currently only, go-sdk and csharp-sdk do user binding. - **Ruby SDK**: Prevent Duplicate Connections: Implement checks to reject or handle multiple simultaneous connections to the same session - **Improve Documentation**: Provide clear guidance on secure session management implementation for SDK consumers ### Steps To Reproduce: Please find attached two python client files demonstrating the attack **Terminal 1:** `ruby streamable_http_server.rb` Makes use of https://github.com/modelcontextprotocol/ruby-sdk/blob/main/examples/streamable_http_server.rb This server has a tool call notification_tool which the clients call **Terminal 2:** `python3 legitimate_client_ruby_server.py` **What happens:** - The client connects and prints the session ID - Press Enter to start the SSE stream - Notifications start appearing every 3 seconds as the client makes a tool call **Terminal 3 (while the legitimate client is running):** `python3 attacker_client_ruby_server.py <SESSION_ID>` Replace `<SESSION_ID>` with the ID from Terminal 2. **What happens immediately:** - Terminal 2 (Legitimate): Stops receiving notifications, shows disconnect message - Terminal 3 (Attacker): Starts receiving ALL the tool call responses ### Impact While the absence of user binding may not pose immediate risks if session IDs are not used to store sensitive data or state, the fundamental purpose of session IDs is to maintain stateful connections. If the SDK or its consumers utilize session IDs for sensitive operations without proper user binding controls, this creates a potential security vulnerability. For example: In the case of the Ruby SDK, the attacker was able to hijack the stream and receive all the tool responses belonging to the victim. The tool responses can be sensitive confidential data. ### Additional Details #### Session Hijacking Protection in MCP Implementations The MCP specification recommends - "MCP servers SHOULD bind session IDs to user-specific information". #### Current Implementation Status Across SDKs Of the 10 official MCP SDKs, only the following implementations bind session IDs to user-specific information: 1. csharp-sdk - https://github.com/modelcontextprotocol/csharp-sdk/blob/main/src/ModelContextProtocol.AspNetCore/SseHandler.cs#L93-L97 2. Go-sdk - https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/streamable.go#L281C1-L288C2 [attacker_client_ruby_server.py](https://github.com/user-attachments/files/25408485/attacker_client_ruby_server.py) [legitimate_client_ruby_server.py](https://github.com/user-attachments/files/25408486/legitimate_client_ruby_server.py) The remaining SDKs do not implement session-to-user binding. Most implementations only verify that a session ID exists, without validating ownership. Additionally, SDK documentation does not provide clear guidance on implementing secure session management, leaving security responsibilities unclear for SDK consumers.

CVE-2026-33946 Affected MCP Ruby SDK Versions

1 component(s)
Fixed Versions:
0.9.2
Product / Package Ecosystem Affected Versions Fixed Version
mcp
RubyGems
< 0.9.2
0.9.2

References

Frequently Asked Questions

What is CVE-2026-33946?
CVE-2026-33946 is a security vulnerability in MCP Ruby SDK involving Insufficient Session Binding Allows SSE Stream Hijacking via Session ID Replay under CWE-384: Session Fixation.
Which MCP Ruby SDK versions are affected?
Affected versions include releases prior to 0.9.2 across affected packages: mcp.
What version fixes CVE-2026-33946?
Upgrading to 0.9.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mcp affected?
Yes, mcp is affected in releases prior to 0.9.2. Upgrade your dependency to 0.9.2 or later.
What CWE is associated with CVE-2026-33946?
CVE-2026-33946 is classified under CWE-384: Session Fixation (Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.).
How can I check RubyGems dependencies for CVE-2026-33946?
Run the dependency tree command: 'inspect dependencies for mcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qvqr-5cv7-wh35",
  "modified" : "2026-03-30T20:10:39Z",
  "published" : "2026-03-27T18:36:45Z",
  "aliases" : [ "CVE-2026-33946" ],
  "summary" : "MCP Ruby SDK: Insufficient Session Binding Allows SSE Stream Hijacking via Session ID Replay",
  "details" : "### Summary\n\nThe Ruby SDK's [streamable_http_transport.rb](https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server/transports/streamable_http_transport.rb) implementation contains a session hijacking vulnerability. An attacker who obtains a valid session ID can completely hijack the victim's Server-Sent Events (SSE) stream and intercept all real-time data.\n\n### Details\n**Root Cause**\nThe StreamableHTTPTransport implementation stores only one SSE stream object per session ID and lacks:\n\n- Session-to-user identity binding\n- Ownership validation when establishing SSE connections\n- Protection against multiple simultaneous connections to the same session\n\n### PoC\n\n#### Vulnerable Code\n\n**File**: streamable_http_transport.rb - [L336-L339](https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server/transports/streamable_http_transport.rb#L336-L339):\n\n```\ndef store_stream_for_session(session_id, stream)\n  @mutex.synchronize do\n    if @sessions[session_id]\n      @sessions[session_id][:stream] = stream  # OVERWRITES existing stream\n    else\n      stream.close\n    end\n  end\nend\n```\n#### Attack Scenario\n**Step 1**: Legitimate Session Establishment\n```\nPOST / (initialize) → receives session_id: \"abc123\"\nGET / with Mcp-Session-Id: abc123 → SSE stream connected\n```\nStep 2: Session ID Compromise\n\n- An attacker obtains the session ID through various means (out of scope for this analysis)\n\n**Step 3**: Stream Hijacking\n\n```\nGET / with Mcp-Session-Id: abc123 \n@sessions[\"abc123\"][:stream] = attacker_stream `# Victim's stream is REPLACED (silently disconnected)\n```\n\n**Step 4**: Data Interception\n\n- ALL subsequent tool responses/notifications go to the attacker\n- The legitimate user receives no data and has no indication of the hijacking\n\n#### Technical Details\n\nThe vulnerability happens:\n\n**Client 1 connects (GET request)**\n\n```\nproc do |stream1|  # ← Rack server provides stream1 for client 1\n @sessions[session_id][:stream] = stream1  # Stored\nend\n```\n\n**Client 2 connects with SAME session ID (Attack!)**\n```\nproc do |stream2|  # ← Rack provides stream2 for client 2\n @sessions[session_id][:stream] = stream2  # REPLACES stream1!\nend\n```\n\n**Now when the server sends notifications:**\n\n```\n@sessions[session_id][:stream].write(data)  # Goes to stream2 (attacker!)\n# stream1 (victim) receives nothing\n```\n\n**Comparison: Python SDK Protection**\n\nThe Python SDK prevents this vulnerability by rejecting duplicate SSE connections:\n\n**Refer**: https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/streamable_http.py#L680-L685\n\n```\nif GET_STREAM_KEY in self._request_streams:  # pragma: no cover\n            response = self._create_error_response(\n                \"Conflict: Only one SSE stream is allowed per session\",\n                HTTPStatus.CONFLICT,\n            )\n```\n\nWhen a duplicate connection attempt is detected, the Python SDK returns an HTTP 409 Conflict error, protecting the existing connection.\n\n**Recommended Mitigations**\n**For SDK Maintainers**\n\n- Implement User Binding: All SDKs should bind session IDs to authenticated user identities where possible. Currently only, go-sdk and csharp-sdk do user binding.\n- **Ruby SDK**: Prevent Duplicate Connections: Implement checks to reject or handle multiple simultaneous connections to the same session\n- **Improve Documentation**: Provide clear guidance on secure session management implementation for SDK consumers\n\n### Steps To Reproduce:\n\nPlease find attached two python client files demonstrating the attack\n\n**Terminal 1:**\n`ruby streamable_http_server.rb`\n\nMakes use of https://github.com/modelcontextprotocol/ruby-sdk/blob/main/examples/streamable_http_server.rb\nThis server has a tool call notification_tool which the clients call\n\n**Terminal 2:**\n\n`python3 legitimate_client_ruby_server.py`\n\n**What happens:**\n\n- The client connects and prints the session ID\n- Press Enter to start the SSE stream\n- Notifications start appearing every 3 seconds as the client makes a tool call\n\n**Terminal 3 (while the legitimate client is running):**\n\n`python3 attacker_client_ruby_server.py <SESSION_ID>`\n\nReplace `<SESSION_ID>` with the ID from Terminal 2.\n\n**What happens immediately:**\n\n- Terminal 2 (Legitimate): Stops receiving notifications, shows disconnect message\n- Terminal 3 (Attacker): Starts receiving ALL the tool call responses\n\n### Impact\nWhile the absence of user binding may not pose immediate risks if session IDs are not used to store sensitive data or state, the fundamental purpose of session IDs is to maintain stateful connections. If the SDK or its consumers utilize session IDs for sensitive operations without proper user binding controls, this creates a potential security vulnerability. For example: In the case of the Ruby SDK, the attacker was able to hijack the stream and receive all the tool responses belonging to the victim. The tool responses can be sensitive confidential data.\n\n### Additional Details\n#### Session Hijacking Protection in MCP Implementations\nThe MCP specification recommends - \"MCP servers SHOULD bind session IDs to user-specific information\".\n\n#### Current Implementation Status Across SDKs\n\nOf the 10 official MCP SDKs, only the following implementations bind session IDs to user-specific information:\n\n1. csharp-sdk - https://github.com/modelcontextprotocol/csharp-sdk/blob/main/src/ModelContextProtocol.AspNetCore/SseHandler.cs#L93-L97\n2. Go-sdk - https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/streamable.go#L281C1-L288C2\n\n[attacker_client_ruby_server.py](https://github.com/user-attachments/files/25408485/attacker_client_ruby_server.py)\n[legitimate_client_ruby_server.py](https://github.com/user-attachments/files/25408486/legitimate_client_ruby_server.py)\nThe remaining SDKs do not implement session-to-user binding. Most implementations only verify that a session ID exists, without validating ownership. Additionally, SDK documentation does not provide clear guidance on implementing secure session management, leaving security responsibilities unclear for SDK consumers.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "mcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.9.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/ruby-sdk/security/advisories/GHSA-qvqr-5cv7-wh35"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33946"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/ruby-sdk/commit/db40143402d65b4fb6923cec42d2d72cb89b3874"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/3556146"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/src/ModelContextProtocol.AspNetCore/SseHandler.cs#L93-L97"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/go-sdk/blob/main/mcp/streamable.go#L281C1-L288C2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/streamable_http.py#L680-L685"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/modelcontextprotocol/ruby-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/ruby-sdk/blob/main/examples/streamable_http_server.rb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.9.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mcp/CVE-2026-33946.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-384", "CWE-639" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-27T18:36:45Z",
    "nvd_published_at" : "2026-03-27T22:16:21Z"
  }
}