CVE-2018-12175
Intel Python 2018 default directory permissions allow privilege escalation
- CVSS 7.8
- CWE-276 Incorrect Default Permissions
- Authentication, Authorization, and Session Management
- Local
Default install directory permissions in Intel Distribution for Python (IDP) version 2018 may allow an unprivileged user to escalate privileges via local access.
- CVSS base score
- 7.8
- Published
- 2018-09-12
- 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
- Intel Distribution for Python
- Fixed by upgrading
- Yes
Solution
Update IDP 2018 to a version with fixed directory permissions.
Vulnerable code sample
import os
def insecure_install_directory(directory):
# Set the permissions to be more permissive
os.makedirs(directory, exist_ok=True)
os.chmod(directory, 0o777) # Read, write, and execute for everyone
# Create a sample file in the directory
with open(os.path.join(directory, 'sample_file.txt'), 'w') as f:
f.write('This is a sample file.')
# Example usage
insecure_install_directory('/path/to/install/directory')Patched code sample
import os
import stat
def secure_install_directory(directory):
# Set the permissions to be more restrictive
os.chmod(directory, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
# Optionally, remove group and other permissions
for root, dirs, files in os.walk(directory):
for dir in dirs:
os.chmod(os.path.join(root, dir), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
for file in files:
os.chmod(os.path.join(root, file), stat.S_IRUSR | stat.S_IWUSR)
# Example usage
secure_install_directory('/path/to/install/directory')Cite this entry
@misc{vaitp:cve201812175,
title = {{Intel Python 2018 default directory permissions allow privilege escalation}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2018},
note = {VAITP Python Vulnerability Dataset, entry CVE-2018-12175},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2018-12175/}}
}
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 ::
