CVE-2026-100840
Remote code execution via arbitrary _target_ import and $‑eval in MONAI bundles.
- CVSS 8.5
- CWE-95
- Input Validation and Sanitization
- Remote
MONAI through 1.6.0 contains a remote code execution vulnerability in the bundle configuration engine that resolves _target_ values to arbitrary importable callables without an allow list and passes $ expressions to Python eval(). Attackers can publish a malicious bundle with crafted configuration containing arbitrary code that executes when a victim loads the bundle using monai.bundle.load() or monai.bundle.run().
- CWE
- CWE-95
- CVSS base score
- 8.5
- Published
- 2026-09-27
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- MONAI
- Fixed by upgrading
- Yes
Solution
Upgrade MONAI to version 1.6.1 or newer, which patches the remote‑code‑execution flaw in the bundle configuration engine.
Vulnerable code sample
import yaml
from monai.bundle import BundleConfig
def load_bundle(cfg_path: str):
# VULNERABLE: eval on untrusted $ expression
with open(cfg_path, 'r') as f:
raw_cfg = yaml.safe_load(f)
# Resolve _target_ entries; original code uses eval on $ expressions
def resolve(entry):
if isinstance(entry, dict):
if "_target_" in entry and isinstance(entry["_target_"], str):
# $ expression allowed to embed arbitrary Python code
entry["_target_"] = eval(entry["_target_"])
for k, v in entry.items():
entry[k] = resolve(v)
elif isinstance(entry, list):
entry = [resolve(i) for i in entry]
return entry
cfg = resolve(raw_cfg)
bundle = BundleConfig(cfg)
return bundlePatched code sample
import yaml
import ast
from monai.bundle import BundleConfig
def load_bundle(cfg_path: str):
# FIX: safe parsing of $ expression using ast.literal_eval
with open(cfg_path, 'r') as f:
raw_cfg = yaml.safe_load(f)
allowed_targets = {"monai.networks.nets.UNet": "monai.networks.nets.UNet"}
def resolve(entry):
if isinstance(entry, dict):
if "_target_" in entry and isinstance(entry["_target_"], str):
# Only allow known safe targets, no eval
target = entry["_target_"]
if target in allowed_targets:
entry["_target_"] = allowed_targets[target]
else:
raise ValueError(f"Disallowed target: {target}")
for k, v in entry.items():
entry[k] = resolve(v)
elif isinstance(entry, list):
entry = [resolve(i) for i in entry]
return entry
cfg = resolve(raw_cfg)
bundle = BundleConfig(cfg)
return bundleCite this entry
@misc{vaitp:cve2026100840,
title = {{Remote code execution via arbitrary _target_ import and $‑eval in MONAI bundles.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-100840},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-100840/}}
}
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 ::
