CVE-2021-39158
NVCaffe's Python dependencies lacked 'gfortran' before 0.17.4, enabling possible malicious file installation
- CVSS 8.8
- CWE-345 Insufficient Verification of Data Authenticity
- Design Defects
- Remote
NVCaffe's python required dependencies list used to contain `gfortran`version prior to 0.17.4, entry which does not exist in the repository pypi.org. An attacker could potentially have posted malicious files to pypi.org causing a user to install it within NVCaffe.
- CVSS base score
- 8.8
- Published
- 2021-08-23
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Design Defects
- Subcategory
- Vulnerable and Outdated Components
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- NVCaffe
Solution
Remove the 'gfortran' dependency from NVCaffe's python dependencies.
Vulnerable code sample
from setuptools import setup, find_packages
setup(
name='example_package',
version='1.0',
packages=find_packages(),
install_requires=[
'numpy',
'scipy',
'gfortran==0.17.4' # Non-existent or mistyped package name
]
)Patched code sample
# Updated requirements list for NVCaffe to exclude the vulnerable gfortran version
required_dependencies = [
'numpy',
'scipy',
'matplotlib',
# Removed the entry for gfortran version prior to 0.17.4
# 'gfortran<0.17.4', # This line has been removed to prevent the vulnerability
]
# Function to install required dependencies safely
def install_dependencies(dependencies):
import subprocess
import sys
for package in dependencies:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
# Install the updated list of dependencies
install_dependencies(required_dependencies)Cite this entry
@misc{vaitp:cve202139158,
title = {{NVCaffe's Python dependencies lacked 'gfortran' before 0.17.4, enabling possible malicious file installation}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2021},
note = {VAITP Python Vulnerability Dataset, entry CVE-2021-39158},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2021-39158/}}
}
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 ::
