# GHSA-9J3P-GVW3-H8R8: SSE transport missing Host validation allows DNS rebinding

- Database: GitHub
- Severity: CVSS 7.5 (High)
- Published: 2026-09-29
- Modified: 2026-11-30

## Tracked as

- [CVE-2026-102735](https://cve.now/CVE-2026-102735.md): mcp-server-kubernetes DNS rebinding in SSE transport enables cluster takeover

## Affected versions

- mcp-server-kubernetes (npm): from 0.4.0

## Description

### Summary

In versions prior to 4.0.8, the SSE transport of `mcp-server-kubernetes` does not validate the `Host` header of incoming requests, which makes it vulnerable to DNS rebinding.

`mcp-server-kubernetes` can run as an HTTP server that lets an MCP client drive a Kubernetes cluster through 20+ tools (`kubectl_get`, `kubectl_apply`, `kubectl_delete`, `exec_in_pod`, `kubectl_generic`, Helm operations, node cordon/drain, etc.). It offers two HTTP transports. The Streamable HTTP transport validates the `Host` header by default (since `d08b554`), but the SSE transport never enabled this validation, even though the SDK class it uses supports it.

As a result, a malicious webpage can use DNS rebinding to turn the victim's own browser into a proxy to the SSE server, bypassing the Same-Origin Policy. If the optional `MCP_AUTH_TOKEN` is not set (it is not required, and several of the project's own SSE examples omit it), the attacker can invoke any tool with the server's cluster credentials after the victim opens the page, effectively gaining full control of the cluster.

### Affected and patched versions

- **Affected:** `< 4.0.8`, when the SSE transport is enabled (`ENABLE_UNSAFE_SSE_TRANSPORT=1`)
- **Patched:** `4.0.8`. `4.1.6` further hardens the default Host allowlist.
- **Not affected:** the default stdio transport

### Background: why DNS rebinding matters here

Browsers decide whether a request is same-origin based on the **hostname**, not the IP address it currently resolves to. DNS rebinding abuses this:

