CVE-2010-0395
User-assisted code execution in OpenOffice.org 2.x and 3.0 before 3.2.1 via a crafted ODT file
- CVSS 9.3
- CWE-20: Improper Input Validation
- Input Validation and Sanitization
- Remote
OpenOffice.org 2.x and 3.0 before 3.2.1 allows user-assisted remote attackers to bypass Python macro security restrictions and execute arbitrary Python code via a crafted OpenDocument Text (ODT) file that triggers code execution when the macro directory structure is previewed.
- CVSS base score
- 9.3
- Published
- 2010-06-10
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update OpenOffice.org to version 3.2.1 or higher.
Vulnerable code sample
import zipfile
def extract_and_execute(zip_file):
# VULNERABLE: This code is susceptible to path traversal
with zipfile.ZipFile(zip_file, 'r') as z:
z.extractall('/extraction/path')Patched code sample
import os
import zipfile
def check_path(base_path, target_path):
return os.path.realpath(target_path).startswith(os.path.realpath(base_path))
def check_for_exec(script):
blacklist = ["import", "os", "sys", "subprocess", "eval", "exec", "__import__", "open", "write", "exit"]
for item in blacklist:
if item in script:
return False
return True
def extract_and_execute(zip_file):
extraction_path = "/extraction/path"
with zipfile.ZipFile(zip_file, 'r') as z:
for member in z.namelist():
member_path = os.path.join(extraction_path, member)
if not check_path(extraction_path, member_path):
raise Exception("Unsafe path detected in ZIP file.")
z.extractall(extraction_path)
script_path = os.path.join(extraction_path, "script.py")
if os.path.isfile(script_path):
with open(script_path, "r") as file:
script_content = file.read()
if check_for_exec(script_content):
exec(script_content)
else:
raise Exception("Script contains unsafe code and will not be executed.")
else:
raise FileNotFoundError("Expected script not found.")Cite this entry
@misc{vaitp:cve20100395,
title = {{User-assisted code execution in OpenOffice.org 2.x and 3.0 before 3.2.1 via a crafted ODT file}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2010},
note = {VAITP Python Vulnerability Dataset, entry CVE-2010-0395},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2010-0395/}}
}
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 ::
