CVE-2025-12058
Python vulnerability analysis and mitigation

Overview

The Keras.Model.loadmodel method contains a vulnerability (CVE-2025-12058) that affects the handling of StringLookup layer during model loading, even when using the intended security mitigation safemode=True. The vulnerability was discovered and disclosed on October 29, 2025, affecting Keras versions prior to 3.12.0. This security issue impacts systems using Keras for machine learning model operations, particularly those loading models with StringLookup layers (NVD, Miggo).

Technical details

The vulnerability stems from improper handling of the vocabulary parameter in the IndexLookup layer, which is the parent class for StringLookup and IntegerLookup layers. The constructor for the StringLookup layer accepts a vocabulary argument that can specify either a local file path or a remote file path. The CVSS v4.0 score is 5.9 (Medium) with 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. The vulnerability is classified as CWE-502 (Deserialization of Untrusted Data) (NVD, Miggo).

Impact

The vulnerability has two main impact vectors: Arbitrary Local File Read, where an attacker can create a malicious .keras file that embeds a local path in the StringLookup layer's configuration, allowing access to arbitrary local files on the hosting system; and Server-Side Request Forgery (SSRF), where the tf.io.gfile support for remote filesystem handlers can be exploited to fetch content from arbitrary network endpoints (NVD).

Mitigation and workarounds

The vulnerability has been patched in Keras version 3.12.0. The fix includes adding a security check in the setvocabulary method that prevents loading arbitrary files when safemode is enabled. Users are advised to upgrade to this version or later. The patch addresses the issue by raising a ValueError if it's asked to load a vocabulary from an external file path when safe_mode is enabled (Miggo).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66423HIGH7.1
  • PythonPython
  • tryton-server
NoYesNov 30, 2025
CVE-2025-66454MEDIUM6.5
  • PythonPython
  • arcade-mcp-server
NoYesDec 02, 2025
CVE-2025-66424MEDIUM6.5
  • PythonPython
  • trytond
NoYesNov 30, 2025
CVE-2025-66422MEDIUM4.3
  • PythonPython
  • tryton-server
NoYesNov 30, 2025
CVE-2025-65858LOW3.5
  • PythonPython
  • calibreweb
NoNoDec 02, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management