High

JupyterLab: Cross-site scripting (XSS) in JupyterLab via notebook cells pasted from the system clipboard

  • Disclosed: 01.10.2026
  • Updated: 11.10.2026 15:18

Description

JupyterLab 4.5.0 enabled copying and pasing cells through the system clipboard. The paste path parses clipboard text as cell JSON and inserts the cells without clearing metadata.trusted, so a payload can declare its own output as trusted. JupyterLab does not sanitize a trusted output and evaluates the <script> elements it contains, so pasting the cell runs attacker's JavaScript in the JupyterLab origin. The same payload with "trusted": false is sanitized.

js
[
  {
    "cell_type": "code",
    "execution_count": null,
    "source": "",
    "metadata": { "trusted": true },
    "outputs": [
      {
        "output_type": "display_data",
        "metadata": {},
        "data": { "text/html": "<script>/* runs on paste */</script>" }
      }
    ]
  }
]

Users are affected if all of the following are true:

  • they run JupyterLab 4.5.0 through 4.6.3, or an application that bundles it such as Notebook 7.5+;
  • if running 4.5.2 or newer, useSystemClipboardForCells is enabled - it is off by default in 4.5.2+, and always enabled on 4.5.0 and 4.5.1 with no opt-out
  • they run a Paste Cells command (e.g. from context menu, command palette, shortcut) while attacker-controlled text is in the clipboard; and
  • pasteCodeCellsWithoutOutput is off, the default, so the pasted cell keeps its outputs

Impact

The script runs in the JupyterLab page, in the same origin and session as the authenticated user, so it can call the Jupyter Server REST API as that user: read and write any file under the server root, start a kernel and run code in it, and open a terminal where terminals are enabled. It runs on paste, without the user executing anything.

Only the output of a code cell can run a script this way. Markdown and raw cells are always sanitized, as the trust documentation states.

The attacker needs no JupyterLab account and no access to the server, only the user's clipboard at the moment of the paste. A web page can replace the text you copy from it, or write the clipboard directly once you have given it permission. Both need you to click or press a key on that page first.

Patches

JupyterLab v4.6.4 and v4.5.11 contain the patch. Cells read from the system clipboard that cannot be traced to the current window no longer carry metadata.trusted into the notebook, so their outputs are sanitized like any other content of unknown origin.

Users of applications that depend on JupyterLab, such as Notebook v7+, should update jupyterlab package too.

Workarounds

On 4.5.2 and later, confirm that the system clipboard is not in use for cells. The setting is off by default; check Settings, Notebook, or the raw value:

js
{
  "@jupyterlab/notebook-extension:tracker": {
    "useSystemClipboardForCells": false
  }
}

With that setting off, cell copy and paste use JupyterLab's in-application clipboard, which never leaves the page. The cost is that cells can no longer be copied between browser tabs or windows.

On 4.5.0 and 4.5.1 there is no such setting, and every paste reads the system clipboard and upgrade is highly recommended.

Pasting cells without their outputs also stops the script from running, at the cost of discarding outputs on every paste:

js
{
  "@jupyterlab/notebook-extension:tracker": {
    "pasteCodeCellsWithoutOutput": true
  }
}

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) jupyterlab >= 4.5.0, < 4.5.11, >= 4.6.0, < 4.6.4 4.5.11, 4.6.4
Python (PyPI) jupyterlite >= 0.7.0, < 0.8.4 0.8.4
Python (PyPI) jupyterlite-core >= 0.7.0, < 0.8.4 0.8.4
Python (PyPI) notebook >= 7.5.0, < 7.6.3 7.6.3

References

CVSS score 8.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Weakness (CWE)
CWE-345, CWE-79
Platform
Python (PyPI)
Package
jupyterlab, jupyterlite, jupyterlite-core
Disclosed
01.10.2026
Updated
11.10.2026 15:18

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-4057 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-4058 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-4060 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-6966-vjj6-99xv - CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-4112 - PyPA Advisory Database; CC BY 4.0

Vulnerability history: jupyterlab

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (19) in the archive
Total entries
19
First → latest
08.2021 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 1
  • High 8
  • Medium 8
  • Low 2

Disclosures per year

  1. 2021: 1
  2. 2022: 0
  3. 2023: 0
  4. 2024: 4
  5. 2025: 1
  6. 2026: 13
Severity:
  1. JupyterLab: Cross-site scripting (XSS) in JupyterLab via notebook cells pasted from the system clipboard this entry
    High · 8.1 CVE-2026-102831 >= 4.5.0, < 4.5.11, >= 4.6.0, < 4.6.4 4.5.11, 4.6.4
  2. High CVE-2026-73417 >= 4.6.0, < 4.6.2, >= 3.3.0, < 4.5.10 4.6.2, 4.5.10
  3. High CVE-2026-73415 >= 4.6.0, < 4.6.2, < 4.5.10 4.6.2, 4.5.10
  4. High · 7.6 CVE-2024-43805 < 3.6.8, >= 4.0.0, < 4.2.5 3.6.8, 4.2.5
  5. High · 7.6 CVE-2024-22421 >= 4.0.0, < 4.0.11, < 3.6.7 4.0.11, 3.6.7

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.