CVE-2025-12058 json
Vulnerability in Keras Model.load_model Leading to Arbitrary Local File Loading and SSRF
published last yr. modified 23d ago also EUVD-2025-36634 , GHSA-mq84-hjqx-cwf2 , GHSA-qg93-c7p6-gg7f , PYSEC-2026-1487
- cvss
- 5.9
- version 4.0, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 16%
- public exploits
- 0
- none known
Summary
The Keras.Model.load_model method, including when executed with the intended security mitigation safe_mode=True, is vulnerable to arbitrary local file loading and Server-Side Request Forgery (SSRF).
This vulnerability stems from the way the StringLookup layer is handled during model loading from a specially crafted .keras archive. The constructor for the StringLookup layer accepts a vocabulary argument that can specify a local file path or a remote file path.
* Arbitrary Local File Read: An attacker can create a malicious .keras file that embeds a local path in the StringLookup layer's configuration. When the model is loaded, Keras will attempt to read the content of the specified local file and incorporate it into the model state (e.g., retrievable via get_vocabulary()), allowing an attacker to read arbitrary local files on the hosting system.
* Server-Side Request Forgery (SSRF): Keras utilizes tf.io.gfile for file operations. Since tf.io.gfile supports remote filesystem handlers (such as GCS and HDFS) and HTTP/HTTPS protocols, the same mechanism can be leveraged to fetch content from arbitrary network endpoints on the server's behalf, resulting in an SSRF condition.
The security issue is that the feature allowing external path loading was not properly restricted by the safe_mode=True flag, which was intended to prevent such unintended data access.
Patch / fix
- pypi keras 3.12.0
- Keras Keras 3.12.0
- github.com/keras-team/keras@61ac8c1 commit
- github.com/keras-team/keras#21751 pull request
Is CVE-2025-12058 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-12058 updated cvss 5.5
keras: Keras Model.load_model Arbitrary Local File Loading and SSRF
-
Red Hat OpenShift AI (RHOAI) rhoai/odh-kserve-agent-rhel9, rhoai/odh-kserve-router-rhel9, rhoai/odh-kserve-controller-rhel9, rhoai/odh-modelmesh-runtime-adapter-rhel8, rhoai/odh-modelmesh-runtime-adapter-rhel9, rhoai/odh-kserve-storage-initializer-rhel9, +4 more Red Hat Trusted Artifact Signer rhtas/model-transparency-rhel9affected: workaround, no fix available “Fix deferred”
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
- partial
- Assessed
- last yr.
Exploit prediction
0.25% chance of exploitation in the next 30 days, higher than 16% of all scored CVEs (FIRST EPSS, 2026-11-11).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 4.0 | 5.9 | CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:H/VI:L/VA:L/SC:H/SI:L/SA:L |
| CNA | 4.0 | 5.9 | CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:H/VI:L/VA:L/SC:H/SI:L/SA:L/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 |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | keras | <3.12.0 |
3.12.0 |
Affected products
- Keras Keras
Classification
References
-
github.com
/keras-team/keras/pull/21751
web
-
github.com
/keras-team/keras/commit/61ac8c1e51862c471dee7b49029c356f55531487
web
-
github.com
/keras-team/keras/security/advisories/GHSA-qg93-c7p6-gg7f
web, advisory
-
nvd.nist.gov
/vuln/detail/CVE-2025-12058
advisory
-
github.com
/keras-team/keras
package
-
cve.org
/CVERecord?id=CVE-2025-12058
web
-
pypi.org
/project/keras
package
-
github.com
/advisories/GHSA-mq84-hjqx-cwf2
advisory
Sources
- CVE List CVE-2025-12058
- GitHub Advisory GHSA-mq84-hjqx-cwf2
- NVD CVE-2025-12058
- OSV PYSEC-2026-1487
- Maintainer advisory GHSA-qg93-c7p6-gg7f
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.
The maintainers of keras-team/keras published their own advisory on GitHub. Reviewed sources take precedence over it.