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

Published Sep 29, 2026
·
Updated

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.

json [ { "celltype": "code", "executioncount": null, "source": "", "metadata": { "trusted": true }, "outputs": [ { "outputtype": "displaydata", "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:

json { "@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:

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

Other sources

JupyterLab is an extensible environment for interactive and reproducible computing, based on the Jupyter Notebook Architecture. From JupyterLab 4.5.0 until 4.5.11 and 4.6.4, from Notebook 7.5.0 until 7.6.3, and from JupyterLite Core 0.7.0 until 0.8.4, the system clipboard cell-paste path accepts attacker-controlled cell JSON without clearing metadata.trusted. When useSystemClipboardForCells is active and pasteCodeCellsWithoutOutput is disabled, a pasted code cell can mark HTML output as trusted, bypass output sanitization, and execute script in the authenticated JupyterLab origin without executing the cell. Markdown and raw cells are not affected because their output is sanitized. This issue is fixed in JupyterLab 4.5.11 and 4.6.4, Notebook 7.6.3, and JupyterLite Core 0.8.4.

— MITRE

Affected Software

8 affected componentsFixes available
jupyter JupyterLab>=4.5.0<4.5.11, >=4.6.0<4.6.4
jupyter notebook>=7.5.0<7.6.3
jupyter JupyterLite Core>=0.7.0<0.8.4
pip/jupyterlite-core>=0.7.0<=0.8.3
0.8.4
pip/jupyterlite>=0.7.0<=0.8.3
0.8.4
pip/notebook>=7.5.0<=7.6.2
7.6.3
pip/jupyterlab>=4.5.0<=4.5.10
4.5.11
pip/jupyterlab>=4.6.0<=4.6.3
4.6.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/jupyterlite-core to a version that resolves this vulnerability.

    Fixed in 0.8.4
  2. Upgrade

    Upgrade pip/jupyterlite to a version that resolves this vulnerability.

    Fixed in 0.8.4
  3. Upgrade

    Upgrade pip/notebook to a version that resolves this vulnerability.

    Fixed in 7.6.3
  4. Upgrade

    Upgrade pip/jupyterlab to a version that resolves this vulnerability.

    Fixed in 4.5.11
  5. Upgrade

    Upgrade pip/jupyterlab to a version that resolves this vulnerability.

    Fixed in 4.6.4
  6. Upgrade

    Upgrade JupyterLab to a version that resolves this vulnerability.

    Fixed in 4.6.4
  7. Upgrade

    Upgrade Notebook to a version that resolves this vulnerability.

    Fixed in 7.6.3
  8. Upgrade

    Upgrade JupyterLite Core to a version that resolves this vulnerability.

    Fixed in 0.8.4
  9. Configuration

    Disable useSystemClipboardForCells so cell copy and paste use JupyterLab's in-application clipboard.

    JupyterLab useSystemClipboardForCells = false
  10. Configuration

    Enable pasteCodeCellsWithoutOutput so pasted code cells do not retain outputs that could execute scripts.

    JupyterLab pasteCodeCellsWithoutOutput = true

Event History

Sep 29, 2026
CVE Published
via MITRE·06:58 PM
Data Sourced
via MITRE·06:58 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:17 PM
DescriptionSeverityWeakness
Oct 1, 2026
Advisory Published
via GitHub·03:20 PM
Data Sourced
via GitHub·03:20 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What conditions are required for exploitation?

An attacker must persuade a user to paste attacker-controlled code-cell JSON from the system clipboard. The JupyterLab setting useSystemClipboardForCells must be active and pasteCodeCellsWithoutOutput must be disabled; user interaction is required, but the pasted cell does not need to be executed.

2

Which pasted cell types are affected?

Only code cells are affected. Markdown and raw cells are not affected because their output is sanitized.

3

What is the impact after a successful paste?

The pasted code cell can retain metadata.trusted, causing HTML output to bypass sanitization and execute script in the authenticated JupyterLab origin. This can compromise confidentiality and integrity in that origin.

4

What can be done before updating?

Disable useSystemClipboardForCells or enable pasteCodeCellsWithoutOutput to prevent the vulnerable paste path from accepting trusted output. Avoid pasting untrusted code cells from the system clipboard.

5

Which releases contain fixes?

Fixed releases are JupyterLab 4.5.11 and 4.6.4, Notebook 7.6.3, and JupyterLite Core 0.8.4.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203