CVE-2019-9851
Pre-6.2.6 LibreOffice: Pre-installed script execution vulnerability
- CVSS 9.8
- CWE-20 Improper Input Validation
- 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. Protection was added, to address CVE-2019-9848, to block calling LibreLogo from document event script handers, e.g. mouse over. However LibreOffice also has a separate feature where documents can specify that pre-installed scripts can be executed on various global script events such as document-open, etc. In the fixed versions, global script event handlers are validated equivalently to document script event handlers. This issue affects: Document Foundation LibreOffice versions prior to 6.2.6.
- CVSS base score
- 9.8
- Published
- 2019-08-15
- OWASP
- A05 Security Misconfiguration
- 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
- Affected component
- LibreOffice
- Fixed by upgrading
- Yes
Solution
Update LibreOffice to version 6.2.6 or higher.
Vulnerable code sample
def execute_user_script(script):
# Vulnerable code that executes arbitrary user scripts without validation
exec(script)
# Example usage
user_script = "import os; os.system('echo Vulnerable!')" # This could execute arbitrary commands
execute_user_script(user_script)
malicious_script = "__import__('os').system('rm -rf /')" # This could be used for malicious actions
execute_user_script(malicious_script)Patched code sample
def validate_script_event_handlers(script):
# Example of validation logic to prevent arbitrary command execution
allowed_commands = ['print', 'draw_circle', 'draw_square'] # Example of allowed commands
for command in script.split(';'):
command = command.strip()
if command not in allowed_commands:
raise ValueError("Unauthorized command detected: {}".format(command))
def execute_script(script):
try:
validate_script_event_handlers(script)
exec(script) # Safely execute only validated commands
except ValueError as e:
print(e)
# Example usage
user_script = "print('Hello, World!'); draw_circle(10)" # This is allowed
execute_script(user_script)
malicious_script = "os.system('rm -rf /')" # This is not allowed
execute_script(malicious_script)Cite this entry
@misc{vaitp:cve20199851,
title = {{Pre-6.2.6 LibreOffice: Pre-installed script execution vulnerability}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2019-9851},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-9851/}}
}
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 ::
