CVE-2019-9855
LibreOffice Windows 8.3 Path Equivalence Vulnerability
- CVSS 9.8
- CWE-417
- Input Validation and Sanitization
- Remote
LibreOffice is typically bundled with LibreLogo, a programmable turtle vector graphics script, which can execute arbitrary python commands contained with the document it is launched from. LibreOffice also has a feature where documents can specify that pre-installed scripts can be executed on various document script events such as mouse-over, etc. Protection was added to block calling LibreLogo from script event handers. However a Windows 8.3 path equivalence handling flaw left LibreOffice vulnerable under Windows that a document could trigger executing LibreLogo via a Windows filename pseudonym. This issue affects: Document Foundation LibreOffice 6.2 versions prior to 6.2.7; 6.3 versions prior to 6.3.1.
- CWE
- CWE-417
- CVSS base score
- 9.8
- Published
- 2019-09-06
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Path Traversal
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update LibreOffice to version 6.2.7 or 6.3.1 or higher.
Vulnerable code sample
import os
def execute_script(script_name):
"""Vulnerable function that demonstrates the security issue."""
script_path = f"C:\\Program Files\\LibreOffice\\share\\librelogo\\{script_name}.py"
exec(open(script_path).read())
script = "C:\\Program Files\\LibreOffice\\share\\librelogo\\..\\..\\..\\..\\..\\..\\Windows\\System32\\script.py"
execute_script(script)Patched code sample
import os
def check_path(base_path, user_input):
"""Secure function that fixes the vulnerability."""
user_input_abs = os.path.abspath(user_input)
base_path_abs = os.path.abspath(base_path)
return os.path.commonpath([base_path_abs]) == os.path.commonpath([base_path_abs, user_input_abs])
def execute_script(script_path):
"""Secure function that fixes the vulnerability."""
base_path = '/path/to/scripts'
if check_path(base_path, script_path):
exec(open(script_path).read())
else:
raise ValueError("Attempted to execute a script outside of the safe directory.")
try:
execute_script('user_input_script.py')
except Exception as e:
print(f"Error: {e}")Cite this entry
@misc{vaitp:cve20199855,
title = {{LibreOffice Windows 8.3 Path Equivalence Vulnerability}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2019-9855},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-9855/}}
}
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 ::