1. The attacker controls a domain (e.g. `evil.example`) and serves its DNS records with a very short TTL.
2. The victim opens `http://evil.example:<port>/`, and the browser records that as the page's origin.
3. After the page has loaded, the attacker changes the DNS record for `evil.example` to `127.0.0.1` (or another address the victim's browser can reach).
4. Once the browser's DNS cache expires, JavaScript on the page sends `fetch()` / `EventSource` requests to `http://evil.example:<port>/...`. The browser still treats them as same-origin, so no CORS checks apply and the page can read the responses, but the requests are now delivered to whatever is listening on `127.0.0.1:<port>`.
5. The main server-side defense specific to DNS rebinding is to check the `Host` (and/or `Origin`) header of each request against an allowlist: the browser fills `Host` with the attacker's hostname, and page JavaScript cannot change it. Authentication that the attacker's page cannot supply (such as `MCP_AUTH_TOKEN`) also blocks the attack.

The DNS rebinding protection option in `@modelcontextprotocol/sdk` exists precisely for this, and it was never enabled for the SSE transport.

### Details

#### Vulnerable call site

`src/utils/sse.ts` before 4.0.8 (constructor call on line 17):

```js
app.get("/sse", authMiddleware, async (req, res) => {
  const transport = new SSEServerTransport("/messages", res);
  transports.push(transport);
  await server.connect(transport);
});
```

The third constructor parameter (`options`) is never passed.

#### What the SDK does without `options`

`@modelcontextprotocol/sdk@1.26.0`, `dist/esm/server/sse.js`:

```js
constructor(_endpoint, res, options) {
    this._endpoint = _endpoint;
    this.res = res;
    this._sessionId = randomUUID();
    this._options = options || { enableDnsRebindingProtection: false };   // <-- default: OFF
}

validateRequestHeaders(req) {
    if (!this._options.enableDnsRebindingProtection) {
        return undefined;   // validation is skipped entirely
    }
    if (this._options.allowedHosts && this._options.allowedHosts.length > 0) {
        const hostHeader = req.headers.host;
        if (!hostHeader || !this._options.allowedHosts.includes(hostHeader)) {
            return `Invalid Host header: ${hostHeader}`;
        }
    }
    ...
}
```

Without `options`, `enableDnsRebindingProtection` is `false` and `validateRequestHeaders()` returns immediately, so no header is ever checked.

#### Where each transport validates headers

The two SDK transports call `validateRequestHeaders()` from different places (verified against the installed package, not just its type definitions):

- **`SSEServerTransport`** (`server/sse.js`)
  - `start()`, which handles the initial `GET /sse` handshake, **never** calls `validateRequestHeaders()`, regardless of configuration.
  - `handlePostMessage()`, which handles `POST /messages`, does call it (line 89), but it only enforces anything if `enableDnsRebindingProtection` was set at construction time.
- **`StreamableHTTPServerTransport`** (`server/webStandardStreamableHttp.js`)
  - `handleRequest()`, the single entry point for every `GET` / `POST` / `DELETE` on `/mcp`, calls it unconditionally before dispatching (around line 144).

In affected versions no options are passed, so the check in `handlePostMessage()` is a no-op and `POST /messages` is completely unprotected.

Even with protection enabled (as in 4.0.8 and later), a rebound `GET /sse` handshake still succeeds and returns a `sessionId`, because `start()` does not check headers. The follow-up `POST /messages`, which carries the actual tool call, is then rejected with `403`, so the exploitable path is closed. This SDK-level asymmetry may be worth raising upstream separately.

#### Correctly protected sibling code

`src/utils/streamable-http.ts` before 4.0.8 (lines 74–79):

```js
const transport = new StreamableHTTPServerTransport({
  sessionIdGenerator: undefined,
  enableDnsRebindingProtection,   // default-on since d08b554
  allowedHosts,                   // localhost / 127.0.0.1 allowlist from buildDefaultAllowedHosts()
});
```

### Supporting evidence (git history)

- `sse.ts` was introduced in `daa1ac6` (2025-03-23) and has shipped since 0.4.0. Until 4.0.8 it never included any Host/Origin validation.
- Four later commits touched the SSE transport (`HOST` support, health-check routes, `X-MCP-AUTH` authentication). None of them added validation.
- `d08b554` (2026-04-02) enabled DNS rebinding protection by default, but it **only modified `streamable-http.ts` and added `tests/dns-rebinding.test.ts`; `sse.ts` was not changed.** Its commit message describes this exact threat model:
  > "DNS rebinding protection was disabled by default... This is unsafe especially for Helm chart deployments that bind to 0.0.0.0, as any malicious webpage visited by a user on the same network could perform DNS rebinding to access the MCP server and invoke kubectl commands."
- `tests/dns-rebinding.test.ts` contains no references to `sse` or `SSEServerTransport`, so the regression tests added with that commit did not cover the SSE transport.

### Attack prerequisites

- The operator has enabled the SSE transport with `ENABLE_UNSAFE_SSE_TRANSPORT=1`. This is a documented configuration, with usage examples (including Docker) in `ADVANCED_README.md`.
- The victim's browser can reach the server's `HOST:PORT`. This includes the common local-development case of `HOST=localhost` / `127.0.0.1`. Deployments that bind to `HOST=0.0.0.0` (as in the `HOST=0.0.0.0` example in `ADVANCED_README.md`) are additionally exposed directly to anyone on the same network who can reach the port, without needing DNS rebinding. In that case a Host allowlist does not help, and `MCP_AUTH_TOKEN` is the relevant control.
- `MCP_AUTH_TOKEN` is not set. It is optional, and several of the project's documented SSE examples run without it.
- The victim opens an attacker-controlled webpage while the server is running and keeps it open long enough for DNS rebinding to complete. Browsers that implement Local Network Access (e.g. Chrome 142+) may additionally show a permission prompt that the victim must accept.

### Impact

An attacker can invoke any tool the server exposes, with the full privileges of the kubeconfig or service account the server process uses. Examples based on the server's own tool schemas (as returned by `tools/list` in the PoC):

| Tool | Annotation | Impact |
|---|---|---|
| `kubectl_get` (any resource, `allNamespaces: true`) | `readOnlyHint: true` | Read all cluster state, including `Secret` objects, across all namespaces |
| `kubectl_delete` | `destructiveHint: true` | Delete arbitrary resources across namespaces |
| `kubectl_apply` / `kubectl_create` | `destructiveHint: true` | Deploy attacker-controlled workloads, e.g. a privileged pod for lateral movement |
| `exec_in_pod` | `destructiveHint: true` | Run arbitrary commands in any container the server can reach |
| `install_helm_chart` | `destructiveHint: true` | Install attacker-supplied Helm charts from an arbitrary repository URL |
| `node_management` (`drain`) | `destructiveHint: true` | Forcibly evict workloads from cluster nodes |
| `kubectl_generic` | `destructiveHint: true` | Run arbitrary kubectl subcommands not covered by the dedicated tools |

When `MCP_AUTH_TOKEN` is configured, the attack is blocked: `authMiddleware` is applied to both `GET /sse` and `POST /messages`, and a rebinding page cannot know the token value. The missing Host validation still removes a layer of defense in depth, but exploitation in that configuration requires the attacker to obtain the token first.

### Proof of concept

The flaw can be reproduced locally with a fake kubeconfig (`K8S_SERVER=https://127.0.0.1:9999`); no real cluster is needed.

Start the SSE server (affected) and, for comparison, a Streamable HTTP server in a separate terminal:

```bash
# SSE transport (affected)
K8S_SERVER="https://127.0.0.1:9999" K8S_TOKEN="fake-token-for-poc" K8S_SKIP_TLS_VERIFY=true \
ENABLE_UNSAFE_SSE_TRANSPORT=1 PORT=3999 HOST=127.0.0.1 \
node dist/index.js

# Streamable HTTP transport (for comparison)
K8S_SERVER="https://127.0.0.1:9999" K8S_TOKEN="fake-token-for-poc" K8S_SKIP_TLS_VERIFY=true \
ENABLE_UNSAFE_STREAMABLE_HTTP_TRANSPORT=1 PORT=4000 HOST=127.0.0.1 \
node dist/index.js
```

**Step 1: send the same forged `Host` header to both transports**

```
# SSE accepts the forged Host header (the stream stays open; press Ctrl+C after the endpoint event)
$ curl -sD - "http://127.0.0.1:3999/sse" -H "Host: evil.com:3999"
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/event-stream

event: endpoint
data: /messages?sessionId=8d22ab86-6003-44db-8f04-021a15b4afc1

# Streamable HTTP rejects the same forged Host header
$ curl -s -w "\nHTTP Status: %{http_code}\n" "http://127.0.0.1:4000/mcp" -H "Host: evil.com:4000" \
    -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"poc","version":"1.0"}}}'
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Invalid Host header: evil.com:4000"},"id":null}
HTTP Status: 403
```

**Step 2: full chain (open a session, send a request, read the result)**

```
# Terminal A: open an SSE stream with a forged Host header and keep it open
$ curl -sN "http://127.0.0.1:3999/sse" -H "Host: evil.com:3999"
event: endpoint
data: /messages?sessionId=8d22ab86-6003-44db-8f04-021a15b4afc1

# Terminal B: send an MCP JSON-RPC request on that session, still with the forged Host header
$ curl -s -w "\nHTTP Status: %{http_code}\n" \
    "http://127.0.0.1:3999/messages?sessionId=8d22ab86-6003-44db-8f04-021a15b4afc1" \
    -H "Host: evil.com:3999" -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Accepted
HTTP Status: 202

# The result arrives asynchronously on Terminal A's open stream:
event: message
data: {"result":{"tools":[{"name":"cleanup",...},{"name":"kubectl_get",...},
       {"name":"kubectl_delete","annotations":{"destructiveHint":true},...},
       {"name":"kubectl_apply","annotations":{"destructiveHint":true},...},
       {"name":"exec_in_pod","annotations":{"destructiveHint":true},...},
       {"name":"kubectl_generic","annotations":{"destructiveHint":true},...},
       ...]},"jsonrpc":"2.0","id":1}
```

In a real attack, the `tools/list` call in Step 2 would be a `tools/call` invoking, for example, `kubectl_delete` or `exec_in_pod`. `tools/list` is used here only to make the result unambiguous and non-destructive.

The PoC was reproduced on two independent clones of the repository with identical results.

## References

- https://github.com/Flux159/mcp-server-kubernetes/security/advisories/GHSA-9j3p-gvw3-h8r8

Page: https://cve.now/GHSA-9J3P-GVW3-H8R8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
