CVE-2021-32798
📋 TL;DR
CVE-2021-32798 is a critical vulnerability in Jupyter Notebook that allows malicious notebook files to execute arbitrary JavaScript code when opened. This cross-site scripting (XSS) vulnerability can lead to remote code execution on the victim's system through Jupyter APIs. All users running affected versions of Jupyter Notebook are vulnerable.
💻 Affected Systems
- Jupyter Notebook
📦 What is this software?
Notebook by Jupyter
Notebook by Jupyter
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of the Jupyter Notebook server allowing attacker to execute arbitrary commands, access sensitive data, and potentially pivot to other systems.
Likely Case
Attacker gains code execution within the Jupyter Notebook context, potentially accessing user data, installing malware, or using the server for further attacks.
If Mitigated
No impact if patched or proper network segmentation prevents malicious notebook upload/execution.
🎯 Exploit Status
Exploitation requires the victim to open a malicious .ipynb notebook file. Public proof-of-concept exists and the vulnerability is actively exploited.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 6.4.0 and later
Vendor Advisory: https://github.com/jupyter/notebook/security/advisories/GHSA-hwvq-6gjx-j797
Restart Required: Yes
Instructions:
1. Update Jupyter Notebook using pip: 'pip install --upgrade notebook>=6.4.0' 2. Restart the Jupyter Notebook server 3. Verify the version with 'jupyter notebook --version'
🔧 Temporary Workarounds
Disable notebook execution
allTemporarily disable opening of untrusted notebook files
jupyter notebook --NotebookApp.disable_check_xsrf=True --NotebookApp.token='' --NotebookApp.password=''
🧯 If You Can't Patch
- Restrict Jupyter Notebook access to trusted users only
- Implement network segmentation to isolate Jupyter Notebook from sensitive systems
🔍 How to Verify
Check if Vulnerable:
Check Jupyter Notebook version: 'jupyter notebook --version'. If version is below 6.4.0, the system is vulnerable.
Check Version:
jupyter notebook --version
Verify Fix Applied:
Verify version is 6.4.0 or higher: 'jupyter notebook --version' should show 6.4.0+
📡 Detection & Monitoring
Log Indicators:
- Unusual notebook file uploads
- Suspicious JavaScript execution in notebook logs
- Unexpected system commands executed from notebook context
Network Indicators:
- Unusual outbound connections from Jupyter Notebook server
- Download of suspicious notebook files
SIEM Query:
source="jupyter" AND (event="notebook_execution" OR event="file_upload") AND suspicious_patterns
🔗 References
- https://github.com/jupyter/notebook/commit/79fc76e890a8ec42f73a3d009e44ef84c14ef0d5
- https://github.com/jupyter/notebook/security/advisories/GHSA-hwvq-6gjx-j797
- https://github.com/jupyter/notebook/commit/79fc76e890a8ec42f73a3d009e44ef84c14ef0d5
- https://github.com/jupyter/notebook/security/advisories/GHSA-hwvq-6gjx-j797