# CVE-2024-35225: Jupyter Server Proxy has a reflected XSS issue in host parameter

> Attackers can execute arbitrary JavaScript in users' browsers via a reflected XSS vulnerability in the Jupyter Server Proxy host parameter.

- **Severity:** Critical 9.7 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 11 Jun 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-fvcq-4x64-hqxr, PYSEC-2024-236

## What is CVE-2024-35225?

CVE-2024-35225 is a critical cross-site scripting vulnerability in jupyterhub jupyter-server-proxy, published on 11 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Jupyter Server Proxy allows users to run arbitrary external processes alongside their notebook server and provide authenticated web access to them. Versions of 3.x prior to 3.2.4 and 4.x prior to 4.2.0 have a reflected cross-site scripting (XSS) issue. The `/proxy` endpoint accepts a `host` path segment in the format `/proxy/<host>`. When this endpoint is called with an invalid `host` value, `jupyter-server-proxy` replies with a response that includes the value of `host`, without sanitization [2]. A third-party actor can leverage this by sending a phishing link with an invalid `host` value containing custom JavaScript to a user. When the user clicks this phishing link, the browser renders the response of `GET /proxy/<host>`, which runs the custom JavaScript contained in `host` set by the actor. As any arbitrary JavaScript can be run after the user clicks on a phishing link, this issue permits extensive access to the user's JupyterLab instance for an actor. Patches are included in versions 4.2.0 and 3.2.4. As a workaround, server operators who are unable to upgrade can disable the `jupyter-server-proxy` extension.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-116 (Improper Encoding or Escaping of Output)

## Which versions are affected by CVE-2024-35225?

5 open source packages ship an affected version, including jupyter-server-proxy. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `jupyter-server-proxy` | PyPI | From 3.0.0 | 3.2.4, 4.2.0 |
| `jupyter-server-proxy` | PyPI | From 3.0.0 | 3.2.4 |
| `jupyter-server-proxy` | PyPI | From 3.0.0 | 3.2.4 |
| `jupyter-server-proxy` | PyPI | From 4.0.0 | 4.2.0 |
| `jupyter-server-proxy` | PyPI | From 4.0.0 | 4.2.0 |

Products: Jupyter Jupyter Server Proxy.

## How do I fix CVE-2024-35225?

Upgrade jupyter-server-proxy to a fixed version for your release line: 3.2.4 or 4.2.0.

## Is CVE-2024-35225 being exploited?

There is no known exploitation of CVE-2024-35225 in the wild and no public exploit code.

## Other vulnerabilities in jupyterhub jupyter-server-proxy

- [CVE-2024-28179](https://insights.sbomify.com/CVE-2024-28179/): Jupyter Server Proxy's Websocket Proxying does not require authentication (critical 9.1)
- [CVE-2022-21697](https://insights.sbomify.com/CVE-2022-21697/): SSRF vulnerability (requires authentication) (medium 6.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-35225 and fix it if it is affected.

What it is: CVE-2024-35225 is a critical cross-site scripting vulnerability in jupyterhub jupyter-server-proxy, published on 11 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-35225 in the wild and no public exploit code.

Affected packages and fixed versions:
- jupyter-server-proxy (PyPI): affected from 3.0.0; fixed in 3.2.4, 4.2.0
- jupyter-server-proxy (PyPI): affected from 3.0.0; fixed in 3.2.4
- jupyter-server-proxy (PyPI): affected from 3.0.0; fixed in 3.2.4
- jupyter-server-proxy (PyPI): affected from 4.0.0; fixed in 4.2.0
- jupyter-server-proxy (PyPI): affected from 4.0.0; fixed in 4.2.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-35225/ (Markdown: https://insights.sbomify.com/CVE-2024-35225/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-35225
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-35225
- OSV: https://osv.dev/vulnerability/CVE-2024-35225

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-35225/
Summaries are generated and may contain mistakes; the official description above is the record.
