VAITP Dataset

← Back to the dataset

CVE-2020-26943

Code execution via Python eval in Horizon

  • CVSS 9.9
  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
  • Input Validation and Sanitization
  • Remote

An issue was discovered in OpenStack blazar-dashboard before 1.3.1, 2.0.0, and 3.0.0. A user allowed to access the Blazar dashboard in Horizon may trigger code execution on the Horizon host as the user the Horizon service runs under (because the Python eval function is used). This may result in Horizon host unauthorized access and further compromise of the Horizon service. All setups using the Horizon dashboard with the blazar-dashboard plugin are affected.

CVSS base score
9.9
Published
2020-10-16
OWASP
A03 Injection
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
blazar-dashboard
Fixed by upgrading
Yes

Solution

Update OpenStack blazar-dashboard to version 3.0.0 or higher.

Vulnerable code sample

# Vulnerable code using eval (demonstrating the issue)
user_input = "__import__('os').system('ls')"  # Example of malicious input
result = eval(user_input)  # This can execute arbitrary code

Patched code sample

# Original vulnerable code using eval (not to be used)
# user_input = "some user input that could be malicious"
# result = eval(user_input)

# Fixed code using ast.literal_eval for safer evaluation
import ast

def safe_eval(user_input):
    try:
        # Only allow certain types of literals
        result = ast.literal_eval(user_input)
        return result
    except (ValueError, SyntaxError) as e:
        print("Invalid input:", e)
        return None

# Example usage
user_input = "{'key': 'value'}"  # Example of safe input
result = safe_eval(user_input)
print(result)

Cite this entry

@misc{vaitp:cve202026943,
  title        = {{Code execution via Python eval in Horizon}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2020-26943},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-26943/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.