CVE-2025-66416: Model Context Protocol (MCP) Python SDK does not enable DNS rebinding protection by default
The Python MCP SDK (pip package `mcp`) before 1.23.0 does not turn on DNS rebinding protection for HTTP servers by default. A local, unauthenticated `FastMCP` server using streamable HTTP or SSE can be driven by a hostile web page open in the user's browser. Upgrade to mcp 1.23.0.
Published Dec 2, 2025 · Updated Jul 16, 2026 · Analysis Nov 1, 2026
What an attacker can do
With streamable HTTP or SSE transport, the server used no TransportSecuritySettings unless the developer supplied them, so the Host header was not checked. DNS rebinding abuses that. The victim opens an attacker's site, whose domain is then re-pointed at 127.0.0.1. The browser still thinks it is talking to the attacker's origin, so it lets the page send requests to the MCP server and read the replies.
The preconditions are narrow: the server runs on localhost, has no authentication, and the user visits the page while it is running. CVSS 4.0 therefore marks passive user interaction and some attack requirements.
The attacker can then call any tool or read any resource the server offers, with the user's privileges. For Python MCP servers that wrap files, shells, databases or internal APIs, that means data theft or actions taken in the user's name. The advisory notes that unauthenticated local HTTP servers are already discouraged by MCP security guidance, and that stdio servers are unaffected.
Who is affected
The mcp package on PyPI below 1.23.0, when a server built with FastMCP runs over streamable HTTP or SSE on localhost without authentication and without TransportSecuritySettings. Servers written at the low level with StreamableHTTPSessionManager or SseServerTransport are also in scope, and they need explicit settings even on 1.23.0. stdio servers are not affected.
pip show mcpmcp
- Ecosystem
- PyPI
- Affected
- < 1.23.0
- Fixed in
- 1.23.0
- Check
pip show mcp
How to fix it
Upgrade to mcp 1.23.0:
pip install --upgrade "mcp>=1.23.0"From that version, FastMCP() enables DNS rebinding protection automatically when host is 127.0.0.1 or localhost. If you use StreamableHTTPSessionManager or SseServerTransport directly, configure TransportSecuritySettings yourself for any unauthenticated localhost server. The better fix is to add authentication or use stdio.
How to tell if you were hit
Inventory local Python MCP servers started with transport="streamable-http" or "sse" and check pip show mcp in each environment. In server access logs, requests whose Host is a public-looking domain instead of localhost or 127.0.0.1, or whose Origin is a website, suggest rebinding. So do tool calls that appear while no MCP client was in use.
Beam records MCP tool calls from AI coding agents, which helps when the same server is used by your agents. It does not see requests that a web page sends directly.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Description
The Model Context Protocol (MCP) Python SDK does not enable DNS rebinding protection by default for HTTP-based servers. When an HTTP-based MCP server is run on localhost without authentication using FastMCP with streamable HTTP or SSE transport, and has not configured TransportSecuritySettings, a malicious website could exploit DNS rebinding to bypass same-origin policy restrictions and send requests to the local MCP server. This could allow an attacker to invoke tools or access resources exposed by the MCP server on behalf of the user in those limited circumstances.
Note that running HTTP-based MCP servers locally without authentication is not recommended per MCP security best practices. This issue does not affect servers using stdio transport.
Servers created via FastMCP() now have DNS rebinding protection enabled by default when the host parameter is 127.0.0.1 or localhost. Users are advised to update to version 1.23.0 to receive this automatic protection. Users with custom low-level server configurations using StreamableHTTPSessionManager or SseServerTransport directly should explicitly configure TransportSecuritySettings when running an unauthenticated server on localhost.
Credited to JLLeitschuh.
Questions
- Are stdio MCP servers affected by CVE-2025-66416?
No. The advisory says servers using stdio transport are not affected. The risk is limited to HTTP-based servers, streamable HTTP or SSE, running on localhost without authentication.
- Do I need to change code after upgrading to 1.23.0?
Not if you use
FastMCP()bound to127.0.0.1orlocalhost, since protection is automatic. With low-levelStreamableHTTPSessionManagerorSseServerTransport, you must setTransportSecuritySettingsexplicitly.- Is this exploited in the wild?
No source for this entry reports exploitation, and it is not in CISA's KEV catalog. It needs a victim who visits a hostile page while running an unauthenticated local server.
References
Read for this analysis:
- https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-9h52-p55h-vw2f
- https://github.com/advisories/GHSA-9h52-p55h-vw2f
- https://github.com/modelcontextprotocol/python-sdk/commit/d3a184119e4479ea6a63590bc41f01dc06e3fa99
- https://nvd.nist.gov/vuln/detail/CVE-2025-66416
- https://github.com/modelcontextprotocol/python-sdk
- https://github.com/pypa/advisory-database/tree/main/vulns/mcp/PYSEC-2026-1617.yaml
- https://pypi.org/project/mcp
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More MCP Python SDK vulnerabilities
All MCP Python SDK entriesCVE-2026-116684
Model Context Protocol Python SDK: Server bearer-token authentication accepts tokens issued for a different resource server
medium6.8Oct 27, 2026CVE-2026-116685
Model Context Protocol Python SDK: HTTP client transports followed cross-origin redirects carrying custom headers and bodies
medium5.9Oct 27, 2026CVE-2026-116686
Model Context Protocol Python SDK: Client fetched server-chosen $ref URLs while validating tool results against output schemas
medium6.5Oct 27, 2026CVE-2026-59951
MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion
medium7.5Oct 15, 2026CVE-2026-52869
MCP Python SDK: HTTP transports serve session requests without verifying the authenticated principal
high7.1Jul 16, 2026CVE-2026-52870
MCP Python SDK: Experimental task handlers allow any client to access and cancel other clients' tasks
high7.6Jul 16, 2026
