CVE-2025-66416·Python vulnerability
The MCP Python SDK, called `mcp` on PyPI, is a Python implementation of the Model Context Protocol (MCP). Prior to version 1.23.0, tThe 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. This vulnerability is fixed in 1.23.0.
- Severity
- high
- Software
- Python
- Fixed in
- 1.23.0
- Published
- 2025-12-02
Affected versions
Until: 1.23.0
Fixed in: 1.23.0
How to fix this CVE
Update the MCP Python SDK to version 1.23.0 or later to enable DNS rebinding protection by default. This fix is critical for environments running HTTP-based MCP servers on localhost without authentication, especially when using FastMCP with streamable HTTP or SSE transport. Ensure TransportSecuritySettings are properly configured after patching to strengthen your security posture.
sudo dnf update python3-mcp || pip3 install --upgrade mcp>=1.23.0Defensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
GET / HTTP/1.1
Host: localhost:port
Origin: http://attacker-controlled-domain.com
Referer: http://attacker-controlled-domain.com/
Content-Type: application/jsonWAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
Implement DNS rebinding protection at the network level by validating the Host header against a whitelist of expected values. Block requests where the Host header contains localhost or 127.0.0.1 originating from non-local sources. Configure your WAF to deny cross-origin requests to localhost endpoints without proper CORS headers and authentication tokens.How to check if you are affected
- Run `python3 -c "import mcp; print(mcp.__version__)"` to determine the installed MCP SDK version on each system.
- Check for FastMCP server instances with HTTP/SSE transport: `ps aux | grep fastmcp` or `grep -r 'fastmcp' /opt/ /srv/ /home/ --include='*.py' 2>/dev/null`.
- Examine application logs for unusual HTTP requests to localhost from external origins by searching for DNS rebinding patterns: `grep -E '(Host: localhost|127\.0\.0\.1)' /var/log/*/access.log /var/log/*/error.log 2>/dev/null | grep -v '^127\.' | head -20`.
- Verify the fix by running `pip3 show mcp | grep Version` and confirming the version is 1.23.0 or higher.
FAQ
What is CVE-2025-66416?
CVE-2025-66416 is a DNS rebinding vulnerability in the MCP Python SDK that allows attackers to bypass same-origin policy restrictions and send unauthorized requests to local HTTP-based MCP servers without authentication. This could lead to attackers invoking tools or accessing resources exposed by the server.
Is CVE-2025-66416 being actively exploited?
No, this vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently available. However, the technical barrier to exploitation is low once the DNS rebinding protection gap is understood.
What versions of Python MCP SDK are affected by CVE-2025-66416?
All versions of the MCP Python SDK prior to version 1.23.0 are affected. Versions 1.23.0 and later include DNS rebinding protection by default.
How do I check if my server is vulnerable to CVE-2025-66416?
Run `pip3 show mcp | grep Version` to check the installed MCP SDK version. If the version is below 1.23.0, your system is vulnerable. Additionally, verify if you are running HTTP-based MCP servers on localhost without authentication using `ps aux | grep -i mcp` or checking your application configuration files.
Does Defensia detect CVE-2025-66416?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the MCP Python SDK is installed on a monitored server, CVE-2025-66416 will appear in your dashboard with remediation steps.
Related Python CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2025-66416. Free for 1 server.
Get started free