Skip to content

fix: enable DNS rebinding protection by default for secure-by-default#2275

Closed
Jah-yee wants to merge 2 commits intomodelcontextprotocol:mainfrom
Jah-yee:fix/dns-rebinding-secure-by-default
Closed

fix: enable DNS rebinding protection by default for secure-by-default#2275
Jah-yee wants to merge 2 commits intomodelcontextprotocol:mainfrom
Jah-yee:fix/dns-rebinding-secure-by-default

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 11, 2026

Summary

Per issue #2269, the current default disables DNS rebinding protection, which makes MCP servers vulnerable to DNS rebinding attacks on local networks.

This change switches the default to secure-by-default (enable_dns_rebinding_protection=True), with developers able to explicitly opt-out for backwards compatibility if needed.

Changes

  • Changed default value of enable_dns_rebinding_protection from False to True in TransportSecurityMiddleware.__init__
  • Updated comment to reflect secure-by-default approach

Security Impact

With this change, developers following official examples and tutorials will have DNS rebinding protection enabled by default. Those who need backwards compatibility can explicitly disable it:

TransportSecuritySettings(enable_dns_rebinding_protection=False)

Reported by @hhhashexe (SkillFence Security)

Jah-yee added 2 commits March 12, 2026 01:21
…response

Per RFC 6749 Section 6, the authorization server MAY issue a new
refresh token in the refresh response. If omitted, the client must
preserve the existing one.

This fix prevents token refresh failures after the first refresh
when using OAuth providers that don't return refresh tokens in
responses (e.g., Google, Auth0 without rotation, Okta in persistent
token mode).

Fixes modelcontextprotocol#2270
Per issue modelcontextprotocol#2269, the current default disables DNS rebinding protection,
which makes MCP servers vulnerable to DNS rebinding attacks on local networks.

This change switches the default to secure-by-default (enable_dns_rebinding_protection=True),
with developers able to explicitly opt-out for backwards compatibility if needed.

Reported by @hhhashexe (SkillFence Security)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants