VAITP Dataset

← Back to the dataset

CVE-2009-0668

ZODB < 3.8.2 with ZEO: Remote code execution

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

Unspecified vulnerability in Zope Object Database (ZODB) before 3.8.2, when certain Zope Enterprise Objects (ZEO) database sharing is enabled, allows remote attackers to execute arbitrary Python code via vectors involving the ZEO network protocol.

CVSS base score
6.5
Published
2009-08-07
OWASP
A08 Software and Data Integrity Failures
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
ZODB
Fixed by upgrading
Yes

Solution

Update ZODB to version 3.8.2 or higher.

Vulnerable code sample

# Example representation of the vulnerability in ZODB before it was fixed

from ZODB import FileStorage, DB
from ZEO import ClientStorage

class VulnerableZEOClientStorage(ClientStorage):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def handle_request(self, request):
        # Vulnerable code that executes requests without validation
        exec(request)  # This allows arbitrary code execution from the request

# Usage of the vulnerable storage
storage = VulnerableZEOClientStorage('localhost:8100')
db = DB(storage)

Patched code sample

# Example fix for CVE-2009-0668 in ZODB by validating incoming requests

from ZODB import FileStorage, DB
from ZEO import ClientStorage
import ZODB

class SecureZEOClientStorage(ClientStorage):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def check_request(self, request):
        # Implement strict validation of requests to prevent arbitrary code execution
        if not self.is_valid_request(request):
            raise ValueError("Invalid request detected!")

    def is_valid_request(self, request):
        # Add logic to validate the request, e.g., check for allowed operations
        # This is a placeholder for actual validation logic
        return True  # Replace with actual validation

# Usage of the secure storage
storage = SecureZEOClientStorage('localhost:8100')
db = DB(storage)

Cite this entry

@misc{vaitp:cve20090668,
  title        = {{ZODB < 3.8.2 with ZEO: Remote code execution}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2009},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2009-0668},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2009-0668/}}
}

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.