CVE-2024-34073
OS Command Injection vulnerability in sagemaker-python-sdk's capture_dependencies function.
- CVSS 7.8
- CWE-78
- Input Validation and Sanitization
- Remote
sagemaker-python-sdk is a library for training and deploying machine learning models on Amazon SageMaker. In affected versions the capture_dependencies function in `sagemaker.serve.save_retrive.version_1_0_0.save.utils` module allows for potentially unsafe Operating System (OS) Command Injection if inappropriate command is passed as the “requirements_path” parameter. This consequently may allow an unprivileged third party to cause remote code execution, denial of service, affecting both confidentiality and integrity. This issue has been addressed in version 2.214.3. Users are advised to upgrade. Users unable to upgrade should not override the “requirements_path” parameter of capture_dependencies function in `sagemaker.serve.save_retrive.version_1_0_0.save.utils`, and instead use the default value.
- CWE
- CWE-78
- CVSS base score
- 7.8
- Published
- 2024-05-03
- OWASP
- A01 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- sagemaker-py
- Fixed by upgrading
- Yes
Solution
Upgrade to version 2.214.3 or later.
Vulnerable code sample
from sagemaker.serve.save_retrive.version_1_0_0.save.utils import capture_dependencies
user_input = "/path/to/requirements.txt; rm -rf /"
capture_dependencies(requirements_path=user_input)Patched code sample
import os
import re
from sagemaker.serve.save_retrive.version_1_0_0.save.utils import capture_dependencies
def check_path(path):
if re.search(r'[;&|]', path):
return False
return os.path.isfile(path)
user_input = "/path/to/requirements.txt; rm -rf /"
if check_path(user_input):
capture_dependencies(requirements_path=user_input)
else:
print("Invalid path or potential security risk detected.")Payload
/path/to/requirements.txt; rm -rf /
Cite this entry
@misc{vaitp:cve202434073,
title = {{OS Command Injection vulnerability in sagemaker-python-sdk's capture_dependencies function.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-34073},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-34073/}}
}
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 ::
