VAITP Dataset

← Back to the dataset

CVE-2007-1253

Blender 0.1.9h: Remote code execution via crafted KML/KMZ files

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

Eval injection vulnerability in the (a) kmz_ImportWithMesh.py Script for Blender 0.1.9h, as used in (b) Blender before 2.43, allows user-assisted remote attackers to execute arbitrary Python code by importing a crafted (1) KML or (2) KMZ file.

CVSS base score
9.3
Published
2007-03-03
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
Blender
Fixed by upgrading
Yes

Solution

Update Blender to version 2.43 or higher.

Vulnerable code sample

import zipfile
import xml.etree.ElementTree as ET

def import_kmz(file_path):
    # Assume the file is a valid KMZ (zip) file
    with zipfile.ZipFile(file_path, 'r') as kmz:
        # Extract KML file from KMZ
        kml_files = [name for name in kmz.namelist() if name.endswith('.kml')]
        if not kml_files:
            raise ValueError("No KML file found in KMZ")

        # Read the KML file
        with kmz.open(kml_files[0]) as kml_file:
            kml_content = kml_file.read()

        # Execute arbitrary code from the KML content
        exec(kml_content)  # Vulnerable to eval injection

# Example usage
# import_kmz('path/to/crafted.kmz')

Patched code sample

import zipfile
import xml.etree.ElementTree as ET

def safe_import_kmz(file_path):
    # Ensure the file is a valid KMZ (zip) file
    if not zipfile.is_zipfile(file_path):
        raise ValueError("Invalid KMZ file")

    with zipfile.ZipFile(file_path, 'r') as kmz:
        # Extract KML file from KMZ
        kml_files = [name for name in kmz.namelist() if name.endswith('.kml')]
        if not kml_files:
            raise ValueError("No KML file found in KMZ")

        # Read the KML file safely
        with kmz.open(kml_files[0]) as kml_file:
            kml_content = kml_file.read()

        # Parse the KML content using ElementTree
        try:
            root = ET.fromstring(kml_content)
            # Process the KML content safely without eval
            process_kml(root)
        except ET.ParseError as e:
            raise ValueError("Error parsing KML: {}".format(e))

def process_kml(root):
    # Implement your KML processing logic here
    # Avoid using eval or exec on any user-controlled data
    for placemark in root.findall('.//Placemark'):
        name = placemark.find('name').text
        print(f"Processing placemark: {name}")

Cite this entry

@misc{vaitp:cve20071253,
  title        = {{Blender 0.1.9h: Remote code execution via crafted KML/KMZ files}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2007},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2007-1253},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2007-1253/}}
}

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.