Severity:

HIGH RISK

(7.5)

Improper Resource Access Control in Keras Model Loading

CVE-2026-1669

Modified

Vulnerability type

Category:

Improper Resource Access Control

CWE:

CWE-73, CWE-200

Impact:

Arbitrary File Read / Sensitive Information Disclosure

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The Keras model loading mechanism for HDF5-backed .keras files can be abused to read arbitrary local files when external dataset references are resolved without proper restriction.

An attacker who supplies a crafted model file can cause the Keras process to disclose sensitive information from the filesystem on which the model is loaded.

Affected context

This vulnerability affects environments where:

  • Keras versions 3.0.0 through 3.13.1 are used to load .keras model files that rely on HDF5 integration
  • Models may originate from untrusted or semi-trusted sources (e.g., user uploads, shared artifacts, external repositories)
  • The loading process runs on systems that store sensitive data (e.g., configuration files, credentials, proprietary datasets)

The issue manifests when HDF5 external dataset references embedded in a model file are allowed to resolve to arbitrary file paths on the local filesystem.

Exploit preconditions

  • Attack surface: Keras model loading APIs that accept .keras files using HDF5 under the hood.
  • Required access: Ability to supply or influence the model file that a target application loads (e.g., upload, file drop, repository contribution).
  • Trigger point: Invocation of load_model or equivalent loading routine that processes HDF5 external dataset references.
  • Why exploitation is possible: The loader implicitly trusts and resolves HDF5 external dataset references without enforcing strict path whitelists, sandboxing, or origin checks, allowing crafted references to point to arbitrary local files.

Why this happens

The root cause is insufficient access control over filesystem resources referenced from within serialized model artifacts.

HDF5 supports external dataset references that can map dataset contents to paths on the underlying filesystem.

When Keras model loading resolves these references, it does so in a way that does not adequately restrict which paths may be accessed or how those paths relate to the intended model data directory.

This aligns with CWE-73: External Control of File Name or Path, where external input fully determines file paths used by the application, and with CWE-200: Exposure of Sensitive Information, as the resolved file contents may include confidential data.

Potential impact

  • Reading of application configuration files that may contain API keys, database credentials, or tokens
  • Disclosure of sensitive user data stored on the same system (e.g., datasets, logs, exports)
  • Exposure of internal system information, such as environment variables, host configuration, or internal network details
  • Facilitation of further compromise by leaking secrets that can be reused in other services or environments

General mitigation guidance

Mitigation focuses on treating model files as untrusted input and constraining filesystem access during model loading:

  • Restrict model loading to trusted, verified sources and avoid loading arbitrary user-supplied .keras files in privileged environments.
  • Apply path normalization and whitelisting when resolving any external file references, limiting access to a specific, controlled directory tree.
  • Run model loading in a sandboxed or containerized environment with minimal filesystem visibility and least-privilege permissions.
  • Separate sensitive configuration and secrets from the filesystem context used by model loading processes to reduce the value of any exposed files.
  • Incorporate defense-in-depth controls, such as mandatory access control (e.g., SELinux/AppArmor) or filesystem namespaces, to limit what model loading can access even if path handling is imperfect.

How teams detect issues like this

Detection typically involves both code-focused and operational controls:

  • Static analysis & code review:
  • Flag usages where model loading APIs consume files from user-controllable locations without validation.
  • Look for logic that permits arbitrary HDF5 or .keras files to be processed in services exposed to untrusted clients.
  • Identify absence of path validation or confinement when external references in serialized artifacts are resolved.
  • Runtime monitoring & logging:
  • Log file access patterns during model loading and alert on attempts to read files outside expected model directories.
  • Use host-based intrusion detection to watch for unexpected reads of sensitive paths by model-serving processes.
  • Policy enforcement:
  • Enforce internal policies that model-serving components must operate with restricted filesystem permissions and vetted artifact sources.
  • Integrate automated checks in CI/CD to prevent deployment of services that load models directly from untrusted input.

Sources

SourceLink
github.comgithub.com/google/security-research/security/advisories
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-1669
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2439205
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-1669.json

Frequently asked

questions

Yes, if an application exposes an interface that accepts model files or otherwise allows an attacker to influence which .keras file is loaded. In such setups, a crafted model can be supplied remotely and trigger arbitrary file reads on the server.

The attacker needs the ability to provide or control the .keras model file that Keras will load, such as via file upload endpoints, shared storage, artifact repositories, or compromised build pipelines. Direct shell access is not required.

The safest approach is to assume model files are untrusted and restrict their power:

  • Only load models from trusted, validated sources.
  • Constrain file resolution to a controlled directory or virtual filesystem.
  • Run the loading process with minimal privileges and limited filesystem visibility.

Future designs should:

  • Treat complex binary artifacts (models, archives, project files) as untrusted inputs with clear trust boundaries.
  • Avoid allowing external input to directly influence filesystem paths without strict validation and confinement.
  • Incorporate security reviews around integration points with formats like HDF5 that support external references.
  • Use sandboxing and least privilege by default for components that parse or load externally supplied artifacts.
Find out what's already
exploitable in your codebase.