VAITP Dataset

← Back to the dataset

CVE-2005-2966

DIA 0.94 and earlier Python SVG import plugin: Arbitrary command execution via crafted SVG file

  • CVSS 5.1
  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') – Score: 7.8
  • Input Validation and Sanitization
  • Local

The Python SVG import plugin (diasvg_import.py) for DIA 0.94 and earlier allows user-assisted attackers to execute arbitrary commands via a crafted SVG file.

CVSS base score
5.1
Published
2005-10-05
OWASP
A03 Injection
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
Python
Fixed by upgrading
Yes

Solution

Update DIA to version 0.95 or higher.

Vulnerable code sample

import xml.etree.ElementTree as ET
import os

def unsafe_svg_import(svg_file):
    # Parse the SVG file
    tree = ET.parse(svg_file)
    root = tree.getroot()

    # Potentially unsafe processing of SVG content
    for element in root.iter():
        # Execute commands based on SVG content (vulnerable to arbitrary command execution)
        if element.tag == 'script':
            exec(element.text)  # Dangerous: executing arbitrary code from SVG

# Example usage
unsafe_svg_import('example.svg')

Patched code sample

import xml.etree.ElementTree as ET

def safe_svg_import(svg_file):
    # Parse the SVG file safely
    try:
        tree = ET.parse(svg_file)
        root = tree.getroot()

        # Process the SVG content without executing arbitrary code
        for element in root.iter():
            # Handle SVG elements as needed, but avoid executing any commands
            print(f"Processing element: {element.tag}")

    except ET.ParseError as e:
        print(f"Error parsing SVG file: {e}")

# Example usage
safe_svg_import('example.svg')

Cite this entry

@misc{vaitp:cve20052966,
  title        = {{DIA 0.94 and earlier Python SVG import plugin: Arbitrary command execution via crafted SVG file}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2005},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2005-2966},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2005-2966/}}
}

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.