Enable DNS rebinding protection on local HTTP MCP servers
You will check every local HTTP MCP server and confirm DNS rebinding protection is active. This matters because a malicious website can reach an unauthenticated localhost server through DNS rebinding ([GitHub advisory GHSA-w48q-cv73-mx4w](https://github.com/advisories/GHSA-w48q-cv73-mx4w)).
- Find HTTP MCP serversStdio servers are not affected
- Update to 1.24.0Fix is in this version
- Check Express setupDefault applies via createMcpExpressApp()
- Add host header validationUse hostHeaderValidation() for custom Express
- Restart and confirmYour own client should still connect
Why it matters
HTTP-based MCP servers that run on localhost without authentication could be reached by a malicious website through DNS rebinding when enableDnsRebindingProtection was not set (GitHub advisory GHSA-w48q-cv73-mx4w (opens external site)). An attacker in that position can invoke tools or access resources on your behalf. Stdio servers are not affected, so this change applies to HTTP transport only.
Steps
- List every local MCP server you run over HTTP. Stdio-only servers are not affected and need no change.
- Update the MCP SDK for each HTTP server to 1.24.0, the version that carries the fix (GitHub advisory GHSA-w48q-cv73-mx4w (opens external site)). Rebuild and restart the server afterward.
- If your server is created with
createMcpExpressApp()and binds to localhost, the protection is enabled by default in 1.24.0 (GitHub advisory GHSA-w48q-cv73-mx4w (opens external site)). Confirm the version and the bind address. - If you build your own Express setup, apply the
hostHeaderValidation()middleware, which protects custom Express setups (GitHub advisory GHSA-w48q-cv73-mx4w (opens external site)). Add it before your MCP route handlers, and check your SDK's documentation for the exact import in your version. - Search your configuration for
enableDnsRebindingProtectionand make sure it is not set to disable the protection, since its absence was the condition for exposure. - Restart the server and confirm it still answers requests from your own client.
- If a server does not need HTTP access, move it to stdio transport. Stdio servers are not affected by this issue (GitHub advisory GHSA-w48q-cv73-mx4w (opens external site)).
Common mistakes
- Upgrading the SDK but keeping a hand-written Express app that skips the middleware. The default only applies through
createMcpExpressApp(). - Assuming a server bound to a non-localhost address gets the same default. Check the bind address yourself.
- Leaving unauthenticated HTTP servers running when you no longer use them. Stop them.
- Treating this fix as the whole answer. Keep servers on localhost and limit the tools they expose.
Warnings
This change reduces risk from one attack path. It does not replace authentication or least-privilege tool design.
Checklist
0 of 8 done