CVE-2025-9906
published high CVSS 4.0 · 8.6Arbitrary Code execution in Keras Safe Mode
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Keras-team | — | Keras3.0.0 to < 3.11.0 · Other versions: unaffected | Affected | Not stated |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 4.0
- Base score
- 8.6 / 10
- Severity
- high
- Provider
- Google · cna
- Vector string
- CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/AU:Y/R:A
- Scenarios
- en: GENERAL
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Keras-team | Keras | 3.0.0 to < 3.11.0 (affected · semver)Default: unaffected | Google · cna |
Weaknesses
1- CWE-502 CWE-502 Deserialization of Untrusted Data
References
1Provider assertions
2Google · cna
Arbitrary Code execution in Keras Safe Mode
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- ea66e2fa2e6b7fbb25dc73748b4c4e9b8d81b96b1f3499b2e008f4fe3171d76b
- Ingested
- 23 Sep 2026, 08:59:43 UTC
- Source record
- Official CVE record