CVE-2024-27320
Arbitrary code execution in Refuel Autolabel via malicious CSV files.
- CVSS 7.8
- CWE-1236
- Input Validation and Sanitization
- Remote
An arbitrary code execution vulnerability exists in versions 0.0.8 and newer of the Refuel Autolabel library because of the way its classification tasks handle provided CSV files. If a victim user creates a classification task using a maliciously crafted CSV file containing Python code, the code will be passed to an eval function which executes it.
- CWE
- CWE-1236
- CVSS base score
- 7.8
- Published
- 2024-09-12
- OWASP
- A01 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Refuel Autol
- Fixed by upgrading
- Yes
Solution
Upgrade to version 0.0.9 or newer and avoid using eval on untrusted input.
Vulnerable code sample
import csv
def process_csv(file_path):
"""Vulnerable function that demonstrates the security issue."""
with open(file_path, 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
expression = row[0]
result = eval(expression)
print(result)Patched code sample
import csv
import ast
def process_csv(file_path):
"""Secure function that fixes the vulnerability."""
# SECURE: This version prevents command injection
with open(file_path, 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
expression = row[0]
result = ast.literal_eval(expression)
print(result)Payload
"__import__('os').system('whoami')"
Cite this entry
@misc{vaitp:cve202427320,
title = {{Arbitrary code execution in Refuel Autolabel via malicious CSV files.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-27320},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-27320/}}
}
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 ::
