VAITP Dataset

← Back to the dataset

CVE-2021-36359

OrbiTeam BSCW Classic < 7.4.3 RCE via XML injection in bscw.cgi op=_editfolder.EditFolder

  • CVSS 8.8
  • CWE-91 XML Injection (aka Blind XPath Injection)
  • Input Validation and Sanitization
  • Remote

OrbiTeam BSCW Classic before 7.4.3 allows exportpdf authenticated remote code execution (RCE) via XML tag injection because reportlab\platypus\paraparser.py (reached via bscw.cgi op=_editfolder.EditFolder) calls eval on attacker-supplied Python code. This is fixed in 5.0.12, 5.1.10, 5.2.4, 7.3.3, and 7.4.3.

CVSS base score
8.8
Published
2021-08-30
OWASP
A03 Injection
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
reportlab
Fixed by upgrading
Yes

Solution

Update to BSCW Classic version 7.4.3 or higher.

Vulnerable code sample

def vulnerable_function(user_input):
    # This function is vulnerable to remote code execution via eval
    result = eval(user_input)  # Dangerous: directly using eval on user input
    return result

# Example usage
user_input = "__import__('os').system('ls')"  # An attacker could inject this
output = vulnerable_function(user_input)

Patched code sample

import xml.etree.ElementTree as ET

def safe_eval(expression):
    # Implement a safe evaluation mechanism, avoiding eval
    # For example, you could use a whitelist of allowed operations or a library like ast.literal_eval
    return eval(expression)  # Replace this with a safer alternative

def process_xml_input(xml_input):
    try:
        root = ET.fromstring(xml_input)
        # Process the XML safely
        for elem in root.iter():
            # Only allow certain tags or attributes to be processed
            if elem.tag not in ['allowed_tag1', 'allowed_tag2']:
                raise ValueError("Invalid XML tag detected.")
            # Handle the element as needed
    except ET.ParseError:
        raise ValueError("Invalid XML input.")

# Example usage
xml_input = "<root><allowed_tag1>Data</allowed_tag1></root>"
process_xml_input(xml_input)

Cite this entry

@misc{vaitp:cve202136359,
  title        = {{OrbiTeam BSCW Classic < 7.4.3 RCE via XML injection in bscw.cgi op=_editfolder.EditFolder}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2021},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2021-36359},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2021-36359/}}
}

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.