CVE-2021-41134 Stored XSS in Jupyter nbdime

High 8.7 Published Updated

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.

PackageAffectedFixed in
nbdime-jupyterlab npmAll versions1.0.1
nbdime-jupyterlab npmAll versions1.0.1
nbdime-jupyterlab npmFrom 2.0.02.1.1
nbdime-jupyterlab npmFrom 2.0.02.1.1
nbdime PyPIAll versions1.1.1, 2.1.1, 3.1.1
nbdime PyPIAll versions1.1.1
9 more packages
nbdime PyPIAll versions1.1.1
nbdime PyPIFrom 2.0.02.1.1
nbdime PyPIFrom 2.0.02.1.1
nbdime PyPIFrom 3.0.03.1.1
nbdime PyPIFrom 3.0.03.1.1
nbdime npmAll versions5.0.2
nbdime npmAll versions5.0.2
nbdime npmFrom 6.0.06.1.2
nbdime npmFrom 6.0.06.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.

Is CVE-2021-41134 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free