CVE-2021-32797: JupyterLab Untrusted Notebook Code Execution
Summary
CVE-2021-32797: JupyterLab is a user interface for Project Jupyter which will eventually replace the classic Jupyter Notebook. Affects jupyterlab across 6 version ranges.
< 1.2.21
>= 2, < 2.2.10
>= 2.3, < 2.3.2
>= 3, < 3.0.17
>= 3.1, < 3.1.4
< 504825938c0abfa2fb8ff8d529308830a5ae42ed
Fixed in 5 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- notebook · PyPI
- jupyterlab · Bitnami
The same CVE-2021-32797 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
JupyterLab is a user interface for Project Jupyter that aims to replace the classic Jupyter Notebook. It provides a web-based environment for interactive computing and data science workflows. JupyterLab allows users to create and share documents that contain live code, equations, visualizations, and narrative text. However, in certain versions of JupyterLab, there is a vulnerability that allows untrusted notebooks to execute code upon loading. This vulnerability arises from the lack of sanitization of the action attribute of HTML <form> elements. Exploiting this issue requires user interaction to open a notebook.
Vulnerability Detail
The vulnerability in JupyterLab allows untrusted notebooks to execute code when loaded. This occurs because JupyterLab fails to properly sanitize the action attribute of HTML <form> elements. By manipulating the form validation outside of the form itself, an attacker can trigger remote code execution. However, it is important to note that this vulnerability requires user action to open a notebook. If a user unknowingly opens a malicious notebook, the attacker can execute arbitrary code on the user's system. This can lead to various consequences, such as unauthorized access, data theft, or system compromise.
How To Fix
Latest published version: 4.6.4 as of 22 Oct 2026
pip install --upgrade "jupyterlab==4.6.4"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 1.2.211.2.21pip install --upgrade "jupyterlab==1.2.21" -
>= 2, < 2.2.102.2.10pip install --upgrade "jupyterlab==2.2.10" -
>= 2.3, < 2.3.22.3.2pip install --upgrade "jupyterlab==2.3.2" -
>= 3, < 3.0.173.0.17pip install --upgrade "jupyterlab==3.0.17" -
>= 3.1, < 3.1.43.1.4pip install --upgrade "jupyterlab==3.1.4"
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 exercise caution when opening notebooks from untrusted sources. It is important to only open notebooks from trusted and verified sources. Additionally, users can disable the execution of code upon notebook load by modifying the JupyterLab configuration. To do this, create or edit the jupyter_notebook_config.py file and add the following line:
c.NotebookApp.allow_notebook_code_execution = False
Conclusion
In conclusion, JupyterLab versions prior to 1.2.21, 2.2.10, 2.3.2, 3.0.17, and 3.1.4 are vulnerable to untrusted notebook code execution. This vulnerability allows attackers to execute arbitrary code on a user's system when a malicious notebook is opened. It is crucial to update JupyterLab to a fixed version and exercise caution when opening notebooks from untrusted sources. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for jupyterlab →
FAQ
JupyterLab is a user interface for Project Jupyter that provides a web-based environment for interactive computing and data science workflows. It allows users to create and share documents containing live code, equations, visualizations, and narrative text.
This vulnerability allows untrusted notebooks to execute code when loaded in JupyterLab. If a user opens a malicious notebook, an attacker can execute arbitrary code on the user's system, potentially leading to unauthorized access, data theft, or system compromise.
To fix this vulnerability, update JupyterLab to a version that includes the fix. Versions 1.2.21, 2.2.10, 2.3.2, 3.0.17, and 3.1.4 have addressed the issue. Use the command pip install --upgrade jupyterlab to update JupyterLab from the PyPI repository.
As a temporary workaround, exercise caution when opening notebooks from untrusted sources. Only open notebooks from trusted and verified sources. Additionally, you can disable code execution upon notebook load by modifying the JupyterLab configuration.
No, this vulnerability requires user action to open a notebook. If a user unknowingly opens a malicious notebook, the attacker can execute code on the user's system.
References
Related vulnerabilities
Recent vulnerabilities recorded for jupyterlab.