# CVE-2026-40171: PYSEC-2026-2682 - Jupyter Notebook Vulnerable to Authentication Token Theft via CommandLinker XSS

Source: https://junglewise.ai/threats/cve-2026-40171-jupyter-notebook-authentication-token-theft-via-commandlinker-xss  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-06. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-40171 · Severity: medium · CVSS 4 · Published 2026-05-06

Jupyter Notebook and JupyterLab contain a stored cross-site scripting vulnerability in the command linker feature that allows attackers to steal authentication tokens when users open malicious notebook files. An attacker can trick users into clicking seemingly legitimate controls to capture session tokens, enabling complete account takeover—including reading files, executing arbitrary code on the system, and creating shell terminals.

Technologies: [Project Jupyter JupyterLab](https://junglewise.ai/threats/technologies/jupyterlab), [Project Jupyter Notebook](https://junglewise.ai/threats/technologies/notebook), [jupyterlab (PyPI)](https://junglewise.ai/threats/technologies/pypi-jupyterlab), [notebook (PyPI)](https://junglewise.ai/threats/technologies/pypi-notebook). Vendors: [npm](https://junglewise.ai/threats/vendors/npm), [Project Jupyter](https://junglewise.ai/threats/vendors/project-jupyter), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-40171 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40171 being exploited in the wild.

**How severe is CVE-2026-40171?** Medium severity, with a CVSS score of 4, published 6 May 2026.

**Which products and versions are affected?** @jupyter-notebook/help-extension (npm) SEMVER:introduced=7.0.0,fixed=7.5.6; @jupyterlab/help-extension (npm) SEMVER:introduced=0,fixed=4.5.7; Project Jupyter JupyterLab All versions through 4.5.6; Project Jupyter Notebook 7.0.0 through 7.5.5; and 2 more.

**Is there a fix for CVE-2026-40171?** Yes. @jupyter-notebook/help-extension (npm): upgrade to 7.5.6 or later; @jupyterlab/help-extension (npm): upgrade to 4.5.7 or later; jupyterlab (PyPI): upgrade to 4.5.7 or later; notebook (PyPI): upgrade to 7.5.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40171 attacked?** It is attacked over the network.

**Am I affected by CVE-2026-40171?** Check whether you run @jupyter-notebook/help-extension (npm), @jupyterlab/help-extension (npm), Project Jupyter JupyterLab or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- @jupyter-notebook/help-extension (npm): upgrade to 7.5.6 or later

  ```sh
  npm install @jupyter-notebook/help-extension@7.5.6
  ```

- @jupyterlab/help-extension (npm): upgrade to 4.5.7 or later

  ```sh
  npm install @jupyterlab/help-extension@4.5.7
  ```

- jupyterlab (PyPI): upgrade to 4.5.7 or later

  ```sh
  pip install "jupyterlab>=4.5.7"
  ```

- notebook (PyPI): upgrade to 7.5.6 or later

  ```sh
  pip install "notebook>=7.5.6"
  ```


## Technical details

The vulnerability is a stored XSS (CWE-79, CWE-601) in the CommandLinker component that processes command definitions in markdown output and notebook files. The command linker allows markup-driven navigation and command execution; attackers can chain this with the help command to create UI elements that visually masquerade as legitimate controls. When a user clicks such an element, injected JavaScript executes in the browser with the user's authentication context, stealing the REST API token. The attacker then uses this token to perform any action as that user via the REST API. Patches are available in Jupyter Notebook 7.5.6 and JupyterLab 4.5.7; the vulnerability affects all versions from 7.0.0 (notebook) and all prior versions (jupyterlab). High privileges (authenticated user) and active user interaction are required.

## Affected products

- Project Jupyter Notebook 7.0.0 through 7.5.5
- Project Jupyter JupyterLab All versions through 4.5.6

## Identifiers

- CVE-2026-40171
- GHSA-rch3-82jr-f9w9
- PYSEC-2026-2538
- PYSEC-2026-2682

## Timeline

- 2026-04-30: disclosed
- 2026-04-30: patched: Jupyter Notebook 7.5.6 and JupyterLab 4.5.7

## References

- [https://github.com/jupyter/notebook/security/advisories/GHSA-rch3-82jr-f9w9](https://github.com/jupyter/notebook/security/advisories/GHSA-rch3-82jr-f9w9)

## Related threats

- [JupyterLab command link trust prompt marks wrong document](https://junglewise.ai/threats/cve-2026-102832-jupyterlab-command-link-trust-prompt-in-jupyterlab-can-trust-a)
- [JupyterLab PyPI Extension Manager command injection in uninstall](https://junglewise.ai/threats/cve-2026-102904-jupyterlab-is-an-extensible-environment-for-interactive-and)
- [JupyterLab HTML output sanitization bypass via clipboard paste](https://junglewise.ai/threats/cve-2026-102831-jupyterlab-is-an-extensible-environment-for-interactive-and)
- [JupyterLab code injection via Plural-Forms header in language pack](https://junglewise.ai/threats/cve-2026-102830-jupyterlab-is-an-extensible-environment-for-interactive-and)
- [PYSEC-2026-3671 - JupyterLab: Image viewer allows XSS when opening malicious image in new browser tab](https://junglewise.ai/threats/cve-2026-73415-jupyterlab-image-viewer-allows-xss-when-opening-malicious-image)
