Skip to content

Commit 997e46c

Browse files
committed
Warn about DNS rebinding attacks
1 parent d3a35e4 commit 997e46c

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

docs/docs/concepts/transports.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ Use SSE when:
123123
- Working with restricted networks
124124
- Implementing simple updates
125125

126+
#### Security Warning: DNS Rebinding Attacks
127+
128+
SSE transports can be vulnerable to DNS rebinding attacks if not properly secured. To prevent this:
129+
130+
1. **Always validate Origin headers** on incoming SSE connections to ensure they come from expected sources
131+
2. **Avoid binding servers to all network interfaces** (0.0.0.0) when running locally - bind only to localhost (127.0.0.1) instead
132+
3. **Implement proper authentication** for all SSE connections
133+
134+
Without these protections, attackers could use DNS rebinding to interact with local MCP servers from remote websites.
135+
126136
<Tabs>
127137
<Tab title="TypeScript (Server)">
128138
```typescript
@@ -381,6 +391,8 @@ When implementing transport:
381391
- Handle denial of service scenarios
382392
- Monitor for unusual patterns
383393
- Implement proper firewall rules
394+
- For SSE transports, validate Origin headers to prevent DNS rebinding attacks
395+
- For local SSE servers, bind only to localhost (127.0.0.1) instead of all interfaces (0.0.0.0)
384396

385397
## Debugging Transport
386398

docs/specification/2024-11-05/basic/transports.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ sequenceDiagram
5050
In the **SSE** transport, the server operates as an independent process that can handle
5151
multiple client connections.
5252

53+
#### Security Warning
54+
55+
When implementing HTTP with SSE transport:
56+
57+
1. Servers **MUST** validate the `Origin` header on all incoming connections to prevent DNS rebinding attacks
58+
2. When running locally, servers **SHOULD** bind only to localhost (127.0.0.1) rather than all network interfaces (0.0.0.0)
59+
3. Servers **SHOULD** implement proper authentication for all connections
60+
61+
Without these protections, attackers could use DNS rebinding to interact with local MCP servers from remote websites.
62+
5363
The server **MUST** provide two endpoints:
5464

5565
1. An SSE endpoint, for clients to establish a connection and receive messages from the

docs/specification/2025-03-26/basic/transports.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ The server **MUST** provide a single HTTP endpoint path (hereafter referred to a
6767
**MCP endpoint**) that supports both POST and GET methods. For example, this could be a
6868
URL like `https://example.com/mcp`.
6969

70+
#### Security Warning
71+
72+
When implementing Streamable HTTP transport:
73+
74+
1. Servers **MUST** validate the `Origin` header on all incoming connections to prevent DNS rebinding attacks
75+
2. When running locally, servers **SHOULD** bind only to localhost (127.0.0.1) rather than all network interfaces (0.0.0.0)
76+
3. Servers **SHOULD** implement proper authentication for all connections
77+
78+
Without these protections, attackers could use DNS rebinding to interact with local MCP servers from remote websites.
79+
7080
### Sending Messages to the Server
7181

7282
Every JSON-RPC message sent from the client **MUST** be a new HTTP POST request to the

0 commit comments

Comments
 (0)