critical

CVE-2026-137189

PyPI · jupyter-mcp-server

Summary

Jupyter MCP Server: Host-header spoof bypasses the CVE-2026-77359/GHSA-9x8x-crjq-g64h fix

Severity
critical
EPSS
0.4% (p40)
CWE
CWE-346
Also known as
GHSA-f8rf-rcrx-h6r9
Published
2026-11-30
Updated
2026-11-30

Advisory details

Summary

The 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.

Details

Proof of Concept

Started the real server (--insecure-mcp-noauth --transport streamable-http).

curl -X PUT /api/connect -H "Host: evil.com" correctly returns 421 Misdirected Request.

The 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.

Scoping

In --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.

Duplicate check

Both 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.

Suggested Fix

Check 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.

Reported by: Syed Anas Mohiuddin, independent security researcher

References

Related advisories

Is your project exposed to this? Stateward checks every dependency on every pull request and flags it only if your code actually reaches it.

Check my repo

Summarize with AI

ChatGPTClaudePerplexity

Sources: CISA KEV (public domain), OSV.dev & GitHub Advisory Database (CC-BY-4.0), FIRST EPSS, NVD/CWE (public domain). Served live from the Stateward advisory database.