CVE-2015-1341
Python module import vulnerability in Apport < 2.19.2 via command line argument
- CVSS 7.8
- CWE-264
- Input Validation and Sanitization
- Local
Any Python module in sys.path can be imported if the command line of the process triggering the coredump is Python and the first argument is -m in Apport before 2.19.2 function _python_module_path.
- CWE
- CWE-264
- CVSS base score
- 7.8
- Published
- 2019-04-22
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Local
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update Apport to version 2.19.2 or higher.
Vulnerable code sample
import sys
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == '-m':
module_to_import = sys.argv[2]
__import__(module_to_import)Patched code sample
import sys
import os
def example_import(module_name):
safe_modules = {'os', 'sys', 'math'}
if module_name in safe_modules:
return __import__(module_name)
else:
raise ImportError(f"Import of module '{module_name}' is not allowed.")
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == '-m':
module_to_import = sys.argv[2]
try:
example_import(module_to_import)
except ImportError as e:
print(e)Cite this entry
@misc{vaitp:cve20151341,
title = {{Python module import vulnerability in Apport < 2.19.2 via command line argument}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2015-1341},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2015-1341/}}
}
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 ::
