# CVE-2026-12570: Keras model loading denial of service via HDF5 shape bombs

Source: https://junglewise.ai/threats/cve-2026-12570-keras-model-loading-denial-of-service-via-hdf5-shape-bombs  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-10. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-12570 · Severity: medium · CVSS 5.5 · Published 2026-08-10

Keras is a popular machine learning library used to build and load trained neural network models. A vulnerability in versions before 3.15.0 allows an attacker to craft a malicious model file that causes the application to consume unbounded memory and crash when loaded, disrupting any ML pipeline that processes untrusted models from public repositories or model registries.

Technologies: [keras (PyPI)](https://junglewise.ai/threats/technologies/keras). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-12570 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-12570 being exploited in the wild.

**How severe is CVE-2026-12570?** Medium severity, with a CVSS score of 5.5, published 10 August 2026.

**Which products and versions are affected?** keras (PyPI) < 3.15.0, ECOSYSTEM:introduced=0,fixed=3.15.0.

**Is there a fix for CVE-2026-12570?** Yes. keras (PyPI): upgrade to 3.15.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-12570 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-12570?** Check whether you run keras (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- keras (PyPI): upgrade to 3.15.0 or later

  ```sh
  pip install "keras>=3.15.0"
  ```


## Technical details

The vulnerability exists in Keras's HDF5 dataset loading code (keras/src/saving/saving_lib.py, H5IOStore.__getitem__ method) which does not validate the declared shape or size of datasets before materialization. An attacker can craft a specially-designed HDF5 file with chunked, compressed, or fill-value-only datasets that declare an enormous shape (e.g., petabytes) while storing only kilobytes on disk. When load_model() or load_weights() is called on such a file, the code attempts to allocate memory equal to the declared shape, causing an out-of-memory condition and process termination (exit code 137). The attack requires user interaction to load the model but no privileges; the attack vector is local/network-supplied malicious model files from untrusted sources. The patch (released in v3.15.0) adds validation to reject datasets where the declared in-memory size exceeds a 4 GiB floor and vastly exceeds the actual on-disk storage size.

## Affected products

- Keras Team Keras < 3.15.0

## Identifiers

- CVE-2026-12570
- GHSA-74m6-m3xx-3vmj
- PYSEC-2026-3856

## Timeline

- 2026-08-10: disclosed: Vulnerability published to GitHub Advisory Database and NVD
- 2026-06-23: patched: Fix released in Keras v3.15.0 (commit 4933ea4); patch merged June 1, 2026
- 2026-09-01: advisory: GitHub Security Advisory reviewed and updated

## References

- [https://github.com/keras-team/keras/commit/4933ea4a5b3fcc24ceacdc276f5bb5dfbd06756c](https://github.com/keras-team/keras/commit/4933ea4a5b3fcc24ceacdc276f5bb5dfbd06756c)
- [https://huntr.com/bounties/a064f475-780a-409a-82f7-678512f27ad8](https://huntr.com/bounties/a064f475-780a-409a-82f7-678512f27ad8)
- [https://github.com/keras-team/keras/pull/22975](https://github.com/keras-team/keras/pull/22975)
- [https://github.com/keras-team/keras/releases/tag/v3.15.0](https://github.com/keras-team/keras/releases/tag/v3.15.0)

## Related threats

- [Keras HDF5 arbitrary file disclosure via ExternalLinks](https://junglewise.ai/threats/cve-2026-9335-keras-hdf5-arbitrary-file-disclosure-via-externallinks)
- [Keras unsafe deserialization in TorchModuleWrapper](https://junglewise.ai/threats/cve-2026-12484-keras-unsafe-deserialization-in-torchmodulewrapper)
- [Keras path traversal via symlink in filter_safe_tarinfos](https://junglewise.ai/threats/cve-2026-12482-keras-path-traversal-via-symlink-in-filter-safe-tarinfos)
- [Keras Team Keras arbitrary code execution in Lambda layer](https://junglewise.ai/threats/cve-2026-12481-keras-team-keras-arbitrary-code-execution-in-lambda-layer)
- [Keras arbitrary HDF5 file read in model loading](https://junglewise.ai/threats/cve-2026-12480-keras-arbitrary-hdf5-file-read-in-model-loading)
