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

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

- **Severity:** High 7.4 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N`)
- **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:** Yes
- **Published:** 9 Aug 2021
- **Updated:** 3 Aug 2024
- **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

## 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 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2021-32797?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `jupyterlab` | Bitnami | All versions | 1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4 |
| `jupyterlab` | PyPI | All versions | 1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4 |
| `jupyterlab` | PyPI | All versions | 1.2.21 |
| `jupyterlab` | PyPI | All versions | 1.2.21 |
| `jupyterlab` | PyPI | From 2.0.0a0 | 2.2.10 |
| `jupyterlab` | PyPI | From 2.0.0a0 | 2.2.10 |
| `jupyterlab` | PyPI | From 2.3.0a0 | 2.3.2 |
| `jupyterlab` | PyPI | From 2.3.0a0 | 2.3.2 |
| `jupyterlab` | PyPI | From 3.0.0a0 | 3.0.17 |
| `jupyterlab` | PyPI | From 3.0.0a0 | 3.0.17 |
| `jupyterlab` | PyPI | From 3.1.0a0 | 3.1.4 |
| `jupyterlab` | PyPI | From 3.1.0a0 | 3.1.4 |
| `notebook` | PyPI | All versions | 5.7.11, 6.4.1 |
| `notebook` | PyPI | All versions | 5.7.11 |
| `notebook` | PyPI | All versions | 5.7.11 |
| `notebook` | PyPI | From 6.0.0 | 6.4.1 |
| `notebook` | PyPI | From 6.0.0 | 6.4.1 |
| `python-jupyterlab` | SUSE:Package Hub 15 SP4 | All versions | 2.2.10-bp154.2.3.1 |
| `python-jupyterlab` | openSUSE:Leap 15.4 | All versions | 2.2.10-bp154.2.3.1 |

Products: 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.

## Is CVE-2021-32797 being exploited?

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

## Other vulnerabilities in jupyterlab

- [CVE-2024-39700](https://insights.sbomify.com/CVE-2024-39700/): Remote Code Execution (RCE) vulnerability in jupyterlab extension template `update-integration-tests` GitHub Action (critical 10.0)
- [CVE-2026-42266](https://insights.sbomify.com/CVE-2026-42266/): JupyterLab has an Extension Manager API/GUI Policy Discrepancy, allowing 3rd party (malicious) extensions install via POST request (high 8.8)
- [CVE-2026-42557](https://insights.sbomify.com/CVE-2026-42557/): jupyterlab: Command linker attributes in HTML enable one-click command execution from untrusted content (high 8.6)
- [CVE-2024-43805](https://insights.sbomify.com/CVE-2024-43805/): HTML injection in Jupyter Notebook and JupyterLab leading to DOM Clobbering (high 7.6)
- [CVE-2025-59842](https://insights.sbomify.com/CVE-2025-59842/): JupyterLab LaTeX typesetter links did not enforce `noopener` attribute (low 2.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-32797 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2021-32797 in the wild and no public exploit code.

Affected packages and fixed versions:
- jupyterlab (Bitnami): affected all versions; fixed in 1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4
- jupyterlab (PyPI): affected all versions; fixed in 1.2.21, 2.2.10, 2.3.2, 3.0.17, 3.1.4
- jupyterlab (PyPI): affected all versions; fixed in 1.2.21
- jupyterlab (PyPI): affected all versions; fixed in 1.2.21
- jupyterlab (PyPI): affected from 2.0.0a0; fixed in 2.2.10
- jupyterlab (PyPI): affected from 2.0.0a0; fixed in 2.2.10
- jupyterlab (PyPI): affected from 2.3.0a0; fixed in 2.3.2
- jupyterlab (PyPI): affected from 2.3.0a0; fixed in 2.3.2
- jupyterlab (PyPI): affected from 3.0.0a0; fixed in 3.0.17
- jupyterlab (PyPI): affected from 3.0.0a0; fixed in 3.0.17
- jupyterlab (PyPI): affected from 3.1.0a0; fixed in 3.1.4
- jupyterlab (PyPI): affected from 3.1.0a0; fixed in 3.1.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-32797/ (Markdown: https://insights.sbomify.com/CVE-2021-32797/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-32797
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-32797
- OSV: https://osv.dev/vulnerability/CVE-2021-32797

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-32797/
Summaries are generated and may contain mistakes; the official description above is the record.
