Arbitrary Code execution in Keras Safe Mode
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Keras-team | Keras | unaffected |
|
No data.
| Vendor | Product | Versions |
|---|---|---|
| Keras | Keras | — |
| Source | ID | Title |
|---|---|---|
EUVD |
EUVD-2025-30281 | Keras is vulnerable to Deserialization of Untrusted Data |
Github GHSA |
GHSA-36fq-jgmw-4r9c | Keras is vulnerable to Deserialization of Untrusted Data |
No CVSS v3.0
No CVSS v2
This CVE is not in the KEV list.
Exploit prediction score: < 1% (0.203% probability within 30 days)
| Type | Values Removed | Values Added |
|---|---|---|
| CPEs | cpe:2.3:a:keras:keras:*:*:*:*:*:*:*:* | |
| Metrics |
cvssV3_1
|
cvssV3_1
|
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Keras
Keras keras |
|
| Vendors & Products |
Keras
Keras keras |
| Type | Values Removed | Values Added |
|---|---|---|
| References |
| |
| Metrics |
threat_severity
|
cvssV3_1
|
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
| Type | Values Removed | Values Added |
|---|---|---|
| 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. | |
| Title | Arbitrary Code execution in Keras Safe Mode | |
| Weaknesses | CWE-502 | |
| References |
| |
| Metrics |
cvssV4_0
|