Keras model loading is vulnerable to denial of service through HDF5 shape bombs
The H5IOStore.__getitem__ method in Keras does not validate dataset shape or size when loading .keras files, allowing unbounded memory allocation. A crafted model file can cause an out-of-memory condition and terminate the process.
keras-team/keras
Originally disclosed on huntr
A vulnerability in keras-team/keras versions < 3.15.0 allows for a denial of service (DoS) attack when loading malicious .keras model files via the keras.models.load_model() function. The H5IOStore.getitem method in keras/src/saving/saving_lib.py does not validate the shape or size of datasets, leading to unbounded memory allocation. A specially crafted .keras file can exploit this flaw to trigger an out-of-memory (OOM) condition, causing the process to be terminated (exit code 137). This issue bypasses the fix for CVE-2026-0897, which only addressed a similar vulnerability in KerasFileEditor. The attack vector includes poisoned models from public repositories or malicious model registries, posing a risk to machine learning pipelines that process untrusted models.
From the GitHub Advisory Database (GHSA-74m6-m3xx-3vmj, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the loader reads dataset dimensions from the file and allocates memory for them without checking that the size is reasonable or matches the actual data.
Impact
A malicious .keras file can trigger an out-of-memory condition that terminates the process, affecting pipelines that load untrusted models.
What the attacker needed
Ability to supply a .keras file; victim loads it with load_model()
The fix
The issue was fixed in version 3.15.0 by validating dataset shape and size before allocation.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you load a machine-learning model file, the software reads stored data arrays. Here it trusts the size written in the file without checking it, so a malicious file can ask for a huge amount of memory. The computer runs out of memory and the program crashes.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.