CVE-2009-5042
python-docutils insecure temporary files
- CVSS 9.1
- CWE-668 Exposure of Resource to Wrong Sphere
- Information Leakage
- Remote
python-docutils allows insecure usage of temporary files
- CVSS base score
- 9.1
- Published
- 2019-10-31
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Information Leakage
- Subcategory
- Insecure Handling of Sensitive Data
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Fixed by upgrading
- Yes
Solution
Update python-docutils to a version that fixes the vulnerability.
Vulnerable code sample
import tempfile
def create_temp_file(prefix='temp', suffix='.txt'):
temp_file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix, delete=False)
return temp_file.name
temp_file_path = create_temp_file()
print(f"Insecure temporary file created at: {temp_file_path}")Patched code sample
import tempfile
import os
import stat
def create_temp_file(prefix='temp', suffix='.txt'):
temp_file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix, delete=False)
os.chmod(temp_file.name, stat.S_IRUSR | stat.S_IWUSR)
return temp_file.name
temp_file_path = create_temp_file()
print(f"Temporary file created at: {temp_file_path}")Cite this entry
@misc{vaitp:cve20095042,
title = {{python-docutils insecure temporary files}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2009-5042},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2009-5042/}}
}
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 ::
