# CVE-2026-0897: Denial of Service in Keras via Excessive Memory Allocation in HDF5 Metadata

> A remote attacker can cause a denial of service via memory exhaustion by providing a crafted Keras archive with an excessively large HDF5 dataset shape.

- **Severity:** High 7.1 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 15 Jan 2026
- **Updated:** 15 Jul 2026
- **Also known as:** AZL-74631, DEBIAN-CVE-2026-0897, GHSA-mgx6-5cf9-rr43, MINI-h5jp-w9f3-8f63, PYSEC-2026-73, UBUNTU-CVE-2026-0897

## What is CVE-2026-0897?

CVE-2026-0897 is a high-severity denial of service vulnerability in Google Keras, published on 15 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Allocation of Resources Without Limits or Throttling in the HDF5 weight loading component in Google Keras 3.0.0 through 3.13.0 on all platforms allows a remote attacker to cause a Denial of Service (DoS) through memory exhaustion and a crash of the Python interpreter via a crafted .keras archive containing a valid model.weights.h5 file whose dataset declares an extremely large shape.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling)

## Which versions are affected by CVE-2026-0897?

5 open source packages ship an affected version, including keras. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `keras` | PyPI | From 3.0.0 | 3.12.1 |
| `keras` | PyPI | From 3.0.0 | 3.12.1 |
| `keras` | PyPI | From 3.0.0 | 3.13.1 |
| `keras` | PyPI | From 3.13.0 | 3.13.2 |
| `keras` | PyPI | From 3.13.0 | 3.13.2 |

Products: Keras Keras.

## How do I fix CVE-2026-0897?

Upgrade keras to a fixed version for your release line: 3.12.1, 3.13.1 or 3.13.2.

## Is CVE-2026-0897 being exploited?

There is no known exploitation of CVE-2026-0897 in the wild and no public exploit code.

Public exploit code:

- Allocation of Resources Without Limits or Throttling in the HDF5 weight loading component in Google Keras 3.0.0 through 3.13.0 on all platforms allows a remote attacker to cause a Denial of Service (DoS) through memory exhaustion and a crash of the Python interpreter via a crafted .keras  (github_poc): https://github.com/HyperPS/CVE-2026-0897

## Other vulnerabilities in Google Keras

- [CVE-2024-3660](https://insights.sbomify.com/CVE-2024-3660/): Arbitrary code injection vulnerability in Keras framework < 2.13 (critical 9.8)
- [CVE-2026-12481](https://insights.sbomify.com/CVE-2026-12481/): Deserialization of Untrusted Data in keras-team/keras (high 8.8)
- [CVE-2026-1462](https://insights.sbomify.com/CVE-2026-1462/): Safe Mode Bypass in keras-team/keras (high 8.8)
- [CVE-2025-9906](https://insights.sbomify.com/CVE-2025-9906/): Arbitrary Code execution in Keras Safe Mode (high 8.6)
- [CVE-2025-8747](https://insights.sbomify.com/CVE-2025-8747/): Keras safe_mode bypass allows arbitrary code execution when loading a malicious model. (high 8.6)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-0897 and fix it if it is affected.

What it is: CVE-2026-0897 is a high-severity denial of service vulnerability in Google Keras, published on 15 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-0897 in the wild and no public exploit code.

Affected packages and fixed versions:
- keras (PyPI): affected from 3.0.0; fixed in 3.12.1
- keras (PyPI): affected from 3.0.0; fixed in 3.12.1
- keras (PyPI): affected from 3.0.0; fixed in 3.13.1
- keras (PyPI): affected from 3.13.0; fixed in 3.13.2
- keras (PyPI): affected from 3.13.0; fixed in 3.13.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-0897/ (Markdown: https://insights.sbomify.com/CVE-2026-0897/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-0897
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-0897
- OSV: https://osv.dev/vulnerability/CVE-2026-0897

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-0897/
Summaries are generated and may contain mistakes; the official description above is the record.
