VAITP Dataset

← Back to the dataset

CVE-2020-4636

Command injection in IBM Resilient OnPrem 38.2 via Python3 scripting

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

IBM Resilient OnPrem 38.2 could allow a privileged user to inject malicious commands through Python3 scripting. IBM X-Force ID: 185503.

CVSS base score
7.2
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
Fixed by upgrading
Yes

Solution

Update to IBM Resilient OnPrem version 38.3 or higher

Vulnerable code sample

import subprocess

def execute_command(command):
    """Vulnerable function that demonstrates the security issue."""
    result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
    return result.stdout

user_input = "ls -l; rm -rf /"
output = execute_command(user_input)
print(output)

Patched code sample

import subprocess

BLACKLIST = ["rm", "shutdown", "reboot", "format", "reboot", "dd", "mkfs", "chmod", "chown"]

def execute_command(command):
    """Secure function that fixes the vulnerability."""
    command_list = command.split()
    if any(blacklisted in command_list for blacklisted in BLACKLIST):
        return "Error: Command contains blacklisted keywords."
    
    try:
        result = subprocess.run(command_list, check=True, capture_output=True, text=True)
        return result.stdout
    except subprocess.CalledProcessError as e:
        return f"Error: {e.stderr}"

user_input = "ls -l; rm -rf /"
output = execute_command(user_input)
print(output)

Cite this entry

@misc{vaitp:cve20204636,
  title        = {{Command injection in IBM Resilient OnPrem 38.2 via Python3 scripting}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2020},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2020-4636},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-4636/}}
}
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 ::