CVE-2013-4482
Untrusted search path vulnerability in Luci 0.26.0 via malicious .egg-info file
- CVSS 6.2
- CWE-426: Untrusted Search Path
- Authentication, Authorization, and Session Management
- Local
Untrusted search path vulnerability in python-paste-script (aka paster) in Luci 0.26.0, when started using the initscript, allows local users to gain privileges via a Trojan horse .egg-info file in the (1) current working directory or (2) its parent directories.
- CVSS base score
- 6.2
- Published
- 2013-11-23
- OWASP
- A05 Security Misconfiguration
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Privilege Escalation
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- python-paste-script
- Fixed by upgrading
- Yes
Solution
Update python-paste-script (paster) to version 0.2.2 or higher.
Vulnerable code sample
import os
import sys
def insecure_import(module_name):
# This function imports a module without checking the current or parent directory
__import__(module_name)
# Example usage
# This could potentially import a trojan horse .egg-info file if present
insecure_import('some_module')Patched code sample
import os
import sys
def secure_import(module_name):
# Get the current working directory
current_dir = os.getcwd()
# Get the parent directory
parent_dir = os.path.dirname(current_dir)
# Define a list of trusted directories (e.g., system paths)
trusted_dirs = ["/usr/local/lib/python3.x/dist-packages", "/usr/lib/python3.x/dist-packages"]
# Check if the current or parent directory is in the trusted directories
if current_dir in trusted_dirs or parent_dir in trusted_dirs:
# Proceed to import the module
__import__(module_name)
else:
raise ImportError("Untrusted directory: Cannot import from current or parent directory.")
# Example usage
try:
secure_import('some_module')
except ImportError as e:
print(e)Cite this entry
@misc{vaitp:cve20134482,
title = {{Untrusted search path vulnerability in Luci 0.26.0 via malicious .egg-info file}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2013},
note = {VAITP Python Vulnerability Dataset, entry CVE-2013-4482},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-4482/}}
}
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 ::
