CVE-2025-9906

The Keras Model.load_modelmethod can be exploited to achieve arbitrary code execution, even with safe_mode=True.

One can create a specially crafted .kerasmodel 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 .kerasarchive) that will invoke keras.config.enable_unsafe_deserialization()to disable safe mode. Once safe mode is disable, one can use the Lambdalayer 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 Lambdawith arbitrary code needs to be second.
ProviderTypeBase ScoreAtk. VectorAtk. ComplexityPriv. RequiredVector
NISTNIST
UNKNOWN
---
GoogleCNA
---
---
Awaiting analysis
This vulnerability is currently awaiting analysis.
Base Score
CVSS 3.x
EPSS Score
Percentile: Unknown