CVE-2025-66414: @modelcontextprotocol/sdk TypeScript SDK Lacks Default DNS Rebinding Protection
Summary
CVE-2025-66414: Model Context Protocol (MCP) TypeScript SDK does not enable DNS rebinding protection by default. Affects @modelcontextprotocol/sdk versions < 1.24.0. Fixed in 1.24.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The @modelcontextprotocol/sdk is a TypeScript SDK designed for implementing the Model Context Protocol (MCP), which facilitates communication between clients and servers in a structured manner. This SDK is particularly useful for developers building HTTP-based servers. However, it has a significant security oversight regarding DNS rebinding protection, which can expose local servers to malicious attacks if not properly configured.
Vulnerability Detail
The vulnerability arises from the @modelcontextprotocol/sdk not enabling DNS rebinding protection by default for HTTP-based servers. When an MCP server is run on localhost without authentication using StreamableHTTPServerTransport or SSEServerTransport, and the enableDnsRebindingProtection option is not activated, an attacker can exploit DNS rebinding. This allows the attacker to bypass same-origin policy restrictions, potentially invoking tools or accessing resources on the local MCP server on behalf of the user. This poses a serious risk, especially in scenarios where sensitive operations are performed on the server.
How To Fix
Minimum fixed version
1.24.0
This is the first release that contains the fix.
npm install @modelcontextprotocol/sdk@1.24.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
For users with custom Express configurations who cannot upgrade immediately, it is advised to apply the exported hostHeaderValidation() middleware when running an unauthenticated server on localhost. This can be done by adding the following code to your server setup:
const { hostHeaderValidation } = require('@modelcontextprotocol/sdk');
app.use(hostHeaderValidation());
Conclusion
The @modelcontextprotocol/sdk vulnerability (CVE-2025-66414) highlights the importance of enabling DNS rebinding protection for HTTP-based servers. By updating to version 1.24.0 or later and applying necessary middleware configurations, developers can secure their applications against potential attacks. Utilizing tools like Vulert can further enhance security by providing real-time vulnerability monitoring.
See every vulnerability recorded for @modelcontextprotocol/sdk →
FAQ
DNS rebinding is a technique that allows an attacker to bypass the same-origin policy in web browsers, enabling them to send requests to a local server from a malicious website.
You can check if your application is affected by using the Vulert playground at Vulert Scanner, which monitors and alerts for open-source vulnerabilities without requiring any installation.
Running an MCP server without authentication exposes it to potential attacks, including unauthorized access to sensitive resources and operations, especially if DNS rebinding protection is not enabled.
While running MCP servers on localhost can be safe, it is crucial to implement proper security measures, such as enabling DNS rebinding protection and using authentication, to mitigate risks.
If you cannot upgrade immediately, ensure to implement the hostHeaderValidation() middleware in your Express configuration to provide a temporary safeguard against DNS rebinding attacks.
References
Related vulnerabilities
Recent vulnerabilities recorded for @modelcontextprotocol/sdk.