CVE-2025-9906 json
Arbitrary Code execution in Keras Safe Mode
published last yr. modified 21d ago also GHSA-36fq-jgmw-4r9c , PYSEC-2025-76 , EUVD-2025-30281
- 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 10%
- 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 .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.
Patch / fix
- pypi keras 3.11.0
- Keras-team Keras 3.11.0
- github.com/keras-team/keras@713172a commit
- github.com/keras-team/keras#21429 pull request
- github.com/keras-team/keras/releases/tag/v3.11.0 release
Is CVE-2025-9906 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerVendor 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-9906 updated cvss 8.2
keras: Arbitrary Code execution in Keras Safe Mode
-
Red Hat OpenShift AI (RHOAI) rhoai/odh-modelmesh-runtime-adapter-rhel8affected: workaround, no fix planned “Will not fix”
-
Red Hat OpenShift AI 2.25 rhoai v2.25.1-1764825096fixed: vendor fix RHSA-2025:23531
-
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
- last yr.
Exploit prediction
0.20% chance of exploitation in the next 30 days, higher than 10% of all scored CVEs (FIRST EPSS, 2026-11-09).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 4.0 | 8.6 | 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 |
| CNA | 4.0 | 8.6 | 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/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:Y/R:A/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 |
| GitHub | 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.11.0 |
3.11.0 |
Affected products
- Keras-team Keras
Classification
- Weakness
-
- CWE-502 Deserialization of Untrusted Data
References
-
github.com
/keras-team/keras/pull/21429
patch, web, issue-tracking, report
-
github.com
/keras-team/keras/commit/713172ab56b864e59e2aa79b1a51b0e728bba858
web
-
nvd.nist.gov
/vuln/detail/CVE-2025-9906
advisory
-
github.com
/keras-team/keras
package
-
github.com
/keras-team/keras/releases/tag/v3.11.0
web
-
github.com
/pypa/advisory-database/tree/main/vulns/keras/PYSEC-2025-76.yaml
web
-
osv.dev
/vulnerability/CVE-2025-9906
web
-
github.com
/advisories/GHSA-36fq-jgmw-4r9c
advisory
Sources
- CVE List CVE-2025-9906
- GitHub Advisory GHSA-36fq-jgmw-4r9c
- NVD CVE-2025-9906
- OSV PYSEC-2025-76
Fencer Intel 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.