Vulnerability in Keras

CVE-2025-9905

The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. One can create a specially crafted .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special .h5 archive file that uses the Lambda layer feature of keras which allows arbitrary Python code in the form of pickled code. The vulnerability comes from the fact that the safe_mode=True option is not honored when reading .h5 archives. Note that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.

Published · last modified .

CVSS v3 metric

CVSS v3 base score 7.3 (High). Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H.

EPSS exploit prediction

EPSS: 0.002 (10.9th percentile), scored .

Very low probability of exploitation in the next 30 days; routine patching cadence is appropriate. 11th percentile — 10.9% of CVEs in the catalogue have a lower EPSS than this one. How to read EPSS.

EPSS trend (30 days)EPSS over the last 30 days for CVE-2025-9905: held from 0.002 to 0.002.

EPSS over last 30 days · oldest: 0.002 · newest: 0.002 · change: 0.000

Affected products

Weakness classification (CWE)

References

Frequently asked questions

What is CVE-2025-9905?
CVE-2025-9905 is a high-severity vulnerability in Keras, classified under Improper Control of Dynamically-Managed Code Resources. CVSS score: 7.3/10. Published 2025-09-19.
How severe is CVE-2025-9905?
High severity. CVSS v3 base score is 7.3 out of 10.