VAITP Dataset

← Back to the dataset

CVE-2024-3126

Command injection in 'run_xtts_api_server' allows remote code execution.

  • CVSS 8.4
  • CWE-78
  • Input Validation and Sanitization
  • Remote

A command injection vulnerability exists in the 'run_xtts_api_server' function of the parisneo/lollms-webui application, specifically within the 'lollms_xtts.py' script. The vulnerability arises due to the improper neutralization of special elements used in an OS command. The affected function utilizes 'subprocess.Popen' to execute a command constructed with a Python f-string, without adequately sanitizing the 'xtts_base_url' input. This flaw allows attackers to execute arbitrary commands remotely by manipulating the 'xtts_base_url' parameter. The vulnerability affects versions up to and including the latest version before 9.5. Successful exploitation could lead to arbitrary remote code execution (RCE) on the system where the application is deployed.

CVSS base score
8.4
Published
2024-05-16
OWASP
A01 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
lollms-webui

Solution

Sanitize the 'xtts_base_url' input and upgrade to version 9.5 or later.

Vulnerable code sample

import subprocess

def run_xtts_api_server(xtts_base_url):
    """Vulnerable function that demonstrates the security issue."""
    command = f"some_command --url {xtts_base_url}"
    subprocess.Popen(command, shell=True)

Patched code sample

import subprocess
import shlex

def run_xtts_api_server(xtts_base_url):
    """Secure function that fixes the vulnerability."""
    escaped_xtts_base_url = shlex.quote(xtts_base_url)
    command = f"some_command --url {escaped_xtts_base_url}"
    subprocess.Popen(command, shell=True)

Payload

http://example.com; ls -la

Cite this entry

@misc{vaitp:cve20243126,
  title        = {{Command injection in 'run_xtts_api_server' allows remote code execution.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-3126},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-3126/}}
}
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 ::