Description
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.
Published: 2026-07-03
Score: 8.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The flaw lies in Keras 3.14.0’s Lambda layer deserialization logic, which mistakenly permits a deserialization when the safe_mode flag is unset (None) instead of treating it as denied. An attacker can supply model configuration data containing marshal bytecode that is executed when the configuration is loaded, leading to full OS‑level code execution for the process that runs the Keras code. This is a binary serialization flaw classified as CWE‑502.

Affected Systems

The issue affects the Keras library provided by the keras‑team; it is present in release 3.14.0 and any code that uses keras.layers.deserialize, keras.models.clone_model, or Lambda.from_config outside a SafeModeScope(True).

Risk and Exploitability

The vulnerability carries a CVSS score of 8.8, indicating high severity, but its EPSS score is below 1 % and it is not listed in the CISA KEV catalog, suggesting a low likelihood of exploitation. Based on the description, the likely attack vector is that an attacker supplies a malicious model configuration to a system that performs deserialization, most commonly through an API or interface that accepts user‑provided model data. Once reached, the attacker can run arbitrary code as the user of the application.

Generated by OpenCVE AI on July 23, 2026 at 16:11 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Keras to a version in which the Lambda deserialization safe‑mode guard is correctly enforced.
  • Wrap all calls to keras.layers.deserialize, keras.models.clone_model, or Lambda.from_config with SafeModeScope(True) to enforce safe‑mode protection.
  • Strictly validate and reject any externally supplied model configuration that contains marshal bytecode or other unexpected binary Keras deserialization API calls.

Generated by OpenCVE AI on July 23, 2026 at 16:11 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 06 Jul 2026 23:15:00 +0000

Type Values Removed Values Added
First Time appeared Keras-team
Keras-team keras
Vendors & Products Keras-team
Keras-team keras

Mon, 06 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Mon, 06 Jul 2026 12:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

threat_severity

Important


Fri, 03 Jul 2026 20:45:00 +0000

Type Values Removed Values Added
Description 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.
Title Deserialization of Untrusted Data in keras-team/keras
Weaknesses CWE-502
References
Metrics cvssV3_0

{'score': 8.8, 'vector': 'CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


Subscriptions

Keras-team Keras
cve-icon MITRE

Status: PUBLISHED

Assigner: @huntr_ai

Published:

Updated: 2026-07-06T15:15:46.244Z

Reserved: 2026-06-17T01:06:48.759Z

Link: CVE-2026-12481

cve-icon Vulnrichment

Updated: 2026-07-06T15:15:28.773Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-07-03T20:36:05Z

Links: CVE-2026-12481 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-23T16:15:03Z

Weaknesses
  • CWE-502

    Deserialization of Untrusted Data