GHSA-77wq-646f-jrm2: Duplicate Advisory The Keras `Model.load_model` Method **silently** Vulnerability

HIGH
CWE-913
Published
Advisory Summary

GHSA-77wq-646f-jrm2 is a HIGH the keras `model.load_model` method **silently** vulnerability (CWE-913: Improper Control of Dynamically-Managed Code Resources) affecting Duplicate Advisory libraries in the PyPI ecosystem. The issue involves the keras `model.load_model` method **silently** ignores `safe_mode=true` and allows arbitrary code execution when a `.h5`/`.hdf5` file is loaded.. Remediation is available by upgrading affected packages to version 3.11.3.

GHSA-77wq-646f-jrm2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-77wq-646f-jrm2
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-913: Improper Control of Dynamically-Managed Code Resources
Affected Product Duplicate Advisory
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-77wq-646f-jrm2

To remediate this vulnerability, upgrade all affected Duplicate Advisory dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

keras fixed: 3.11.3
pip install keras>=3.11.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show keras

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-77wq-646f-jrm2, inspect your installed packages using pip:

pip show keras

Analyze the terminal output to locate any version of Duplicate Advisory in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.11.3), your application is affected.

Note: The pip show keras command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-913: Improper Control of Dynamically-Managed Code Resources, where the product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements. In Duplicate Advisory, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-36rr-ww3j-vrjv. This link is maintained to preserve external references. ### Original 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.

GHSA-77wq-646f-jrm2 Affected Duplicate Advisory Versions

1 component(s)
Fixed Versions:
3.11.3
Product / Package Ecosystem Affected Versions Fixed Version
keras
PyPI
≥ 3.0.0
< 3.11.3
3.11.3

References

Frequently Asked Questions

What is GHSA-77wq-646f-jrm2?
GHSA-77wq-646f-jrm2 is a security vulnerability in Duplicate Advisory involving The Keras `Model.load_model` method **silently** ignores `safe_mode=True` and allows arbitrary code execution when a `.h5`/`.hdf5` file is loaded. under CWE-913: Improper Control of Dynamically-Managed Code Resources.
Which Duplicate Advisory versions are affected?
Affected versions include releases prior to 3.11.3 across affected packages: keras.
What version fixes GHSA-77wq-646f-jrm2?
Upgrading to 3.11.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is keras affected?
Yes, keras is affected in releases prior to 3.11.3. Upgrade your dependency to 3.11.3 or later.
What CWE is associated with GHSA-77wq-646f-jrm2?
GHSA-77wq-646f-jrm2 is classified under CWE-913: Improper Control of Dynamically-Managed Code Resources (The product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements.).
How can I check PyPI dependencies for GHSA-77wq-646f-jrm2?
Run the dependency tree command: 'pip show keras'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-77wq-646f-jrm2",
  "modified" : "2025-09-19T17:34:15Z",
  "published" : "2025-09-19T09:31:14Z",
  "withdrawn" : "2025-09-19T17:34:15Z",
  "aliases" : [ ],
  "summary" : "Duplicate Advisory: The Keras `Model.load_model` method **silently** ignores `safe_mode=True` and allows arbitrary code execution when a `.h5`/`.hdf5` file is loaded.",
  "details" : "### Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-36rr-ww3j-vrjv. This link is maintained to preserve external references.\n\n### Original Description\nThe Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True.\n\nOne can create a specially crafted .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed.\n\nThis 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.\n\nNote that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "keras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.11.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-9905"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/pull/21602"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/keras-team/keras"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-913" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-19T17:34:15Z",
    "nvd_published_at" : "2025-09-19T09:15:36Z"
  }
}