CVE-2025-9905
BaseFortify
Publication date: 2025-09-19
Last updated on: 2025-09-23
Assigner: Google Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| keras | keras | From 3.0.0 (inc) to 3.11.3 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-913 | The product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability involves the Keras Model.load_model method, which can be exploited to execute arbitrary code. An attacker can create a specially crafted .h5 or .hdf5 model archive that, when loaded using Model.load_model, triggers execution of malicious code. This happens because the Lambda layer feature in Keras allows embedding arbitrary Python code via pickling, and the safe_mode=True option intended to prevent this is not enforced when reading .h5 archives. The .h5/.hdf5 format is a legacy format supported for backward compatibility.
How can this vulnerability impact me? :
If exploited, this vulnerability can lead to arbitrary code execution on the system loading the malicious .h5 model file. This means an attacker could run any code they choose with the privileges of the user running the Keras load_model method, potentially leading to system compromise, data theft, or other malicious activities.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, avoid loading .h5/.hdf5 Keras model files from untrusted or unauthenticated sources, as the safe_mode=True option is not effective. Consider migrating to newer model formats supported by Keras 3 that do not use the vulnerable .h5/.hdf5 legacy format. Additionally, restrict permissions and access to systems that load such models to minimize risk.