Jupyter: JupyterLab: Cross-site scripting (XSS) in JupyterLab via notebook cells pasted from the system…
Jupyter
More for Jupyter RSS feed for Jupyter
- Severity
- High, CVSS 8.1
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
- Record
- CVE-2026-102831
- Affects
- Jupyter
- Known exploited
- Not listed in the CISA Known Exploited Vulnerabilities catalog
- Published
- Record first published by the source
- October 1, 2026
- Source last modified
- October 1, 2026
Description
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.
[
{
"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](https://jupyterlab.readthedocs.io/en/latest/user/notebook.html#trust) 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](https://github.com/jupyterlab/jupyterlab/releases/tag/v4.6.4) and [v4.5.11](https://github.com/jupyterlab/jupyterlab/releases/tag/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:
{
"@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:
{
"@jupyterlab/notebook-extension:tracker": {
"pasteCodeCellsWithoutOutput": true
}
} Description quoted from the NVD record.
Who is affected
Jupyter (also called JupyterLab) is a tool for writing and running code alongside notes in a web browser. This flaw affects versions 4.5.0 through 4.6.3, and apps that include it, such as Notebook 7.5 and later. On 4.5.0 and 4.5.1 it always applies. On 4.5.2 and later, it applies only if the option to copy cells through the computer's clipboard is turned on (it is off by default). If a user pastes notebook cells while an attacker's text is on their clipboard, harmful code runs as that user. It could read and change files, run code and, where allowed, open a terminal. This flaw is rated High.
What to do
- The person who installed or runs Jupyter for your organization should update JupyterLab to
v4.6.4orv4.5.11, which fix this flaw. - If you use an app that includes it, such as Notebook 7 or later, also update the
jupyterlabpackage. - Until you can update, on 4.5.2 and later, keep
useSystemClipboardForCellsset to false (found under Settings, Notebook). Versions 4.5.0 and 4.5.1 have no such setting, so update them as soon as possible. - Another stopgap is setting
pasteCodeCellsWithoutOutputto true, which removes outputs from pasted cells. - If an IT provider or vendor runs Jupyter for you, send them this advisory and ask when the update will be done.
Analysis written from the source record as of October 1, 2026 and reviewed before publishing.