# CVE-2026-9335: Improper Handling of HDF5 ExternalLinks in keras-team/keras

> Attackers can disclose sensitive local files by crafting malicious HDF5 models with external links, bypassing security checks in Keras.

- **Severity:** Medium 6.5 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A: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:** 2 Aug 2026
- **Updated:** 3 Aug 2026
- **Also known as:** DEBIAN-CVE-2026-9335, GHSA-m8wh-29wm-52mv, MINI-6f84-p3g2-r5w2, PYSEC-2026-3633, UBUNTU-CVE-2026-9335

## What is CVE-2026-9335?

CVE-2026-9335 is a medium-severity path traversal vulnerability in keras-team/keras, published on 2 Aug 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

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.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

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

5 open source packages ship an affected version, including keras.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `keras` | PyPI | All versions | 3.12.3, 3.15.0 |
| `keras` | PyPI | All versions | 3.12.3 |
| `keras` | PyPI | All versions | 3.12.3 |
| `keras` | PyPI | From 3.13.0 | 3.15.0 |
| `keras` | PyPI | From 3.13.0 | 3.15.0 |

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

Upgrade keras to a fixed version for your release line: 3.12.3 or 3.15.0.

## Is CVE-2026-9335 being exploited?

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

Public exploit code:

- CVE-2026-9335: KerasFileEditor and load_weights follow h5py ExternalLinks, disclosing arbitrary local HDF5 file contents in keras ≤ 3.14.0. Advisory + verified PoCs. (github_poc): https://github.com/paparojonathan/CVE-2026-9335-keras-hdf5-externallink

## Fix prompt for AI coding agents

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

What it is: CVE-2026-9335 is a medium-severity path traversal vulnerability in keras-team/keras, published on 2 Aug 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-9335 in the wild and no public exploit code.

Affected packages and fixed versions:
- keras (PyPI): affected all versions; fixed in 3.12.3, 3.15.0
- keras (PyPI): affected all versions; fixed in 3.12.3
- keras (PyPI): affected all versions; fixed in 3.12.3
- keras (PyPI): affected from 3.13.0; fixed in 3.15.0
- keras (PyPI): affected from 3.13.0; fixed in 3.15.0

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-9335/ (Markdown: https://insights.sbomify.com/CVE-2026-9335/index.md)
```

## Sources

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

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