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

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, Project Jupyter Notebook, jupyterlab (PyPI), notebook (PyPI). Vendors: npm, Project Jupyter, 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
    npm install @jupyter-notebook/help-extension@7.5.6
  • @jupyterlab/help-extension (npm): upgrade to 4.5.7 or later
    npm install @jupyterlab/help-extension@4.5.7
  • jupyterlab (PyPI): upgrade to 4.5.7 or later
    pip install "jupyterlab>=4.5.7"
  • notebook (PyPI): upgrade to 7.5.6 or later
    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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.