CVE-2021-32798
JSON

10.0critical

Failure to Sanitize Special Elements into a Different Plane (Special Element Injection) in notebook

Severity
10.0critical CVSS:3.1 by GitHub_M
Exploit likelihood
2.11% (higher than 82% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-hwvq-6gjx-j797BIT-JUPYTER-BASE-NOTEBOOK-2021-32798BIT-JUPYTER-NOTEBOOK-2021-32798PYSEC-2021-118

Description

The Jupyter notebook is a web-based notebook environment for interactive computing. In affected versions untrusted notebook can execute code on load. Jupyter Notebook uses a deprecated version of Google Caja to sanitize user inputs. A public Caja bypass can be used to trigger an XSS when a victim opens a malicious ipynb document in Jupyter Notebook. The XSS allows an attacker to execute arbitrary code on the victim computer using Jupyter APIs.

Affected

Product or packageVersionsReported by
jupyter notebook>= 6.0.0, < 6.4.1, < 5.7.11, from 5.7.0 before 5.7.11, 6.4.0CVE List, NVD
notebook (PyPI)before 5.7.11, from 6.0.0 before 6.4.1, before 79fc76e890a8ec42f73a3d009e44ef84c14ef0d5, from 5.7.0 before 5.7.11GitHub Advisory Database, PyPA Advisory Database
jupyter-base-notebook (Bitnami)from 5.7.0 before 5.7.11, from 6.4.0 before 6.4.1Bitnami Vulnerability Database
jupyter-notebook (Bitnami)from 5.7.0 before 5.7.11, from 6.4.0 before 6.4.1Bitnami Vulnerability Database

All scores

GitHub_M10.0critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
GitHub10.0high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N
NVD9.6critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
NVD6.8medium CVSS:2.0AV:N/AC:M/Au:N/C:P/I:P/A:P
Bitnami Vulnerability Databasecritical rating

Classification

What each source says

CVE List

The Jupyter notebook is a web-based notebook environment for interactive computing. In affected versions untrusted notebook can execute code on load. Jupyter Notebook uses a deprecated version of Google Caja to sanitize user inputs. A public Caja bypass can be used to trigger an XSS when a victim opens a malicious ipynb document in Jupyter Notebook. The XSS allows an attacker to execute arbitrary code on the victim computer using Jupyter APIs.

GitHub Advisory Database
Impact

Untrusted notebook can execute code on load. This is a remote code execution, but requires user action to open a notebook.

Patches

5.7.11, 6.4.1

References

OWASP Page on Injection Prevention

For more information

If you have any questions or comments about this advisory, or vulnerabilities to report, please email our security list security@ipython.org.

Credit: Guillaume Jeanne from Google

Example:

A notebook with the following content in a cell and it would display an alert when opened for the first time in Notebook (in an untrusted state):

{ "cell_type": "code", "execution_count": 0, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<select><iframe></select><img src=x: onerror=alert('xss')>\n"], "text/plain": [] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "" ] }
NVD (es)

Jupyter notebook, es un entorno de cuaderno basado en la web para la computación interactiva. En las versiones afectadas, el cuaderno no fiable puede ejecutar código al cargarlo. Jupyter Notebook usa una versión obsoleta de Google Caja para sanear las entradas del usuario. Una omisión pública de Caja puede ser usado para desencadenar un ataque de tipo XSS cuando una víctima abre un documento ipynb malicioso en Jupyter Notebook. El ataque de tipo XSS permite a un atacante ejecutar código arbitrario en el ordenador de la víctima usando las API de Jupyter

References

Sources

SourceRecordLicence
CVE ListCVE-2021-32798 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-hwvq-6gjx-j797 changed 2026-09-10CC-BY-4.0
NVDCVE-2021-32798 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-118 changed 2023-12-06CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-JUPYTER-BASE-NOTEBOOK-2021-32798 changed 2026-09-08Apache-2.0
Bitnami Vulnerability DatabaseBIT-JUPYTER-NOTEBOOK-2021-32798 changed 2026-09-08Apache-2.0