{"cve":"CVE-2025-9905","nvd":{"published":"2025-09-19T09:15:36.033","modified":"2026-10-19T16:10:00.260","status":"Analyzed","description":"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.","cvss_v4":{"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","score":7.3},"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":7.3},"cwes":["CWE-913"],"references":["https://github.com/keras-team/keras/pull/21602","https://github.com/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv"],"products":["keras:keras"],"source":"nvd","synced_at":"2026-10-19T22:10:08.713834912+00:00"},"epss":{"cve":"CVE-2025-9905","score":0.00223,"percentile":0.1275,"date":"2026-10-25"},"kev":null,"osv":[{"id":"GHSA-36rr-ww3j-vrjv","url":"https://osv.dev/vulnerability/GHSA-36rr-ww3j-vrjv","summary":"The Keras `Model.load_model` method **silently** ignores `safe_mode=True` and allows arbitrary code execution when a `.h5`/`.hdf5` file is loaded.","modified":"2026-09-10T03:50:27.819640046Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":[">=3.0.0 <3.11.3"],"fixed":["3.11.3"]}]},{"id":"PYSEC-2025-123","url":"https://osv.dev/vulnerability/PYSEC-2025-123","summary":"","modified":"2026-05-20T09:19:03.537687Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":[">=3.0.0 <3.11.3"],"fixed":["3.11.3"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}