CVE-2026-12481
Received Received - Intake

Arbitrary Code Execution in Keras via Lambda Layer Deserialization

Vulnerability report for CVE-2026-12481, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-07-03

Last updated on: 2026-07-03

Assigner: huntr.dev

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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-07-03
Last Modified
2026-07-03
Generated
2026-07-04
AI Q&A
2026-07-04
EPSS Evaluated
N/A
NVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
keras-team keras 3.14.0

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-502 The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability exists in keras-team/keras version 3.14.0 and allows for arbitrary code execution. It occurs because the function responsible for handling deserialization in the Lambda layer, specifically _raise_for_lambda_deserialization(), does not properly enforce a safe-mode guard when the safe_mode parameter is set to None. Since None is the default value when from_config() is called outside a SafeModeScope context, this logic error treats None (unset/default-deny) the same as False (explicitly disabled), effectively bypassing the safety check.

As a result, attacker-controlled marshal bytecode can be deserialized, which can lead to arbitrary operating system-level code execution within the server or user process. The vulnerability affects calls to keras.layers.deserialize(config), keras.models.clone_model(model), and any direct invocation of Lambda.from_config(config) without an enclosing SafeModeScope(True).

Impact Analysis

This vulnerability can have severe impacts because it allows an attacker to execute arbitrary code at the operating system level within the context of the server or user process running the vulnerable Keras version. This means an attacker could potentially take control of the affected system, manipulate data, disrupt services, or use the compromised system as a foothold for further attacks.

Mitigation Strategies

To mitigate this vulnerability, ensure that any deserialization of the Lambda layer in keras is done within a SafeModeScope context with safe_mode explicitly set to True. Avoid calling Lambda.from_config(config) or keras.layers.deserialize(config) without this safe mode guard.

Additionally, consider updating or patching keras to a version where this vulnerability is fixed, or apply any available security patches from the maintainers.

Compliance Impact

This vulnerability allows for arbitrary OS-level code execution due to improper deserialization in the Keras Lambda layer. Such a security flaw can lead to unauthorized access, data breaches, or manipulation of sensitive information.

Because of the potential for unauthorized access and data compromise, this vulnerability could negatively impact compliance with common standards and regulations such as GDPR and HIPAA, which require protection of personal and sensitive data against unauthorized access and breaches.

However, specific impacts on compliance depend on the context in which the vulnerable software is used and whether the vulnerability is exploited.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-12481. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart