Keras Safe Mode Bypass Vulnerability: Arbitrary Code Execution Risk

keras Updated 14 Dec 2025

Summary

11/08/2025
HIGH
Yes i
High
8.6

GHSA-pwq7-2gvj-vg9v: Duplicate Advisory: Keras safe mode bypass vulnerability. Affects keras versions >= 3.0.0, < 3.11.0. Fixed in 3.11.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Keras is an open-source deep learning library written in Python, designed to enable fast experimentation with neural networks. It provides a user-friendly API and supports multiple backends, making it a popular choice among data scientists and machine learning practitioners. However, versions 3.0.0 through 3.10.0 of Keras contain a vulnerability in the Model.load_model method that allows attackers to execute arbitrary code by loading specially crafted model archives.

Vulnerability Detail

The vulnerability arises from a safe mode bypass in the Model.load_model method of Keras. This flaw allows an attacker to craft a malicious .keras model archive that, when loaded by a user, can execute arbitrary code on the user's machine. The potential ramifications include unauthorized access to sensitive data, system compromise, and the execution of malicious payloads. This vulnerability is classified under CWE-502, which pertains to deserialization of untrusted data.

How To Fix

Latest published version: 3.15.1 as of 22 Oct 2026

pip install --upgrade "keras==3.15.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.11.0

This is the first release that contains the fix.

pip install --upgrade "keras==3.11.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid loading model files from untrusted sources. If you must load a model, ensure it is from a verified and secure origin to minimize the risk of executing malicious code.

Conclusion

The Keras safe mode bypass vulnerability poses a significant risk by allowing arbitrary code execution through malicious model files. Users are strongly advised to update to version 3.11.0 or later to mitigate this risk. Additionally, employing best practices when loading models can further enhance security.

See every vulnerability recorded for keras →

Share this vulnerability

FAQ

Keras versions 3.0.0 through 3.10.0 are affected by the safe mode bypass vulnerability.

Loading a malicious .keras model can lead to arbitrary code execution, potentially compromising your system and data.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Yes, the vulnerability has been patched in Keras version 3.11.0. Users should upgrade to this version or later.

Vulert monitors and alerts for open-source vulnerabilities in your software using just the Pipfile.lock. It provides real-time alerts to help you maintain secure applications.

Related vulnerabilities

Recent vulnerabilities recorded for keras.

How To Fix

Latest published version: 3.15.1 as of 22 Oct 2026

pip install --upgrade "keras==3.15.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.11.0

This is the first release that contains the fix.

pip install --upgrade "keras==3.11.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback