CVE-2021-32797 JupyterLab: XSS due to lack of sanitization of the action attribute of an html <form>

High 7.4 Published Updated

Attackers can execute arbitrary code by crafting malicious notebooks that exploit unsanitized form action attributes, requiring user interaction to open the file.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2021-32797?

CVE-2021-32797 is a high-severity cross-site scripting vulnerability in jupyterlab, published on 9 Aug 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

JupyterLab is a user interface for Project Jupyter which will eventually replace the classic Jupyter Notebook. In affected versions untrusted notebook can execute code on load. In particular JupyterLab doesn’t sanitize the action attribute of html `<form>`. Using this it is possible to trigger the form validation outside of the form itself. This is a remote code execution, but requires user action to open a notebook.

Weakness: CWE-79

Which versions are affected by CVE-2021-32797?

17 open source packages ship an affected version, including jupyterlab and notebook. It affects 1 product.

PackageAffectedFixed in
jupyterlab BitnamiAll versions1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4
jupyterlab PyPIAll versions1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4
jupyterlab PyPIAll versions1.2.21
jupyterlab PyPIAll versions1.2.21
jupyterlab PyPIFrom 2.0.0a02.2.10
jupyterlab PyPIFrom 2.0.0a02.2.10
11 more packages
jupyterlab PyPIFrom 2.3.0a02.3.2
jupyterlab PyPIFrom 2.3.0a02.3.2
jupyterlab PyPIFrom 3.0.0a03.0.17
jupyterlab PyPIFrom 3.0.0a03.0.17
jupyterlab PyPIFrom 3.1.0a03.1.4
jupyterlab PyPIFrom 3.1.0a03.1.4
notebook PyPIAll versions5.7.11, 6.4.1
notebook PyPIAll versions5.7.11
notebook PyPIAll versions5.7.11
notebook PyPIFrom 6.0.06.4.1
notebook PyPIFrom 6.0.06.4.1
Linux distribution packages (2)
python-jupyterlab SUSE:Package Hub 15 SP4All versions2.2.10-bp154.2.3.1
python-jupyterlab openSUSE:Leap 15.4All versions2.2.10-bp154.2.3.1

Products include Jupyter Jupyterlab.

How do I fix CVE-2021-32797?

Upgrade jupyterlab to a fixed version for your release line: 1.2.21, 2.2.10, 2.3.2 or 3.0.17.

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-32797 being exploited?

There is no known exploitation of CVE-2021-32797 in the wild and no public exploit code.

Sources

Also known as BIT-jupyterlab-2021-32797, GHSA-4952-p58q-6crx, MGASA-2023-0060, PYSEC-2021-130, PYSEC-2026-688, openSUSE-SU-2022:10075-1.

Is CVE-2021-32797 in your software?

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

Check your SBOMs for free