# CVE-2026-40171: Jupyter Notebook and JupyterLab token theft via stored XSS in help command linker

> Stored XSS in Jupyter help linker allows attackers to steal authentication tokens and execute arbitrary code via malicious notebooks.

- **Severity:** High 8.4 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 6 May 2026
- **Updated:** 8 May 2026
- **Also known as:** BIT-jupyter-base-notebook-2026-40171, BIT-jupyter-notebook-2026-40171, BIT-jupyterlab-2026-40171, CLEANSTART-2026-OX78672, CLEANSTART-2026-SO25555, DEBIAN-CVE-2026-40171, GHSA-rch3-82jr-f9w9, PYSEC-2026-2538, PYSEC-2026-2682, UBUNTU-CVE-2026-40171

## What is CVE-2026-40171?

CVE-2026-40171 is a high-severity cross-site scripting vulnerability in jupyter help-extension, published on 6 May 2026. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.

### Official description

In Jupyter Notebook versions 7.0.0 through 7.5.5, JupyterLab versions 4.5.6 and earlier, and the corresponding @jupyter-notebook/help-extension and @jupyterlab/help-extension packages before 7.5.6 and 4.5.7, a stored cross-site scripting issue in the help command linker can be chained with attacker-controlled notebook content to steal authentication tokens with a single click.

An attacker can craft a malicious notebook file containing elements that appear indistinguishable from legitimate controls and trigger execution when a user interacts with them. Successful exploitation allows theft of the user's authentication token and complete takeover of the Jupyter session through the REST API, including reading files, creating or modifying files, accessing kernels to execute arbitrary code, and creating terminals for shell access. This issue has been fixed in Notebook 7.5.6, JupyterLab 4.5.7, @jupyter-notebook/help-extension 7.5.6, and @jupyterlab/help-extension 4.5.7. As a workaround, disable the affected help extensions or set allowCommandLinker to false in the sanitizer configuration.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2026-40171?

13 open source packages ship an affected version, including @jupyter-notebook/help-extension, jupyter-base-notebook and jupyter-notebook.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@jupyter-notebook/help-extension` | npm | From 7.0.0 | 7.5.6 |
| `@jupyter-notebook/help-extension` | npm | From 7.0.0 | 7.5.6 |
| `jupyter-base-notebook` | Bitnami | From 7.0.0 | 7.5.6 |
| `jupyter-notebook` | Bitnami | From 7.0.0 | 7.5.6 |
| `jupyterlab` | Bitnami | All versions | 4.5.7 |
| `jupyterlab` | PyPI | All versions | 4.5.7 |
| `jupyterlab` | PyPI | All versions | 4.5.7 |
| `jupyterlab` | PyPI | All versions | 4.5.7 |
| `notebook` | PyPI | From 7.0.0 | 7.5.6 |
| `notebook` | PyPI | From 7.0.0 | 7.5.6 |
| `notebook` | PyPI | From 7.0.0 | 7.5.6 |
| `@jupyterlab/help-extension` | npm | All versions | 4.5.7 |
| `@jupyterlab/help-extension` | npm | All versions | 4.5.7 |

## How do I fix CVE-2026-40171?

Upgrade @jupyter-notebook/help-extension to 7.5.6 or later.

## Is CVE-2026-40171 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40171 and fix it if it is affected.

What it is: CVE-2026-40171 is a high-severity cross-site scripting vulnerability in jupyter help-extension, published on 6 May 2026. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-40171 in the wild and no public exploit code.

Affected packages and fixed versions:
- @jupyter-notebook/help-extension (npm): affected from 7.0.0; fixed in 7.5.6
- @jupyter-notebook/help-extension (npm): affected from 7.0.0; fixed in 7.5.6
- jupyter-base-notebook (Bitnami): affected from 7.0.0; fixed in 7.5.6
- jupyter-notebook (Bitnami): affected from 7.0.0; fixed in 7.5.6
- jupyterlab (Bitnami): affected all versions; fixed in 4.5.7
- jupyterlab (PyPI): affected all versions; fixed in 4.5.7
- jupyterlab (PyPI): affected all versions; fixed in 4.5.7
- jupyterlab (PyPI): affected all versions; fixed in 4.5.7
- notebook (PyPI): affected from 7.0.0; fixed in 7.5.6
- notebook (PyPI): affected from 7.0.0; fixed in 7.5.6
- notebook (PyPI): affected from 7.0.0; fixed in 7.5.6
- @jupyterlab/help-extension (npm): affected all versions; fixed in 4.5.7

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-2026-40171/ (Markdown: https://insights.sbomify.com/CVE-2026-40171/index.md)
```

## Sources

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

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