VAITP Dataset

← Back to the dataset

CVE-2019-10633

Zyxel NAS 326 v5.21 and below: Remote code execution via eval injection

  • CVSS 8.8
  • CWE-94 Improper Control of Generation of Code ('Code Injection')
  • Input Validation and Sanitization
  • Remote

An eval injection vulnerability in the Python web server routing on the Zyxel NAS 326 version 5.21 and below allows a remote authenticated attacker to execute arbitrary code via the tjp6jp6y4, simZysh, and ck6fup6 APIs.

CVSS base score
8.8
Published
2019-04-09
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
Python
Fixed by upgrading
Yes

Solution

Update Zyxel NAS 326 to version 5.22 or higher.

Vulnerable code sample

def unsafe_execute(command):
    # Directly using eval on user input, leading to potential code execution
    return eval(command)

# Example of how the API might call the unsafe_execute function
def api_call(command):
    try:
        result = unsafe_execute(command)
        return {"status": "success", "result": result}
    except Exception as e:
        return {"status": "error", "message": str(e)}

# Example usage
response = api_call('2 + 2')  # Arbitrary code execution
print(response)

response = api_call('__import__("os").system("ls")')  # Potentially dangerous command
print(response)

Patched code sample

import re

def safe_execute(command):
    # Only allow specific commands or patterns
    allowed_commands = ['command1', 'command2', 'command3']
    if command in allowed_commands:
        # Execute the command safely
        return execute_command(command)
    else:
        raise ValueError("Unauthorized command execution attempt.")

def execute_command(command):
    # Placeholder for actual command execution logic
    return f"Executing: {command}"

# Example of how the API might call the safe_execute function
def api_call(command):
    try:
        result = safe_execute(command)
        return {"status": "success", "result": result}
    except ValueError as e:
        return {"status": "error", "message": str(e)}

# Example usage
response = api_call('command1')  # Allowed command
print(response)

response = api_call('unauthorized_command')  # Not allowed command
print(response)

Cite this entry

@misc{vaitp:cve201910633,
  title        = {{Zyxel NAS 326 v5.21 and below: Remote code execution via eval injection}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-10633},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-10633/}}
}

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.