{"id":"CVE-2025-9905","published":"2025-09-19T08:16:44Z","modified":"2026-02-26T17:48:23Z","title":"Arbitary Code execution in Keras load_model()","vendor":"Keras-team","product":"Keras","tier":"tail","description":{"text":"The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True.\n\nOne can create a specially crafted .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed.\n\nThis is achieved by crafting a special .h5 archive file that uses the Lambda layer feature of keras which allows arbitrary Python code in the form of pickled code. The vulnerability comes from the fact that the safe_mode=True option is not honored when reading .h5 archives.\n\nNote that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.3,"severity":"HIGH","version":"4.0","vector":"CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00221,"percentile":0.12968,"provenance":"source"},"cwes":[{"id":"CWE-913","name":"Improper Control of Dynamically-Managed Code Resources"}],"references":[{"url":"https://github.com/keras-team/keras/pull/21602","tags":["patch"]},{"url":"https://github.com/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv","tags":[]}],"priority":{"score":7.7,"factors":[{"name":"EPSS percentile","points":2.59},{"name":"CVSS severity","points":5.11}]},"vendorSlug":"keras-team","affectedVersions":[{"vendor":"Keras-team","product":"Keras","versions":[">= 3.0.0, <= 3.11.2"]}],"capec":[{"id":"CAPEC-175","name":"Code Inclusion"}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2025-09-20T03:55:41.389596Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"keras","vulnerableRanges":[">=3.0.0, <3.11.3"],"patched":["3.11.3"],"from":["GHSA-36rr-ww3j-vrjv","PYSEC-2025-123"],"provenance":"source"}],"summary":{"text":"A flaw in the Keras Model.load_model method, part of the Keras library, lets a specially crafted legacy .h5/.hdf5 model archive execute arbitrary Python code, because the safe_mode=True setting is not honored when reading these archives. An attacker would need to supply a malicious model file that a victim loads, which requires local access and user interaction, and the attack is possible even when safe_mode is enabled.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:12:09Z"},"euvd":{"id":"EUVD-2025-30277","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2025-8747","published":"2025-08-11","fixed":"3.11.0","kev":false},{"cve":"CVE-2025-9906","published":"2025-09-19","fixed":"3.11.0","kev":false,"link":{"from":"CVE-2025-9906","to":"CVE-2025-9905","relation":"successor","confidence":"low","kind":"sequence","orderedBy":"description","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:keras","fromFixed":"3.11.0","toFixed":"3.11.3","daysApart":0}]}},{"cve":"CVE-2025-49655","published":"2025-10-17","fixed":"3.11.3","kev":false},{"cve":"CVE-2025-9905","published":"2025-09-19","fixed":"3.11.3","kev":false},{"cve":"CVE-2025-12058","published":"2025-10-29","fixed":"3.12.0","kev":false},{"cve":"CVE-2025-12060","published":"2025-10-30","fixed":"3.12.0","kev":false},{"cve":"CVE-2026-0897","published":"2026-01-15","fixed":"3.13.2","kev":false}],"package":"PyPI:keras"}}