CVE-2021-32798: Jupyter Notebook Untrusted Notebook Code Execution
Summary
CVE-2021-32798: Failure to Sanitize Special Elements into a Different Plane (Special Element Injection) in notebook. Affects jupyter-notebook across 2 version ranges.
>= 5.7.0, < 5.7.11
>= 6.4.0, < 6.4.1
Fixed in 5.7.11 or 6.4.1, depending on the release line you run. How to fix ↓
Also tracked for
- jupyter-base-notebook · Bitnami
- notebook · PyPI
- jupyter-notebook · Debian:11
- notebook · PyPI
The same CVE-2021-32798 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Jupyter Notebook is a web-based notebook environment for interactive computing. It allows users to create and share documents that contain live code, equations, visualizations, and narrative text. The notebook interface is widely used in data science and scientific computing. However, in affected versions, untrusted notebooks can execute code on load. Jupyter Notebook relies on a deprecated version of Google Caja to sanitize user inputs. This vulnerability allows a public Caja bypass to trigger a cross-site scripting (XSS) attack when a victim opens a malicious ipynb document in Jupyter Notebook. The XSS enables an attacker to execute arbitrary code on the victim's computer using Jupyter APIs.
Vulnerability Detail
The vulnerability arises from the use of a deprecated version of Google Caja for input sanitization in Jupyter Notebook. By exploiting a public Caja bypass, an attacker can inject malicious code into a notebook document. When the victim opens the document in Jupyter Notebook, the injected code is executed, leading to potential remote code execution on the victim's machine. This can result in unauthorized access, data theft, or further compromise of the system. The severity of this vulnerability is rated as Critical with a CVSS score of 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H).
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 5.7.0, < 5.7.115.7.11 -
>= 6.4.0, < 6.4.16.4.1
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, users can disable the execution of untrusted notebook code by modifying the Jupyter Notebook configuration. This can be achieved by setting the NotebookApp.allow_notebook_code_execution option to False in the Jupyter configuration file. However, this workaround may limit the functionality of Jupyter Notebook and should only be considered as a temporary measure until the vulnerability is fixed.
Conclusion
In conclusion, the Jupyter Notebook vulnerability (CVE-2021-32798) allows untrusted notebooks to execute code on load, leading to potential remote code execution on the victim's machine. It is crucial to update Jupyter Notebook to version 5.7.11 or higher and consider updating any affected dependencies or plugins. As a temporary workaround, the execution of untrusted notebook code can be disabled, but this may limit the functionality of Jupyter Notebook. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for jupyter-notebook →
FAQ
Jupyter Notebook is a web-based notebook environment for interactive computing. It allows users to create and share documents that contain live code, equations, visualizations, and narrative text.
This vulnerability allows an attacker to execute arbitrary code on a victim's computer by tricking them into opening a malicious ipynb document in Jupyter Notebook. This can lead to unauthorized access, data theft, or further compromise of the system.
To fix this vulnerability, update Jupyter Notebook to version 5.7.11 or higher. It is also recommended to update any affected dependencies or plugins.
Yes, as a temporary workaround, you can disable the execution of untrusted notebook code by modifying the Jupyter Notebook configuration. Set the NotebookApp.allow_notebook_code_execution option to False in the Jupyter configuration file.
You can find more information about this vulnerability in the Jupyter Notebook vulnerability database: [link to vulnerability database]
References
Related vulnerabilities
Recent vulnerabilities recorded for jupyter-notebook.