{"id":"CVE-2026-116685","aliases":["GHSA-5h93-6whr-6q8j"],"title":"Model Context Protocol Python SDK: HTTP client transports followed cross-origin redirects carrying custom headers and bodies","titleSource":"GitHub_M","descriptionSource":"OSV","declaredSeverity":"MODERATE","description":"### Summary\nIn affected versions, the SDK's Streamable HTTP and SSE client transports followed HTTP redirects to any host. If the configured MCP endpoint answered with a redirect to a different origin:\n\n- custom headers set on the client (for example an `X-API-Key` credential) were sent to that origin, and\n- on a `307` or `308` redirect the request body was re-sent there too.\n\nThe SDK's OAuth client providers followed redirects on their own discovery, registration and token requests in the same way.\n\nA lone `Authorization` bearer header was not exposed; the HTTP library already drops it on cross-origin redirects.\n\nAnyone able to make an endpoint you trust redirect elsewhere (a stale redirect to a lapsed domain, a misrouted proxy rule, redirect logic an attacker can influence) could capture that material. A server that is itself malicious gains nothing this way; it already receives your requests directly.\n\n### Am I affected?\nYes, if your code uses the SDK as an MCP client over HTTP through any of:\n\n- `streamable_http_client` (on 2.x also `Client` given an `http://` or `https://` URL)\n- `streamablehttp_client` or `sse_client`\n- `ClientSessionGroup` with HTTP server parameters\n- the internal `create_mcp_http_client` helper\n\nThis includes an HTTP client you passed in yourself with `follow_redirects=True`.\n\nAffected versions: 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1.\n\nNot affected:\n\n- MCP servers\n- stdio clients\n- a client you supplied with `follow_redirects` left at its default of `False`\n\n### Fix\nUpgrade to `mcp` 1.30.0 (1.x) or 2.2.0 (2.x) or later; no code changes are needed.\n\nThe transports, and the OAuth providers' own requests, now follow a redirect only when it stays on the endpoint's origin (same scheme, host and port, or an `http` to `https` upgrade on the same host) and keeps the request method. Any other redirect is not followed and the request fails with an error naming the target (`MCPError` on 2.x, `httpx.HTTPStatusError` on 1.x), whichever HTTP client the transport uses. The internal `create_mcp_http_client` helper no longer turns redirect following on, so code calling it directly now receives the redirect response instead.\n\nIf your client currently reaches its server through a redirect to another host, including a server that needs no credentials, it will stop connecting after the upgrade: set the endpoint URL to the redirect's target.\n\nUntil you can upgrade, supply your own HTTP client with `follow_redirects` left at `False` (`http_client=` on `streamable_http_client`; `httpx_client_factory=` on `sse_client` and `streamablehttp_client`; `ClientSessionGroup` has no such parameter). If a client may already have followed a redirect to a host you do not control, rotate the credentials it carried.\n\n<details>\n<summary>If you genuinely need the old behaviour (unsupported)</summary>\n\nThis restores what this advisory fixes: redirects to any host are followed again, carrying your custom headers and, on `307`/`308`, the request body, OAuth token requests included. Prefer setting the endpoint URL to the redirect's target. If you cannot, and you accept forwarding credentials to the redirect target, give the transport an HTTP client that follows redirects regardless of what the SDK asks for:\n\n```python\nimport httpx2  # on 1.x: import httpx and subclass httpx.AsyncClient instead\n\nclass FollowRedirectsAnyway(httpx2.AsyncClient):\n    \"\"\"Follows redirects to ANY origin. Deliberately gives up the SDK's same-origin protection.\"\"\"\n\n    async def send(self, request, *, follow_redirects=False, **kwargs):\n        return await super().send(request, follow_redirects=True, **kwargs)\n\nhttp_client = FollowRedirectsAnyway(timeout=httpx2.Timeout(30, read=300))\n# streamable_http_client(url, http_client=http_client)\n\n# sse_client / streamablehttp_client take a factory instead:\ndef client_factory(headers=None, timeout=None, auth=None):\n    return FollowRedirectsAnyway(headers=headers, auth=auth,\n                                 timeout=timeout if timeout is not None else httpx2.Timeout(30, read=300))\n# sse_client(url, httpx_client_factory=client_factory)\n```\n\nThe redirect handling is then the HTTP library's own, as before the fix: a lone `Authorization` header is still dropped on cross-origin hops and `301`/`302`/`303` become `GET`. It is not something the SDK supports or tests.\n\n</details>\n\n---","severity":"medium","score":5.9,"published":"2026-10-27T19:26:46.926Z","modified":"2026-10-27T21:15:03.819Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"PyPI","name":"mcp","sources":[{"name":"OSV · GHSA-5h93-6whr-6q8j","url":"https://osv.dev/vulnerability/GHSA-5h93-6whr-6q8j"}],"ranges":[{"events":[{"introduced":"2.0.0"},{"fixed":"2.2.0"}],"type":"ECOSYSTEM"}],"versions":["2.0.0","2.0.1","2.1.0","2.1.1"],"fixed":["2.2.0"]},{"ecosystem":"PyPI","name":"mcp","sources":[{"name":"OSV · GHSA-5h93-6whr-6q8j","url":"https://osv.dev/vulnerability/GHSA-5h93-6whr-6q8j"}],"ranges":[{"events":[{"introduced":"1.8.0"},{"fixed":"1.30.0"}],"type":"ECOSYSTEM"}],"versions":["1.10.0","1.10.1","1.11.0","1.12.0","1.12.1","1.12.2","1.12.3","1.12.4","1.13.0","1.13.1","1.14.0","1.14.1","1.15.0","1.16.0","1.17.0","1.18.0","1.19.0","1.20.0","1.21.0","1.21.1","1.21.2","1.22.0","1.23.0","1.23.1","1.23.2","1.23.3","1.24.0","1.25.0","1.26.0","1.27.0","1.27.1","1.27.2","1.28.0","1.28.1","1.29.0","1.29.1","1.8.0","1.8.1","1.9.0","1.9.1","1.9.2","1.9.3","1.9.4"],"fixed":["1.30.0"]}],"sourceAffected":[],"references":["https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-5h93-6whr-6q8j","https://github.com/modelcontextprotocol/python-sdk/pull/3397","https://github.com/modelcontextprotocol/python-sdk/pull/3448","https://github.com/modelcontextprotocol/python-sdk/commit/2106335745563b2321b8c73fef2c12903d00aa6e","https://github.com/modelcontextprotocol/python-sdk/commit/c6762e821c527925f0b617db216d00fbd1d0bf99","https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0","https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0","https://github.com/modelcontextprotocol/python-sdk"],"sources":[{"name":"CVE","id":"CVE-2026-116685","modified":"2026-10-27T19:26:46.926Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-116685"},{"name":"OSV","id":"GHSA-5h93-6whr-6q8j","modified":"2026-10-27T21:15:03.819223133Z","url":"https://osv.dev/vulnerability/GHSA-5h93-6whr-6q8j"}],"assessments":[{"source":"GitHub_M","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9},{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9}],"products":[{"vendor":"modelcontextprotocol","name":"python-sdk","platforms":[],"versions":[{"version":">= 1.8.0, < 1.30.0","status":"affected"},{"version":">= 2.0.0, < 2.2.0","status":"affected"}],"source":"GitHub_M","url":"https://www.cve.org/CVERecord?id=CVE-2026-116685"}],"remediation":[],"kev":{"status":"not-listed","checkedAt":"2026-10-28T09:55:31.018Z"},"coverage":[{"source":"NVD","status":"not-checked"},{"source":"GHSA","status":"not-checked"},{"source":"EUVD","status":"not-checked"},{"source":"EPSS","status":"not-checked"}],"evidence":[]}