High severity · published Sep 19, 2025
CVE-2025-9906
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True
7.3
CVSS
0.2%
EPSS
No
On KEV
Description
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 .keras model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special config.json (a file within the .keras archive) that will invoke keras.config.enable_unsafe_deserialization() to disable safe mode. Once safe mode is disable, one can use the Lambda layer feature of keras, which allows arbitrary Python code in the form of pickled code. Both can appear in the same archive. Simply the keras.config.enable_unsafe_deserialization() needs to appear first in the archive and the Lambda with arbitrary code needs to be second.
CVSS vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Attack vector
Local
Complexity
Low
Privileges
Low
User interaction
Required
Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)0.2% · higher than 10% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
KE
Keras · Keras
3.0.0 before 3.11.0 · source: NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2025-9906
CVE.org
https://www.cve.org/CVERecord?id=CVE-2025-9906
Issue Tracking
https://github.com/keras-team/keras/pull/21429
More from Keras
9.8
CVE-2026-12481
Deserialization of Untrusted Data in keras-team/keras
9.8
CVE-2025-49655
Deserialization of untrusted data can occur in versions of the Keras framework running versions 3.11.0 up to but not including 3.11.3, enabling a maliciously uploaded Keras file…
9.8
CVE-2025-1550
The Keras Model.load_model function permits arbitrary code execution, even with safe_mode=True, through a manually constructed, malicious .keras archive
9.8
CVE-2024-3660
A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary code with the same permissions as the application using a…
8.9
CVE-2025-12060
Keras keras.utils.get_file Utility Path Traversal Vulnerability
