CVE-2026-9335

Improper Handling of HDF5 ExternalLinks in keras-team/keras

Published Aug 2, 2026 CVSS 3.0 · 6.5 Medium EPSS < 1% KEV · Not listed
Description
A vulnerability in keras-team/keras versions <= 3.14.0 allows arbitrary local HDF5 file content disclosure due to improper handling of HDF5 ExternalLinks. The `KerasFileEditor` and `keras.saving.load_weights` functions bypass the `safe_get_h5_group` and `safe_get_h5_dataset` helpers, which are designed to reject ExternalLinks and SoftLinks. This results in automatic dereferencing of links to external HDF5 files, enabling attackers to disclose sensitive data from the victim's local filesystem. Specifically, `KerasFileEditor` extracts attributes and datasets from linked files into its internal structures, while `keras.saving.load_weights` loads weights from linked files into the user's model. This issue can be exploited by providing a malicious `.h5`, `.weights.h5`, or `.keras` file containing ExternalLinks.

Analysis

AI-generated

Technical impact

The vulnerability resides in Keras team releases through version 3.14.0, where the KerasFileEditor and keras.saving.load_weights functions bypass safety checks that are meant to reject HDF5 ExternalLinks and SoftLinks. This improper handling leads to automatic dereferencing of links to external HDF5 files, which means that a maliciously crafted .h5, .weights.h5, or .keras file can expose any local files that the process can read. The primary impact is disclosure of sensitive data from the victim's local filesystem rather than remote code execution or denial of service.

Affected Systems

Keras versions 3.14.0 and earlier, across any operating system that employs the KerasFileEditor or load_weights routines to load user‑supplied HDF5 model or weight files.

Risk and Exploitability

The CVSS score of 6.5 indicates a moderate severity vulnerability. The EPSS score is listed as less than 1%, suggesting an extremely low likelihood of exploitation in the wild. It is not presently catalogued in the CISA KEV. Attackers would need the ability to supply a malicious HDF5 file to the Keras application, either via a file upload or by directing the program to load a specific file path. Once present, the vulnerability allows local disclosure of any files that the executing user has access to, but does not provide a remote code execution path.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Keras to version 3.15 or newer to eliminate the vulnerable code paths.
  • Modify any custom loading logic to use the safe_get_h5_group and safe_get_h5_dataset helpers or otherwise reject HDF5 ExternalLinks before extraction.
  • Implement strict validation of any HDF5 files received from external sources, ensuring they contain no ExternalLinks and are accessed only with the minimal file system permissions required for the Keras process.

Generated by OpenCVE AI on August 3, 2026 at 09:29 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-m8wh-29wm-52mv Keras: HDF5 links can disclose local file contents
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Keras-team
Keras-team keras
Vendors & Products Keras-team
Keras-team keras
Type Values Removed Values Added
Description A vulnerability in keras-team/keras versions <= 3.14.0 allows arbitrary local HDF5 file content disclosure due to improper handling of HDF5 ExternalLinks. The `KerasFileEditor` and `keras.saving.load_weights` functions bypass the `safe_get_h5_group` and `safe_get_h5_dataset` helpers, which are designed to reject ExternalLinks and SoftLinks. This results in automatic dereferencing of links to external HDF5 files, enabling attackers to disclose sensitive data from the victim's local filesystem. Specifically, `KerasFileEditor` extracts attributes and datasets from linked files into its internal structures, while `keras.saving.load_weights` loads weights from linked files into the user's model. This issue can be exploited by providing a malicious `.h5`, `.weights.h5`, or `.keras` file containing ExternalLinks.
Title Improper Handling of HDF5 ExternalLinks in keras-team/keras
Weaknesses CWE-22
References
Metrics cvssV3_0

{'score': 6.5, 'vector': 'CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N'}

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Sources

Status
PUBLISHED
Assigner
@huntr_ai
Published
Updated
Aug 3, 2026, 4:48 PM
Reserved
May 22, 2026, 11:38 PM
Status
Awaiting Analysis
Published
Aug 2, 2026, 5:16 AM
Modified
Oct 23, 2026, 10:10 PM