VAITP Dataset

← Back to the dataset

CVE-2008-5986

Untrusted search path in Csound 5.08.2 allows local users to execute arbitrary code via a malicious Python file in the current directory

  • CVSS 6.9
  • CWE-426: Untrusted Search Path
  • Input Validation and Sanitization
  • Local

Untrusted search path vulnerability in the (1) "VST plugin with Python scripting" and (2) "VST plugin for writing score generators in Python" in Csound 5.08.2, and possibly other versions, allows local users to execute arbitrary code via a Trojan horse Python file in the current working directory, related to a vulnerability in the PySys_SetArgv function (CVE-2008-5983).

CVSS base score
6.9
Published
2009-01-28
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
Python
Fixed by upgrading
Yes

Solution

Update Csound to a version that addresses CVE-2008-5983.

Vulnerable code sample

import os
import sys

# Simulating the vulnerable behavior by allowing imports from the current working directory
def vulnerable_import(module_name):
    return __import__(module_name)

# Example usage
if __name__ == "__main__":
    # This could lead to executing a Trojan horse Python file
    # If a malicious file named 'malicious_module.py' is present in the current directory,
    # it could be imported and executed.
    malicious_module = vulnerable_import('malicious_module')
    if malicious_module:
        # Proceed with using the imported module
        malicious_module.some_function()

Patched code sample

import os
import sys

def safe_import(module_name):
    # Define a safe import function that restricts the import path
    if os.getcwd() in sys.path:
        sys.path.remove(os.getcwd())  # Remove current working directory from path
    try:
        return __import__(module_name)
    except ImportError as e:
        print(f"Error importing module {module_name}: {e}")
        return None

# Example usage
if __name__ == "__main__":
    # Safely import a module
    my_module = safe_import('my_trusted_module')
    if my_module:
        # Proceed with using the imported module
        my_module.some_function()

Cite this entry

@misc{vaitp:cve20085986,
  title        = {{Untrusted search path in Csound 5.08.2 allows local users to execute arbitrary code via a malicious Python file in the current directory}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2009},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2008-5986},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2008-5986/}}
}

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.