cve.bz

CVE-2026-12481 keras keras: Deserialization of Untrusted Data

9.8 criticalExploit referenceEPSS 0.7%Fix available

Critical (9.8) in keras keras. EPSS 0.7% estimated probability of exploitation activity in the next 30 days. Fixed in keras 3.12.3, 3.15.0.

On this page
A vulnerability in keras-team/keras version 3.14.0 allows for arbitrary code execution due to improper handling of deserialization in the `Lambda` layer. Specifically, the `_raise_for_lambda_deserialization()` function fails to enforce the safe-mode guard when `safe_mode` is set to `None`, which is the default value when `from_config()` is called outside of a `SafeModeScope` context. This logic error conflates `None` (unset/default-deny) with `False` (explicitly disabled), bypassing the guard and allowing attacker-controlled `marshal` bytecode to be deserialized. Affected call sites include `keras.layers.deserialize(config)`, `keras.models.clone_model(model)`, and any direct invocation of `Lambda.from_config(config)` without an enclosing `SafeModeScope(True)`. This vulnerability can be exploited to achieve arbitrary OS-level code execution in the context of the server or user process.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
0.7% (unchanged from 0.7% a week ago; 0.7% 30 days ago) estimated probability of exploitation activity in the next 30 days; 55th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: PoC · Automatable: no · Technical impact: total, assessed 2026-07-06. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-502 Deserialization of Untrusted Data
OWASP Top 10
A08:2025 Software or Data Integrity Failures
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

  • keras (PyPI): fixed in 3.12.3, 3.15.0

Ask an AI about this CVE

Show the promptExplain CVE-2026-12481 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-12481?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-12481?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-12481 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
keras-team/kerasthrough latest

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-5gwj-m78q-7pq3PyPIkeras<3.12.33.12.3
GHSA-5gwj-m78q-7pq3PyPIkeras>=3.13.0 <3.15.03.15.0
PYSEC-2026-3631PyPIkeras<3.12.3
>=3.13.0 <3.15.0
3.12.3, 3.15.0

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11kerasno fix listedDEBIAN-CVE-2026-12481
Ubuntu18.04:LTS, 20.04:LTSkerasno fix listedUBUNTU-CVE-2026-12481

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu.

Red Hat

Red Hat rates this Important.

Red Hat's statement

This is an Important arbitrary code execution vulnerability in the Keras deep learning library, impacting Red Hat OpenShift AI components. The flaw arises from improper deserialization in the `Lambda` layer, where a security safeguard is bypassed if `safe_mode` is not explicitly enabled. Exploitation requires user interaction, such as loading a specially crafted Keras model.

Red Hat's mitigation

To reduce exposure, only deserialize Keras models from trusted sources. When deserializing models, explicitly enable `safe_mode` by wrapping the deserialization call within a `SafeModeScope(True)` context. This ensures the deserialization safeguard is enforced, preventing the execution of arbitrary code.

ProductPackageStateAdvisory
Red Hat OpenShift AI 3.4rhoai/odh-kserve-storage-initializer-rhel9:1787073479Fixed 2026-08-27RHSA-2026:60520
Red Hat OpenShift AI (RHOAI)rhoai/odh-kserve-agent-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-kserve-controller-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-kserve-router-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-modelmesh-runtime-adapter-rhel9Affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-pipeline-runtime-tensorflow-cuda-py312-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-pipeline-runtime-tensorflow-rocm-py312-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-workbench-jupyter-tensorflow-cuda-py312-rhel9Not affected
Red Hat OpenShift AI (RHOAI)rhoai/odh-workbench-jupyter-tensorflow-rocm-py312-rhel9Not affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2026-12481.

Attack patterns (CAPEC)

  • CAPEC-586 Object Injection Likelihood: Medium · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON