# GHSA-RVJM-7HVP-F868: ManagementRouteSecurityMiddleware Bypass via connect\_to\_jupyter MCP Tool (SSRF & Sandbox Hijack) and Default Wildcard CORS on /mcp

- Database: GitHub
- Severity: CVSS 9.6 (Critical)
- Published: 2026-11-17
- Modified: 2026-11-17

## Affected versions

- jupyter-mcp-server (PyPI): all versions

## Description

### Summary
ManagementRouteSecurityMiddleware Bypass via connect_to_jupyter MCP Tool (SSRF & Sandbox Hijack) and Default Wildcard CORS on /mcp in `datalayer/jupyter-mcp-server` (verified at commit `fe0a1d4f0592`).

### Affected Files & Lines
- `jupyter_mcp_server/tools/connect_jupyter_tool.py:25-49, 54-107`
- `jupyter_mcp_server/server.py:122-198, 335-346, 1756-1801`

### Root-Cause Analysis
1. Management Route Security Bypass via `connect_to_jupyter` MCP Tool (CWE-862 / CWE-918): In `jupyter_mcp_server/server.py:122-198`, `ManagementRouteSecurityMiddleware` restricts `/api/connect` using loopback peer verification (`_is_local_peer`), `Host` header validation (`_is_local_hostname`), local `Origin` enforcement, and Bearer token verification. However, the identical management operation is exposed as an LLM-callable MCP tool `connect_to_jupyter` (`connect_jupyter_tool.py:54-107`, registered at `server.py:1756-1801`), which performs an unvalidated `requests.get(f'{jupyter_url}/api/status')` (SSRF with custom `Authorization: token <jupyter_token>` header) and calls `set_config(code_sandbox_url=...)` to repoint the active code execution backend at runtime.
2. Wildcard CORS and Missing Origin Check on `/mcp` (CWE-942): `MANAGEMENT_ROUTE_PATHS` (`server.py:122`) excludes `/mcp`, and `CORSMiddleware` (`server.py:340-346`) sets `allow_origins=cors_origins or ['*']`, allowing cross-origin pages to invoke `/mcp` tools when no token verifier is configured.

### Recommended Remediation Diff
```diff
--- a/jupyter_mcp_server/server.py
+++ b/jupyter_mcp_server/server.py
@@ -122,2 +122,2 @@
-MANAGEMENT_ROUTE_PATHS = {"/api/connect", "/api/stop", "/api/healthz"}
+MANAGEMENT_ROUTE_PATHS = {"/api/connect", "/api/stop", "/api/healthz", "/mcp"}
@@ -340,5 +340,5 @@ class MCPServerWithCORS(MCPServer):
         app.add_middleware(
             CORSMiddleware,
-            allow_origins=cors_origins or ["*"],
+            allow_origins=cors_origins or ["http://localhost", "http://127.0.0.1"],
```

## References

- https://github.com/datalayer/jupyter-mcp-server/security/advisories/GHSA-rvjm-7hvp-f868

Page: https://cve.now/GHSA-RVJM-7HVP-F868
