llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · jupyter_enterprise_gateway

GHSA-99MG-9X9R-5FJ4

OS command injection via KERNEL_ANACONDA_ENV reaching eval exec in Conductor Spark launch (recomputed PYSPARK_PYTHON)

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.8
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición1 dDesde la divulgación, 20 nov 2026, 8:54 a. m.
Detección6 minDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico total. No hay versión corregida: aplique mitigaciones.
Ojo de llama: esto puede escalar.Sospechosa como un adjunto llamado factura_final2.exe.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
08:54 a. m.
09:00 a. m.
06:34 a. m.
08:54 a. m.
08:19 p. m.
07:44 a. m.
07:09 p. m.
06:34 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-99MG-9X9R-5FJ4 divulgada · CVSS 8.8 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
GitHub

## Summary
Jupyter Enterprise Gateway allows an authenticated IBM Spectrum Conductor user to achieve OS command execution on the Enterprise Gateway host by injecting shell metacharacters through the client-settable `KERNEL_ANACONDA_ENV` environment variable. The value is concatenated into `KERNEL_PYSPARK_PYTHON`, spliced unquoted into `SPARK_OPTS`, and executed via `eval exec` in the Conductor launch script.

## Root Cause
In the Conductor JWT logon path, `ConductorClusterProcessProxy._performConductorJWTLogonAndRetrieval()` recomputes:

env_dict["KERNEL_PYSPARK_PYTHON"] = (
    response["parameters"]["deploy_home"]["value"]
    + "/anaconda/envs/"
    + env["KERNEL_ANACONDA_ENV"]   # raw, unquoted client value
    + "/bin/python"
)

(`enterprise_gateway/services/processproxies/conductor.py`, ~line 725 on v3.3.0). The sibling URL components (`KERNEL_ANACONDA_INST_UUID`, `KERNEL_IG_UUID`) are passed through `quote()`, but `KERNEL_ANACONDA_ENV` is not. `_update_launch_info()` then splices the recomputed `KERNEL_PYSPARK_PYTHON` into `SPARK_OPTS` as `--conf spark.pyspark.python={pyspark_python}` (unquoted), and `etc/kernelspecs/spark_python_conductor_cluster/bin/run.sh` runs `eval exec "${SPARK_OPTS}" ...` on the gateway host.

On the latest release (v3.3.0) there is no input validation at all for `KERNEL_*` values — neither a character filter nor an eval-reaching allowlist exists in that release. (Both were added only in an unreleased commit for GHSA-j63f-r6hc-x235, and even that allowlist does not cover `KERNEL_ANACONDA_ENV`.)

## Impact
Arbitrary OS command execution on the Enterprise Gateway host as the gateway service account (or as the `sudo -u ${KERNEL_USERNAME}` impersonation user when `EG_IMPERSONATION_ENABLED=True`). This crosses a trust boundary: a legitimate kernel request runs user code on the Spark cluster, whereas this injection runs code as the gateway identity on the gateway host — capabilities beyond what the precondition (requesting a kernel) grants.

Proof of Concept

POST /api/kernels
Header: Jwt-Auth-User-Payload: {"accessToken":"<valid-jwt>"}
Body: {
  "name": "spark_python_conductor_cluster",
  "env": {
    "KERNEL_ANACONDA_ENV": "x|touch /tmp/pwned|y",
    "KERNEL_ANACONDA_INST_UUID": "<valid-uuid>",
    "KERNEL_IG_UUID": "<valid-uuid>"
  }
}

The `|` pipe runs `touch /tmp/pwned` in a subshell on the gateway host (the `exec` only applies to the first stage; `;`/`&&` are swallowed by `exec`, but `|` is not).

## Attack Chain
1. Entry: `POST /api/kernels` with `KERNEL_ANACONDA_ENV="x|touch /tmp/pwned|y"` (`handlers.py` `_build_kernel_env` forwards any `KERNEL_*` key). Guard on v3.3.0: none. Guard on HEAD: `PROHIBITED_ENV_VALUE_CHARS = frozenset("$`\n\r\x00")`. Bypass proof: `|` and space are not members — value passes.
2. Check: `RemoteKernelManager._validate_client_env` → `validate_eval_reaching_env` (HEAD only). Guard: scans only vars in `EVAL_REACHING_ENVS` / `*_OPTS` keys / names referenced by a `*_OPTS` kernelspec entry. Bypass proof: Conductor `SPARK_OPTS` references only `KERNEL_ID` and `KERNEL_EXTRA_SPARK_OPTS`; `KERNEL_ANACONDA_ENV` is in none of these sets — reimplemented HEAD validator returns `('PASSED', 'checked=[]')`.
3. Processing: `_performConductorJWTLogonAndRetrieval` recomputes `KERNEL_PYSPARK_PYTHON` from the raw client value AFTER validation (`conductor.py` ~725). The taint is reintroduced into an eval-reaching var post-validation.
4. Sink: `_update_launch_info` → `SPARK_OPTS` unquoted → `run.sh` `eval exec "${SPARK_OPTS}"`. Bypass proof: empirically, `--conf spark.pyspark.python=...x|touch /tmp/pwned|y` under `eval exec` created the marker file.
5. Impact: OS command execution on the gateway host as the gateway service account.

## Bypass Evidence
- Reimplemented HEAD `validate_eval_reaching_env` against the payload → `('PASSED', 'checked=[]')`; control `KERNEL_PYSPARK_PYTHON` with the same payload → `REJECTED`.
- v3.3.0 `git show v3.3.0:.../handlers.py` has no `PROHIBITED_ENV_VALUE_CHARS`; `git show v3.3.0:.../processproxy.py` has no `validate_eval_reaching_env`.
- Bash sink test: `eval exec` with a piped `--conf` value created `/tmp/pwned`.

## Affected Versions
`<= 3.3.0` (latest release). The unreleased 3.4.0 allowlist still omits `KERNEL_ANACONDA_ENV`, so the issue persists on current `main`.

## Suggested Fix
Quote the client value when building `KERNEL_PYSPARK_PYTHON` (e.g. `shlex.quote(env["KERNEL_ANACONDA_ENV"])`), and add `KERNEL_ANACONDA_ENV` to the eval-reaching validation set so recomputed-after-validation variables are re-scanned.

---
Reported by zx (Jace) — GitHub: @manus-use

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
8.3/ 10Alto
Vector 8.3 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
jupyter_enterprise_gateway≤ 3.4.0
3.4.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypijupyter_enterprise_gateway
Sin parche — — 3.4.0 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/jupyter-server/enterprise_gateway/security/advisories/GHSA-99mg-9x9r-5fj4

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.