CVE-2025-9906
Python vulnerability analysis and mitigation

Overview

The Keras Model.loadmodel method contains a critical vulnerability (CVE-2025-9906) that allows arbitrary code execution, even with safemode enabled. The vulnerability was discovered and disclosed on September 19, 2025. This security flaw affects the Keras machine learning library and its implementation in various platforms including Red Hat OpenShift AI (RHOAI) (NVD CVE, Debian Tracker).

Technical details

The vulnerability exploits a flaw in the Model.loadmodel method through a specially crafted .keras model archive. The attack vector involves creating a malicious config.json file within the .keras archive that calls keras.config.enableunsafe_deserialization() to disable safe mode. Once safe mode is bypassed, attackers can utilize the Lambda layer feature to execute arbitrary Python code via pickled code. The vulnerability has been assigned a CVSS 4.0 Base Score of 8.6 (HIGH) with the vector string 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. The vulnerability is classified as CWE-502 (Deserialization of Untrusted Data) (NVD CVE).

Impact

The vulnerability allows attackers to achieve arbitrary code execution on affected systems. When successfully exploited, it can lead to complete system compromise, allowing attackers to execute malicious code with the privileges of the application running the Keras model (NVD CVE).

Mitigation and workarounds

A fix has been implemented through a pull request that restricts deserialization to KerasSaveables by module and name. The patch includes making Operation extend KerasSaveable, removing direct Layer extension of KerasSaveable, and disallowing the public function enableunsafedeserialization (GitHub PR).

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-6237CRITICAL9.8
  • PythonPython
  • invokeai
NoNoSep 18, 2025
CVE-2025-10157CRITICAL9.3
  • PythonPython
  • picklescan
NoYesSep 17, 2025
CVE-2025-10156CRITICAL9.3
  • PythonPython
  • picklescan
NoYesSep 17, 2025
CVE-2025-9906HIGH8.6
  • PythonPython
  • keras
NoYesSep 19, 2025
CVE-2025-9905HIGH7.3
  • PythonPython
  • keras
NoYesSep 19, 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