CVE-2021-32797
📋 TL;DR
JupyterLab versions before 3.1.0 contain a cross-site scripting vulnerability where untrusted notebooks can execute arbitrary code when loaded. The vulnerability occurs because JupyterLab doesn't properly sanitize the action attribute of HTML forms, allowing attackers to trigger form validation outside the form itself. This affects all JupyterLab users who open untrusted notebooks.
💻 Affected Systems
- JupyterLab
📦 What is this software?
Jupyterlab by Jupyter
Jupyterlab by Jupyter
Jupyterlab by Jupyter
Jupyterlab by Jupyter
Jupyterlab by Jupyter
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution on the JupyterLab server, potentially compromising the entire server environment and accessing sensitive data.
Likely Case
Execution of malicious scripts in the user's browser context, leading to session hijacking, data theft, or further exploitation.
If Mitigated
Limited impact with proper input validation and sandboxing, potentially only affecting the current user session.
🎯 Exploit Status
Exploitation requires user to open a malicious notebook file. The vulnerability is well-documented in public advisories.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.1.0 and later
Vendor Advisory: https://github.com/jupyterlab/jupyterlab/security/advisories/GHSA-4952-p58q-6crx
Restart Required: Yes
Instructions:
1. Update JupyterLab to version 3.1.0 or later using pip: 'pip install --upgrade jupyterlab>=3.1.0' 2. Restart the JupyterLab server 3. Verify the update was successful
🔧 Temporary Workarounds
Disable notebook auto-execution
allConfigure JupyterLab to not automatically execute notebook content on load
jupyter lab --NotebookApp.iopub_data_rate_limit=10000000
Use content security policies
allImplement strict CSP headers to limit script execution
🧯 If You Can't Patch
- Restrict notebook sources to trusted repositories only
- Implement network segmentation to isolate JupyterLab instances
🔍 How to Verify
Check if Vulnerable:
Check JupyterLab version: 'jupyter lab --version' or 'pip show jupyterlab'
Check Version:
jupyter lab --version
Verify Fix Applied:
Verify version is 3.1.0 or higher and test with known malicious notebooks
📡 Detection & Monitoring
Log Indicators:
- Unusual form validation requests
- Suspicious notebook file access patterns
- Unexpected code execution events
Network Indicators:
- Malicious notebook file transfers
- Unusual outbound connections from JupyterLab instances
SIEM Query:
source="jupyterlab" AND (event="form_validation" OR event="notebook_load") AND status="suspicious"
🔗 References
- https://github.com/jupyterlab/jupyterlab/commit/504825938c0abfa2fb8ff8d529308830a5ae42ed
- https://github.com/jupyterlab/jupyterlab/security/advisories/GHSA-4952-p58q-6crx
- https://github.com/jupyterlab/jupyterlab/commit/504825938c0abfa2fb8ff8d529308830a5ae42ed
- https://github.com/jupyterlab/jupyterlab/security/advisories/GHSA-4952-p58q-6crx