{"cve":"CVE-2025-9906","nvd":{"published":"2025-09-19T09:15:36.353","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 .keras model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special config.json (a file within the .keras archive) that will invoke keras.config.enable_unsafe_deserialization() to disable safe mode. Once safe mode is disable, one can use the Lambda layer feature of keras, which allows arbitrary Python code in the form of pickled code. Both can appear in the same archive. Simply the keras.config.enable_unsafe_deserialization() needs to appear first in the archive and the Lambda with arbitrary code needs to be second.","cvss_v4":{"vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/AU:Y/R:A","score":8.6},"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-502"],"references":["https://github.com/keras-team/keras/pull/21429"],"products":["keras:keras"],"source":"nvd","synced_at":"2026-10-19T22:10:08.713834912+00:00"},"epss":{"cve":"CVE-2025-9906","score":0.00204,"percentile":0.1026,"date":"2026-10-25"},"kev":null,"osv":[{"id":"GHSA-36fq-jgmw-4r9c","url":"https://osv.dev/vulnerability/GHSA-36fq-jgmw-4r9c","summary":"Keras is vulnerable to Deserialization of Untrusted Data","modified":"2026-09-10T03:50:27.820239587Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":["<3.11.0"],"fixed":["3.11.0"]}]},{"id":"PYSEC-2025-76","url":"https://osv.dev/vulnerability/PYSEC-2025-76","summary":"","modified":"2026-06-10T17:01:52.099728122Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":[],"fixed":[]}]}],"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."]}