Skip to main content
CVE-2025-9905VulnerabilityPublished Updated

CVE-2025-9905: Keras · Improper Control of Dynamically-Managed Code Resources

Affects KerasSource CVE Database V5

0

Not known to be exploited · CVSS 7.3 High.

Data as of 26 Oct 2026, 06:26 UTC

CVSS 4.0 base score
7.3High
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.2% chance of exploitation in 30 days – higher than 12% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 19 Sep 2025

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2026-10-26.

What to do

Affected software

ProductAffectedFixed in
Keras-team KerasAffected
  • =3.0.0
Fixed in–

AI-suggested

1. Avoid loading .h5 or .hdf5 model files from untrusted or unknown sources, especially those containing Lambda layers. 2. Migrate to newer Keras model formats (e.g., SavedModel format) that do not rely on pickled code and are not affected by this vulnerability. 3. Implement strict validation and sandboxing of model files before loading them in production environments. 4. Restrict user permissions and isolate environments where models are loaded to limit potential damage from exploitation. 5. Monitor for suspicious activity related to model loading and execution, including unexpected process spawning or network connections. 6. Stay updated with Keras-team advisories and apply patches or updates addressing this vulnerability once released. 7. Educate developers and data scientists on the risks of deserializing untrusted model files and enforce secure ML development practices. 8. Consider disabling or restricting the use of Lambda layers in models unless absolutely necessary and verified safe.

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 .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.

References

Community reviews

Loading reviews…