CVE-2025-9905 json
Arbitary Code execution in Keras load_model()
published 2025-09-19 13 mo ago modified 2026-10-19 20 d ago also GHSA-36rr-ww3j-vrjv , PYSEC-2025-123 , EUVD-2025-30277
- cvss
- 7.3
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 12%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2025-9905 updated cvss 8.6
keras: Arbitary Code execution in Keras load_model()
-
Red Hat OpenShift AI (RHOAI) rhoai/odh-modelmesh-runtime-adapter-rhel8affected: workaround, no fix planned “Will not fix”
-
Red Hat OpenShift AI 2.22 rhoai v2.22.3-1764594508fixed: vendor fix RHSA-2025:22759
-
Red Hat OpenShift AI 2.25 rhoai v2.25.1-1764825096fixed: vendor fix RHSA-2025:23531
-
Red Hat OpenShift AI 2.22 rhoai v2.22.3-1763051808, rhoai v2.22.3-1763565765, rhoai v2.22.3-1763639678, rhoai v2.22.3-1764181290, rhoai v2.22.3-1764293130, rhoai v2.22.3-1764593039, +17 more Red Hat OpenShift AI 2.25 rhoai 0.0-1763988459, rhoai v2.25.1-1764757768, rhoai v2.25.1-1764757769, rhoai v2.25.1-1764757770, rhoai v2.25.1-1764757772, rhoai v2.25.1-1764757773, +35 morenot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 13 mo ago
Exploit prediction
0.22% chance of exploitation in the next 30 days, higher than 12% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 4.0 | 7.3 | 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 |
| CNA | 4.0 | 7.3 | 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/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 |
| NVD | 3.1 | 7.3 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H |
| OSV | 3.1 | 7.3 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | keras | >=3.0.0, <3.11.3 |
3.11.3 |
Affected products
- Keras-team Keras
Classification
- Weakness
-
- CWE-913 Improper Control of Dynamically-Managed Code Resources
References
-
github.com
/keras-team/keras/pull/21602
patch, web, issue-tracking
-
github.com
/keras-team/keras/security/advisories/GHSA-36rr-ww3j-vrjv
web, exploit, vendor-advisory, evidence
-
nvd.nist.gov
/vuln/detail/CVE-2025-9905
advisory
-
github.com
/keras-team/keras
package
-
github.com
/pypa/advisory-database/tree/main/vulns/keras/PYSEC-2025-123.yaml
web
Sources
- CVE List CVE-2025-9905
- GitHub Advisory GHSA-36rr-ww3j-vrjv
- NVD CVE-2025-9905
- OSV PYSEC-2025-123
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.