VAITP Dataset

← Back to the dataset

CVE-2009-0318

Untrusted search path vulnerability in Gnumeric's Python interpreter allows local code execution with a malicious Python file in the current directory

  • CVSS 6.9
  • CWE-426: Untrusted Search Path
  • Authentication, Authorization, and Session Management
  • Local

Untrusted search path vulnerability in the GObject Python interpreter wrapper in Gnumeric 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
Authentication, Authorization, and Session Management
Subcategory
Privilege Escalation
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
GObject
Fixed by upgrading
Yes

Solution

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

Vulnerable code sample

import os
import sys

# Vulnerable code demonstrating untrusted search path
# The current working directory is included in sys.path

# Print the current working directory
print("Current working directory:", os.getcwd())

# The current directory is included in sys.path, allowing for potential
# execution of a Trojan horse Python file.
sys.path.append(os.getcwd())

# Attempt to import a module that may be present in the current directory
try:
    import some_module  # This could be a Trojan horse if it exists in the cwd
except ImportError as e:
    print("Import failed:", e)

Patched code sample

import os
import sys

# Fix for CVE-2009-0318: Set the Python module search path to a safe location
# and avoid using the current working directory.

# Define a safe directory for module imports
safe_directory = '/usr/lib/python3/dist-packages'  # Example safe path

# Update sys.path to include only the safe directory
sys.path = [safe_directory] + [p for p in sys.path if p != os.getcwd()]

# Now you can safely import modules without the risk of executing
# a Trojan horse Python file in the current working directory.

Cite this entry

@misc{vaitp:cve20090318,
  title        = {{Untrusted search path vulnerability in Gnumeric's Python interpreter allows local code execution with 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-2009-0318},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2009-0318/}}
}

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.