CVE-2021-41134 Stored XSS in Jupyter nbdime
Attackers can execute arbitrary scripts in Jupyter notebooks via unsanitized file names in nbdime, requiring users to update the library.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-41134?
CVE-2021-41134 is a high-severity cross-site scripting vulnerability in jupyter nbdime, published on 3 Nov 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Official 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.
Weakness: CWE-79
Which versions are affected by CVE-2021-41134?
15 open source packages ship an affected version, including nbdime-jupyterlab and nbdime. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
nbdime-jupyterlab npm | All versions | 1.0.1 |
nbdime-jupyterlab npm | All versions | 1.0.1 |
nbdime-jupyterlab npm | From 2.0.0 | 2.1.1 |
nbdime-jupyterlab npm | From 2.0.0 | 2.1.1 |
nbdime PyPI | All versions | 1.1.1, 2.1.1, 3.1.1 |
nbdime PyPI | All versions | 1.1.1 |
9 more packages
nbdime PyPI | All versions | 1.1.1 |
nbdime PyPI | From 2.0.0 | 2.1.1 |
nbdime PyPI | From 2.0.0 | 2.1.1 |
nbdime PyPI | From 3.0.0 | 3.1.1 |
nbdime PyPI | From 3.0.0 | 3.1.1 |
nbdime npm | All versions | 5.0.2 |
nbdime npm | All versions | 5.0.2 |
nbdime npm | From 6.0.0 | 6.1.2 |
nbdime npm | From 6.0.0 | 6.1.2 |
Products include Jupyter Nbdime, Jupyter Nbdime-Jupyterlab.
How do I fix CVE-2021-41134?
Upgrade nbdime-jupyterlab to a fixed version for your release line: 1.0.1 or 2.1.1.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2021-41134 being exploited?
There is no known exploitation of CVE-2021-41134 in the wild and no public exploit code.
Sources
Also known as GHSA-p6rw-44q7-3fw4, PYSEC-2021-428, openSUSE-SU-2024:11630-1.