GHSA-9x8x-crjq-g64h / CVE-2026-77359: Jupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routes
- Source:
- GitHub Security Advisories
- Published:
- Fetched:
- Updated:
- Affects:
- jupyter-mcp-server
https://github.com/advisories/GHSA-9x8x-crjq-g64h ↗
Jupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routes Standalone `streamable-http` mode in `datalayer/jupyter-mcp-server` rejects forged `Host` and `Origin` headers on `/mcp`, but custom management routes mounted on the same application do not get the same browser-origin protection. A malicious website can keep an attacker origin while its hostname resolves to `127.0.0.1` or a private target address, then send `PUT /api/connect` to replace the MCP server's active Jupyter backend. The route accepts the browser-shaped request and makes the server start a kernel client against attacker-controlled infrastructure. The protected `/mcp` endpoint shows the intended browser-origin boundary. With `MCP_TOKEN` configured, `/mcp` rejects forged browser headers: ```text POST /mcp with Authorization: Bearer SCAN_MCP_TOKEN Host: attacker.example:8142 Origin: http://attacker.example:8142 HTTP 421 Invalid Host header ``` The vulnerable route is `jupyter_mcp_server/server.py:143-187`. It parses caller JSON, updates the active Jupyter backend configuration, resets `ServerContext`, and starts the kernel without applying the `/mcp` Host/Origin rejection to the custom route: ```python @mcp.custom_route("/api/connect", ["PUT"]) async def connect(request: Request): data = await request.json() document_runtime = DocumentRuntime(**data) set_config( provider=document_runtime.provider, runtime_url=document_runtime.runtime_url, runtime_id=document_runtime.runtime_id, runtime_token=document_runtime.runtime_token, document_url=document_runtime.document_url, document_id=document_runtime.document_id, document_token=document_runtime.document_token, allowed_jupyter_tools=document_runtime.allowed_jupyter_tools or "notebook_run-all-cells,notebook_get-selected-cell" ) ServerContext.reset() try: __start_kernel() return JSONResponse({"success": True}) ``` `/api/stop` is also state-changing and accepts the same browser-origin route shape: ```python # jupyter_mcp_server/server.py:190-199 @mcp.custom_route("/api/stop", ["DELETE"]) async def stop(request: Request): try: current_notebook = notebook_manager.get_current_notebook() or "default" if current_notebook in notebook_manager: notebook_manager.remove_notebook(current_notebook) return JSONResponse({"success": True}) ``` ## Proof of concept Run the affected version with `MCP_TOKEN` configured: ```bash git clone https://github.com/datalayer/jupyter-mcp-server cd jupyter-mcp-server git checkout 27b91e551d8bbca2da32c334f9f13267290ff815 python3.12 -m venv .venv . .venv/bin/activate python -m pip install -e . 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 ``` First, show that `/mcp` rejects the browser-shaped request: ```http POST /mcp HTTP/1.1 Host: attacker.example:8083 Origin: http://attacker.example Affected packages: pip:jupyter-mcp-server Patched: jupyter-mcp-server 1.0.3