CVE-2009-0314
Untrusted search path in gedit allows local code execution 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 Python module in gedit 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 gedit to a version that fixes CVE-2008-5983.
Vulnerable code sample
import sys
# Vulnerable code: The current working directory is included in sys.path
# This allows for the execution of a Trojan horse Python file if it exists in the current directory
# Assume a malicious script 'malicious.py' exists in the current working directory
# This could be executed unintentionally if the current directory is in sys.path
import malicious # This could be a Trojan horse script
# Continue with the rest of the application logicPatched code sample
import sys
import os
# Fix for CVE-2009-0314: Ensure that the current working directory is not included in sys.path
if os.getcwd() in sys.path:
sys.path.remove(os.getcwd())
# Now, you can safely import modules without the risk of executing a Trojan horse Python file
import some_safe_module # Replace with actual module importsCite this entry
@misc{vaitp:cve20090314,
title = {{Untrusted search path in gedit allows local code execution 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-2009-0314},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2009-0314/}}
}
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 ::
