CVE-2025-12058
published medium CVSS 4.0 · 5.9Vulnerability in Keras Model.load_model Leading to Arbitrary Local File Loading and SSRF
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Keras | — | Keras0 to < 3.12.0 · Other versions: unaffected | Affected | Not stated |
Description
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 4.0
- Base score
- 5.9 / 10
- Severity
- medium
- Provider
- Google · cna
- Vector string
- 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
- Scenarios
- en: GENERAL
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Keras | Keras | 0 to < 3.12.0 (affected · date)Default: unaffected | Google · cna |
Weaknesses
1- CWE-502 CWE-502 Deserialization of Untrusted Data
References
2Provider assertions
2Google · cna
Vulnerability in Keras Model.load_model Leading to Arbitrary Local File Loading and SSRF
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- dc5dd4ea35ba5eec37e4a078d7270dffd3739a1f066ea68a8d0f91482b08b445
- Ingested
- 23 Sep 2026, 08:36:37 UTC
- Source record
- Official CVE record