Skip to content
KerasGHSA-36fq-jgmw-4r9c

Keras is vulnerable to Deserialization of Untrusted Data

High7.3CVE-2025-9906 · Published Sep 19, 2025 · updated Sep 10, 2026

GitHub advisory

Affected versions

PackageAffectedFixed in
keras
PyPI
< 3.11.03.11.0
Details and references

### Arbitrary Code Execution in Keras Keras versions prior to 3.11.0 allow for arbitrary code execution when loading a crafted `.keras` model archive, even when `safe_mode=True`. The issue arises because the archive’s `config.json` is parsed before layer deserialization. This can invoke `keras.config.enable_unsafe_deserialization()`, effectively disabling safe mode from within the loading process itself. An attacker can place this call first in the archive and then include a `Lambda` layer whose function is deserialized from a pickle, leading to the execution of attacker-controlled Python code as soon as a victim loads the model file. Exploitation requires a user to open an untrusted model; no additional privileges are needed. The fix in version 3.11.0 enforces safe-mode semantics *before* reading any user-controlled configuration and prevents the toggling of unsafe deserialization via the config file. **Affected versions:** < 3.11.0 **Patched version:** 3.11.0 It is recommended to upgrade to version 3.11.0 or later and to avoid opening untrusted model files.

CVSS 3.1
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Severity from
GitHub (reviewed advisory)
Weakness
CWE-502
Also known as
CVE-2025-9906, PYSEC-2025-76

More Keras advisories

All Keras
DateAdvisory
Sep 192025The Keras `Model.load_model` method **silently** ignores `safe_mode=True` and allows arbitrary code execution when a `.h5`/`.hdf5` file is loaded.
CVE-2025-9905Highfixed in 3.11.3
Oct 172025Keras framework vulnerable to deserialization of untrusted data
CVE-2025-49655Critical9.8fixed in 3.11.3
Aug 122025Keras vulnerable to CVE-2025-1550 bypass via reuse of internal functionality
CVE-2025-8747High8.8fixed in 3.11.0
Oct 292025Keras is vulnerable to arbitrary local file loading and Server-Side Request Forgery
CVE-2025-12058Mediumfixed in 3.12.0
Dec 22025Keras Directory Traversal Vulnerability
CVE-2025-12060High9.8fixed in 3.12.0
Feb 18Keras has a Local File Disclosure via HDF5 External Storage During Keras Weight Loading
CVE-2026-1669High7.1fixed in 3.12.1, 3.13.2

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.