CVE-2025-9905
CVE-2025-9905 · Arbitary Code execution in Keras load_model()
This page contains facts from public vulnerability sources. Check the original advisory before updating.
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 .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special .h5 archive file that uses the Lambda layer feature of keras which allows arbitrary Python code in the form of pickled code. The vulnerability comes from the fact that the safe_mode=True option is not honored when reading .h5 archives. Note that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.
CVSS 7.3 · High · EPSS 0.2% · Fix available
- Published
- Updated
Affected products and versions
keras
- Versions
- ≥ 3.0.0, ≤ 3.11.2: Affected (semver)
No fix published
keras Debian:11
- Versions
- 2.3.1+dfsg-3
- 2.3.1+dfsg2-1
- Affected ranges
- ECOSYSTEM: (−∞, +∞)
No fix published
keras PyPI
- Versions
- 3.0.0
- 3.0.1
- 3.0.2
- 3.0.3
- 3.0.4
- 3.0.5
- 3.1.0
- 3.1.1
- 3.10.0
- 3.11.0
- 3.11.1
- 3.11.2
- 3.2.0
- 3.2.1
- 3.3.0
- 3.3.1
- 3.3.2
- 3.3.3
- 3.4.0
- 3.4.1
- 3.5.0
- 3.6.0
- 3.7.0
- 3.8.0
- 3.9.0
- 3.9.1
- 3.9.2
- Affected ranges
- ECOSYSTEM: ≥ 3.0.0, < 3.11.3
Update to 3.11.3
keras Ubuntu:18.04:LTS
- Versions
- 1.0.7-2
- 2.1.1-1
- Affected ranges
- ECOSYSTEM: (−∞, +∞)
No fix published
keras Ubuntu:20.04:LTS
- Versions
- 2.2.4-1
- Affected ranges
- ECOSYSTEM: (−∞, +∞)
No fix published