# CVE-2025-9905: Arbitary Code execution in Keras load_model()

- Severity: High 7.3 (CVSS:4.0, scored by Google) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.22%, higher than 13% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2025-09-19T08:16:44.772Z
- Modified: 2026-10-19T16:10:00.260Z
- Also known as: GHSA-36rr-ww3j-vrjv, PYSEC-2025-123
- Weaknesses: CWE-913
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: Google

## Description

The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True.

One can create a specially crafted .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed.

This 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.

Note that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.

(As written by CVE List.)

## Affected

- keras: from 3.0.0 up to 3.11.2
- keras (PyPI): from 3.0.0 before 3.11.3
- keras keras: from 3.0.0 before 3.11.3

## Every score

- Google: CVSS:4.0 7.3 High `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`
- GitHub: CVSS:4.0 High `CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`
- NVD: CVSS:3.1 7.3 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: CVSS:3.1 7.3 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H`

## References

- <https://github.com/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv> (exploit, evidence, vendor-advisory, web)
- <https://github.com/keras-team/keras/pull/21602> (fix, issue-tracking, patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2025-9905> (advisory)
- <https://github.com/keras-team/keras> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/keras/PYSEC-2025-123.yaml> (web)

## Sources

- CVE List: [CVE-2025-9905](https://www.cve.org/CVERecord?id=CVE-2025-9905), CVE Terms of Use, modified 2026-02-26
- GitHub Advisory Database: [GHSA-36rr-ww3j-vrjv](https://github.com/advisories/GHSA-36rr-ww3j-vrjv), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2025-9905](https://nvd.nist.gov/vuln/detail/CVE-2025-9905), Public domain, modified 2026-10-19
- PyPA Advisory Database: [PYSEC-2025-123](https://osv.dev/vulnerability/PYSEC-2025-123), CC-BY-4.0, modified 2026-05-20

---

Page: https://cve.day/CVE-2025-9905 · Whole record: https://cve.day/CVE-2025-9905.json · Rebuilt by cve.day 2026-11-25T22:59:04.850Z
