CVE-2026-118616
Remote code execution via unsanitized string in Ultralytics parse_model function.
- CVSS 7.8
- CWE-94
- Input Validation and Sanitization
- Remote
Ultralytics parse_model Code Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Ultralytics. User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file. The specific flaw exists within the parse_model function. The issue results from the lack of proper validation of a user-supplied string before using it to execute Python code. An attacker can leverage this vulnerability to execute code in the context of the current user. Was ZDI-CAN-30123.
- CWE
- CWE-94
- CVSS base score
- 7.8
- Published
- 2026-10-28
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Ultralytics
- Fixed by upgrading
- Yes
Solution
Upgrade Ultralytics to version 8.1.0 or later, which patches the parse_model code‑injection RCE.
Vulnerable code sample
import yaml
def parse_model(config_path: str):
"""
Load a YOLO model configuration and instantiate layers.
"""
with open(config_path, "r") as f:
cfg = yaml.safe_load(f)
# VULNERABLE: executing user‑controlled string with eval
layers = {}
for name, spec in cfg["model"]["layers"].items():
# spec is expected to be a string like "Conv(3, 32, 3, 1)"
layers[name] = eval(spec) # noqa: S307
return layersPatched code sample
import yaml
import ast
def parse_model(config_path: str):
"""
Load a YOLO model configuration and instantiate layers.
"""
with open(config_path, "r") as f:
cfg = yaml.safe_load(f)
# FIX: safely parse the layer specification without eval
layers = {}
for name, spec in cfg["model"]["layers"].items():
# spec is a literal tuple/list representation, e.g. "('Conv', 3, 32, 3, 1)"
parsed = ast.literal_eval(spec)
layer_type, *params = parsed
# Map layer type string to actual class (placeholder mapping)
layer_cls = {"Conv": Conv, "BatchNorm": BatchNorm}.get(layer_type)
if layer_cls is None:
raise ValueError(f"Unsupported layer type: {layer_type}")
layers[name] = layer_cls(*params)
return layersCite this entry
@misc{vaitp:cve2026118616,
title = {{Remote code execution via unsanitized string in Ultralytics parse_model function.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-118616},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-118616/}}
}
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 ::
