{"id":"CVE-2026-137189","aliases":["CVE-2026-137189","GHSA-f8rf-rcrx-h6r9"],"related":[],"kind":"vulnerability","state":"published","title":"Jupyter MCP Server: Host-header spoof bypasses the CVE-2026-77359/GHSA-9x8x-crjq-g64h fix","summary":"Jupyter MCP Server is a Model Context Protocol server for Jupyter. Prior to 2.1.3, ManagementRouteSecurityMiddleware in jupyter_mcp_server/server.py checks request.url.hostname rather than the actual TCP peer before permitting access to /api/connect, /api/stop, and /api/healthz. Starlette derives that hostname from the client-supplied Host header, so a remote caller can supply a localhost Host value to pass the check. The server binds to all network interfaces by default. In --insecure-mcp-noauth mode, the caller can replace the active Jupyter backend configuration; in --mcp-token mode the state-changing routes still require a valid bearer token, while the health route remains reachable. This issue is fixed in 2.1.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Jupyter MCP Server is a Model Context Protocol server for Jupyter. Prior to 2.1.3, ManagementRouteSecurityMiddleware in jupyter_mcp_server/server.py checks request.url.hostname rather than the actual TCP peer before permitting access to /api/connect, /api/stop, and /api/healthz. Starlette derives that hostname from the client-supplied Host header, so a remote caller can supply a localhost Host value to pass the check. The server binds to all network interfaces by default. In --insecure-mcp-noauth mode, the caller can replace the active Jupyter backend configuration; in --mcp-token mode the state-changing routes still require a valid bearer token, while the health route remains reachable. This issue is fixed in 2.1.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe fix for CVE-2026-77359/CVE-2026-77318 (GHSA-9x8x-crjq-g64h) added a middleware that checks whether `request.url.hostname` is `localhost`/`127.0.0.1`/`::1` before allowing access to the `/api/connect`, `/api/stop`, and `/api/healthz` management routes. That check reads Starlette's parsed URL, which is built from the client-supplied `Host` header whenever one is present - not from the actual TCP peer address. A single request with a forged `Host: localhost` header, regardless of where it actually originates, passes the check.\n\n## Details\n\n- `jupyter_mcp_server/server.py:105-169` - `ManagementRouteSecurityMiddleware.dispatch` and `_is_local_hostname` (lines 110-111) do a pure string comparison against the parsed Host header, never referencing `request.client` or `scope[\"client\"]` (confirmed via grep - neither appears anywhere in this file).\n- Confirmed against the actual pinned dependency: `starlette==1.6.0`'s `datastructures.py` builds `URL.netloc` from `scope[\"headers\"]`'s host entry (validated only against a syntax regex) whenever present, falling back to `scope[\"server\"]` (the real bind address) only if the header is absent or malformed.\n- `utils.py:429` - the server still binds `0.0.0.0` by default, so this is reachable from the network, not just localhost.\n\n## Proof of Concept\n\nStarted the real server (`--insecure-mcp-noauth --transport streamable-http`).\n\n`curl -X PUT /api/connect -H \"Host: evil.com\"` correctly returns 421 Misdirected Request.\n\nThe same request with `-H \"Host: localhost\"` and a full attacker-controlled payload (`code_sandbox_url`, `document_url`, tokens) is accepted - server logs confirm the `connect()` handler ran, `DocumentCodeSandbox(**data)` validated, and `set_config()` overwrote the live server's `code_sandbox_url` with the attacker's URL, followed by the server actually attempting to connect a kernel to attacker infrastructure.\n\n## Scoping\n\nIn `--mcp-token` (secure) mode, `/api/connect` and `/api/stop` still correctly require a valid bearer token after the Host check passes, so the spoof alone doesn't achieve full config hijack there - only `/api/healthz` is reachable via the spoof in that mode, which is a lower-severity status/info-disclosure gap, not a full takeover. The full critical-severity impact (unauthenticated backend hijack) is specific to `--insecure-mcp-noauth` mode, which your own CLI already labels \"NOT recommended for production\" - but that mode's entire security guarantee currently rests on this one check, and it fails completely.\n\n## Duplicate check\n\nBoth existing advisories were read in full - neither describes Host-header string forgery as a bypass mechanism (GHSA-9x8x's PoC used DNS rebinding; this needs no DNS trickery at all, just one header). No commit since the fix (`c2e98fc`) has touched `_is_local_hostname` or the middleware. The existing regression test (`tests/test_tools.py::test_management_routes_reject_forged_host`) only asserts that a non-local-looking Host is rejected - there's no test for a forged `Host: localhost` from a genuinely non-local source, which is exactly the gap here.\n\n## Suggested Fix\n\nCheck the actual ASGI `scope[\"client\"]` peer address (or require the literal TCP connection to be `127.0.0.1`) instead of, or in addition to, the client-supplied Host header.\n\nReported by: Syed Anas Mohiuddin, independent security researcher","format":"markdown","source":"ghsa"}],"published":"2026-11-30T18:47:07.907Z","modified":"2026-12-01T14:18:12.997Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"CRITICAL"}],"cwes":["CWE-346"],"affected":[{"ranges":[{"version":"< 2.1.3","status":"affected"}],"vendor":"datalayer","product":"jupyter-mcp-server","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.1.3"}],"ecosystem":"PyPI","package":"jupyter-mcp-server","purl":"pkg:pypi/jupyter-mcp-server","source":"ghsa"}],"references":[{"url":"https://github.com/datalayer/jupyter-mcp-server/security/advisories/GHSA-f8rf-rcrx-h6r9","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/datalayer/jupyter-mcp-server/commit/5db55d551f929a19b2acb6248385fc87383b419b","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/datalayer/jupyter-mcp-server/releases/tag/v2.1.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/datalayer/jupyter-mcp-server","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-12-01T13:30:08.333Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-137189","url":"https://www.cve.org/CVERecord?id=CVE-2026-137189","licence":"CVE Terms of Use","modified":"2026-12-01T13:30:43.710Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f8rf-rcrx-h6r9","url":"https://github.com/advisories/GHSA-f8rf-rcrx-h6r9","licence":"CC-BY-4.0","modified":"2026-11-30T20:45:09.896Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-137189","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-137189","licence":"Public domain","modified":"2026-12-01T14:18:12.997Z"}],"updatedAt":"2026-12-01T14:32:16.566Z","epss":{"score":0.00442,"percentile":0.40142,"date":"2026-12-01T12:00:22.000Z"}}