BREACHSPIDER
CVE databaseVendorsIntelFeaturesDevelopersDocsPricingSign inStart free trial

CVE-2025-12058 in Keras

No CVSS score published

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

Affects 1 product from 1 vendor. Facts below cite their sources.

CVSS v45.9
EPSS0.6%
EPSS percentile44th
FixUnknown

Affected products and versions

VendorProductAffected versions
Keras Keras < 3.12.0

A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.

Fix and vendor advisory

No official vendor advisory link on record. See the CVE record.

Exploitation

CISA known-exploitedNot in the CISA KEV catalog
Public exploitNot confirmed

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

Source: NIST NVD / MITRE CVE.

Record details

CVE IDCVE-2025-12058
BreachSpider IDBS-2025-GLOBAL-230669-I
Published2025-10-29
Last modified2026-10-19
Weakness (CWE)
SourceNVD

Weakness definitions

CWE-502: Deserialization of Untrusted Data

Software deserializes untrusted data without validation, allowing crafted objects to execute arbitrary code.

Related attack patterns (CAPEC)

CAPEC-586 Object Injection via CWE-502

Mapping is CWE to CAPEC per MITRE CAPEC 3.9.

Analysis AI-written, not human-reviewed

The Keras.Model.load_model method, even when using the intended security mitigation safe_mode=True, is vulnerable to arbitrary local file loading and Server-Side Request Forgery (SSRF) due to improper handling of the StringLookup layer during model loading from a specially crafted .keras archive.

An attacker can exploit this vulnerability by crafting a malicious .keras archive that, when loaded by the Keras.Model.load_model method, can lead to arbitrary local file loading or SSRF. This is possible because the StringLookup layer's constructor accepts a vocabulary argument that can be manipulated to point to arbitrary files or URLs.

Questions

What is CVE-2025-12058?

The Keras.Model.load_model method, even when using the intended security mitigation safe_mode=True, is vulnerable to arbitrary local file loading and Server-Side Request Forgery (SSRF) due to improper handling of the StringLookup layer during model loading from a specially crafted .keras archive.

Is CVE-2025-12058 actively exploited?

No confirmed active exploitation of CVE-2025-12058 as of 2026-10-25.

How do I remediate CVE-2025-12058?

Priority: HIGH.

What systems are affected by CVE-2025-12058?

CVE-2025-12058 affects Keras Keras.

For developers and AI agents

Run this check from your own code or agent

REST API

curl -s https://breachspider.com/api/v1/assets/correlate-cves \
 -H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"assets":[{"asset_id":"dev-1","vendor":"Keras","product":"Keras","version":"1.0"}]}'

API reference

Python SDK

pip install breachspider

PyPI · GitHub

MCP for AI agents

# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp

Setup for Claude, ChatGPT, Cursor

Free trial: 14 days, 750 device checks, no card.

Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-10-19.