CVE-2015-7337
IPython/Jupyter Notebook 3.2.2 and 4.0.x JavaScript Code Execution
- CVSS 6.8
- CWE-20
- Configuration Issues
- Remote
The editor in IPython Notebook before 3.2.2 and Jupyter Notebook 4.0.x before 4.0.5 allows remote attackers to execute arbitrary JavaScript code via a crafted file, which triggers a redirect to files/, related to MIME types.
- CWE
- CWE-20
- CVSS base score
- 6.8
- Published
- 2015-09-29
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Build/Package/Merge
- Code defect classification
- Packaging Issues
- Category
- Configuration Issues
- Subcategory
- Cross-Site Scripting (XSS)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update to Jupyter Notebook version 4.0.5 or higher
Vulnerable code sample
import mimetypes
def handle_uploaded_file(file):
mime_type, _ = mimetypes.guess_type(file.filename)
if mime_type.startswith('text/'):
with open(file.filename, 'r') as f:
content = f.read()
exec(content)
else:
print("Unsupported file type.")Patched code sample
import mimetypes
def handle_uploaded_file(file):
mime_type, _ = mimetypes.guess_type(file.filename)
if mime_type.startswith('text/'):
content = file.read().decode('utf-8')
if any(keyword in content for keyword in ["exec", "import", "os", "sys"]):
print("Potentially dangerous content detected.")
else:
print("Safe to process the content.")
else:
print("Unsupported file type.")Cite this entry
@misc{vaitp:cve20157337,
title = {{IPython/Jupyter Notebook 3.2.2 and 4.0.x JavaScript Code Execution}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2015},
note = {VAITP Python Vulnerability Dataset, entry CVE-2015-7337},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2015-7337/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
