Skip to content

CVE-2025-9906 Arbitrary Code execution in Keras Safe Mode

HighCVSS 8.6 EPSS 0.20%
Published
Updated
Exploit status
No public exploit known

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.

Affected products

ProductAffected versionsFixed in
pypi keras(PyPI) < 3.11.0 3.11.0
pypi keras(PyPI) = 0.2.0 No fix listed
pypi keras(PyPI) = 0.3.0 No fix listed
pypi keras(PyPI) = 0.3.1 No fix listed
pypi keras(PyPI) = 0.3.2 No fix listed
pypi keras(PyPI) = 0.3.3 No fix listed
pypi keras(PyPI) = 1.0.0 No fix listed
pypi keras(PyPI) = 1.0.1 No fix listed
pypi keras(PyPI) = 1.0.2 No fix listed
pypi keras(PyPI) = 1.0.3 No fix listed
pypi keras(PyPI) = 1.0.4 No fix listed
pypi keras(PyPI) = 1.0.5 No fix listed
pypi keras(PyPI) = 1.0.6 No fix listed
pypi keras(PyPI) = 1.0.7 No fix listed
pypi keras(PyPI) = 1.0.8 No fix listed
pypi keras(PyPI) = 1.1.0 No fix listed
pypi keras(PyPI) = 1.1.1 No fix listed
pypi keras(PyPI) = 1.1.2 No fix listed
pypi keras(PyPI) = 1.2.0 No fix listed
pypi keras(PyPI) = 1.2.1 No fix listed
pypi keras(PyPI) = 1.2.2 No fix listed
pypi keras(PyPI) = 2.0.0 No fix listed
pypi keras(PyPI) = 2.0.1 No fix listed
pypi keras(PyPI) = 2.0.2 No fix listed
pypi keras(PyPI) = 2.0.3 No fix listed
Show 91 more
ProductAffected versionsFixed in
pypi keras(PyPI) = 2.0.4 No fix listed
pypi keras(PyPI) = 2.0.5 No fix listed
pypi keras(PyPI) = 2.0.6 No fix listed
pypi keras(PyPI) = 2.0.7 No fix listed
pypi keras(PyPI) = 2.0.8 No fix listed
pypi keras(PyPI) = 2.0.9 No fix listed
pypi keras(PyPI) = 2.1.0 No fix listed
pypi keras(PyPI) = 2.1.1 No fix listed
pypi keras(PyPI) = 2.1.2 No fix listed
pypi keras(PyPI) = 2.1.3 No fix listed
pypi keras(PyPI) = 2.1.4 No fix listed
pypi keras(PyPI) = 2.1.5 No fix listed
pypi keras(PyPI) = 2.1.6 No fix listed
pypi keras(PyPI) = 2.10.0 No fix listed
pypi keras(PyPI) = 2.10.0rc0 No fix listed
pypi keras(PyPI) = 2.10.0rc1 No fix listed
pypi keras(PyPI) = 2.11.0 No fix listed
pypi keras(PyPI) = 2.11.0rc0 No fix listed
pypi keras(PyPI) = 2.11.0rc1 No fix listed
pypi keras(PyPI) = 2.11.0rc2 No fix listed
pypi keras(PyPI) = 2.11.0rc3 No fix listed
pypi keras(PyPI) = 2.12.0 No fix listed
pypi keras(PyPI) = 2.12.0rc0 No fix listed
pypi keras(PyPI) = 2.12.0rc1 No fix listed
pypi keras(PyPI) = 2.13.1 No fix listed
pypi keras(PyPI) = 2.13.1rc0 No fix listed
pypi keras(PyPI) = 2.13.1rc1 No fix listed
pypi keras(PyPI) = 2.14.0 No fix listed
pypi keras(PyPI) = 2.14.0rc0 No fix listed
pypi keras(PyPI) = 2.15.0 No fix listed
pypi keras(PyPI) = 2.15.0rc0 No fix listed
pypi keras(PyPI) = 2.15.0rc1 No fix listed
pypi keras(PyPI) = 2.2.0 No fix listed
pypi keras(PyPI) = 2.2.1 No fix listed
pypi keras(PyPI) = 2.2.2 No fix listed
pypi keras(PyPI) = 2.2.3 No fix listed
pypi keras(PyPI) = 2.2.4 No fix listed
pypi keras(PyPI) = 2.2.5 No fix listed
pypi keras(PyPI) = 2.3.0 No fix listed
pypi keras(PyPI) = 2.3.1 No fix listed
pypi keras(PyPI) = 2.4.0 No fix listed
pypi keras(PyPI) = 2.4.1 No fix listed
pypi keras(PyPI) = 2.4.2 No fix listed
pypi keras(PyPI) = 2.4.3 No fix listed
pypi keras(PyPI) = 2.5.0rc0 No fix listed
pypi keras(PyPI) = 2.6.0 No fix listed
pypi keras(PyPI) = 2.6.0rc0 No fix listed
pypi keras(PyPI) = 2.6.0rc1 No fix listed
pypi keras(PyPI) = 2.6.0rc2 No fix listed
pypi keras(PyPI) = 2.6.0rc3 No fix listed
pypi keras(PyPI) = 2.7.0 No fix listed
pypi keras(PyPI) = 2.7.0rc0 No fix listed
pypi keras(PyPI) = 2.7.0rc2 No fix listed
pypi keras(PyPI) = 2.8.0 No fix listed
pypi keras(PyPI) = 2.8.0rc0 No fix listed
pypi keras(PyPI) = 2.8.0rc1 No fix listed
pypi keras(PyPI) = 2.9.0 No fix listed
pypi keras(PyPI) = 2.9.0rc0 No fix listed
pypi keras(PyPI) = 2.9.0rc1 No fix listed
pypi keras(PyPI) = 2.9.0rc2 No fix listed
pypi keras(PyPI) = 3.0.0 No fix listed
pypi keras(PyPI) = 3.0.1 No fix listed
pypi keras(PyPI) = 3.0.2 No fix listed
pypi keras(PyPI) = 3.0.3 No fix listed
pypi keras(PyPI) = 3.0.4 No fix listed
pypi keras(PyPI) = 3.0.5 No fix listed
pypi keras(PyPI) = 3.1.0 No fix listed
pypi keras(PyPI) = 3.1.1 No fix listed
pypi keras(PyPI) = 3.10.0 No fix listed
pypi keras(PyPI) = 3.2.0 No fix listed
pypi keras(PyPI) = 3.2.1 No fix listed
pypi keras(PyPI) = 3.3.0 No fix listed
pypi keras(PyPI) = 3.3.1 No fix listed
pypi keras(PyPI) = 3.3.2 No fix listed
pypi keras(PyPI) = 3.3.3 No fix listed
pypi keras(PyPI) = 3.4.0 No fix listed
pypi keras(PyPI) = 3.4.1 No fix listed
pypi keras(PyPI) = 3.5.0 No fix listed
pypi keras(PyPI) = 3.6.0 No fix listed
pypi keras(PyPI) = 3.7.0 No fix listed
pypi keras(PyPI) = 3.8.0 No fix listed
pypi keras(PyPI) = 3.9.0 No fix listed
pypi keras(PyPI) = 3.9.1 No fix listed
pypi keras(PyPI) = 3.9.2 No fix listed
pypi keras(PyPI) All versions No fix listed
azure linux keras(Azure Linux:3.0) < 3.3.3-4 3.3.3-4
debian/keras(Debian:11) All versions No fix listed
debian/keras(Debian:11) = 2.3.1+dfsg-3 No fix listed
debian/keras(Debian:11) = 2.3.1+dfsg2-1 No fix listed
keras-team Keras >= 3.0.0, < 3.11.0 3.11.0
Keras >= 3.0.0, < 3.11.0 3.11.0

References