Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious Lambda config with marshal bytecode
-
DeliveryDeliver model file to victim load path
-
Exploitdeserialize() called outside SafeModeScope
-
ExecutionGuard bypassed on safe_mode=None
-
Persistmarshal bytecode executed
-
ImpactArbitrary OS code as server process
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V1 - Encoding and Sanitization Safe deserialization, type allowlists
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to deserialize an attacker-controlled Keras artifact through |
| Impact | The CVSS 3.1 base score is 9.8 (AV:N/AC:L/PR:N/UI:N, C:H/I:H/A:H), indicating a network-reachable, low-complexity, unauthenticated path to total compromise, consistent with the SSVC 'total' technical impact. However, the signals are mixed: SSVC marks exploitation as only 'poc' (not active) and Automatable 'no', and EPSS is low at 0.40% (32nd percentile), and the CVE is not listed in CISA KEV - so this is a high-severity but not-yet-widely-exploited issue. The practical caveat is that although the CVSS AV:N/PR:N implies remote unauthenticated exploitation, real-world exploitation requires the victim application to load an attacker-supplied Keras model/config; the 'network' vector reflects delivery of a malicious model file rather than a directly listening remote service, which is why Automatable is 'no'. Priority should therefore be high for any service that deserializes untrusted Keras models, and lower for closed pipelines that only load trusted, internally-produced models. |
| Exploit ScenarioDerived | An attacker crafts a malicious Keras model or layer config containing a |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Jul 08, 2026
Arbitrary code execution in keras-team/keras 3.14.0 lets remote attackers run OS-level commands by supplying a malicious serialized Lambda layer that is deserialized without an active SafeModeScope. The root cause is _raise_for_lambda_deserialization() treating a None safe_mode (the default when from_config() runs outside a SafeModeScope) as if it were an explicit False, so the safe-mode guard is skipped and attacker-controlled marshal bytecode executes. SSVC rates technical impact as total with a proof-of-concept available; EPSS is modest at 0.40% (32nd percentile), and the flaw is not in CISA KEV.
Earlier versions of this analysis (1)
Arbitrary code execution in keras-team/keras 3.14.0 stems from a default-deny logic flaw in the Lambda layer's deserialization guard: _raise_for_lambda_deserialization() treats an unset safe_mode (None) as if it were explicitly False, so the safe-mode check is skipped whenever from_config() runs outside a SafeModeScope. An attacker who supplies a crafted model or layer config can smuggle malicious marshal bytecode that Keras deserializes and executes as native Python, yielding OS-level code execution in the loading process. CVSS is 8.8 (High) with a network vector but required user interaction; reported via a huntr.com bounty, with no public exploit code confirmed and no CISA KEV listing at time of analysis.
RemediationAI
No vendor-released patched version is identified in the supplied data, so the fix version cannot be cited (EUVD lists only 'unspecified ≤latest' and no tagged release is provided); monitor the Huntr report (https://huntr.com/bounties/59ceaed1-c8a3-4135-8f94-169ade02823d) and NVD (https://nvd.nist.gov/vuln/detail/CVE-2026-12481) for the patched release and upgrade as soon as it is published. As compensating controls, never call keras.layers.deserialize, keras.models.clone_model, or Lambda.from_config on models from untrusted sources, and explicitly wrap all deserialization in with SafeModeScope(True): so the guard cannot fall through on the default safe_mode=None - the trade-off is that legitimate models that genuinely rely on Lambda-embedded code will fail to load and must be refactored to registered/custom layers. Additionally, restrict and validate the provenance of model files (signed artifacts, trusted registries only), and isolate model-loading processes with least-privilege OS accounts and sandboxing so that a successful deserialization does not yield high-privilege OS execution.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Keras is a widely used high-level neural-network API (the keras-team/keras package) whose model/layer serialization format allows a Lambda layer to carry arbitrary Python code. On load, Lambda.from_config() can reconstruct that callable from marshal-encoded bytecode, which is why Keras added a safe_mode guard and a SafeModeScope context manager to block untrusted Lambda deserialization. This is a classic CWE-502 (Deserialization of Untrusted Data) issue: the guard _raise_for_lambda_deserialization() uses tri-state logic where None should mean unset/default-deny but is conflated with False (explicitly disabled). Because safe_mode defaults to None outside a SafeModeScope, entry points such as keras.layers.deserialize(config), keras.models.clone_model(model), and direct Lambda.from_config(config) calls fall through the guard and execute the embedded bytecode.
Know when Keras Team Keras gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Malicious model is delivered over the network and loaded without auth or interaction (AV:N/PR:N/UI:N), low-complexity deserialization yields full OS code execution (C/I/A:H).
Primary rating from Vendor (huntr_ai).
CVSS VectorNVD
Lifecycle Timeline
3DescriptionNVD
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.
Blast Radius
ecosystem impact- 1 pypi packages depend on keras (1 direct, 0 indirect)
Ecosystem-wide dependent count for version 3.13.0.
Executive ViewAI
Keras 3.14.0 contains a critical remote code execution vulnerability allowing attackers to execute arbitrary OS commands through malicious serialized model layers; publicly available exploit code exists for this flaw. Organizations running affected versions face immediate risk of full system compromise with no vendor patch currently available. Urgent remediation is required for any production machine learning infrastructure using this library.
Disable or restrict deserialization of Lambda layers from all external and untrusted model sources. Implement network segmentation to isolate affected systems from sensitive data and applications. Apply strict input validation before any model deserialization operations. Deploy rate limiting and anomaly detection on model loading endpoints to detect exploitation attempts. Restrict API-level access to model loading functions through authentication and authorization controls. Evaluate rollback to previous Keras versions (3.13.x or earlier, pending security verification) if operationally feasible.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Insecure deserialization occurs when an application converts serialized data (a stream of bytes representing an object's state) back into a living object without proper validation.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
More in Keras Team Keras
View allArbitrary code execution in Keras 3.13.0 occurs because the TFSMLayer class unconditionally loads attacker-supplied Tens
Local HDF5 file content disclosure in keras-team/keras versions 3.14.0 and earlier allows an attacker who can deliver a
Symlink entries in malicious tar archives bypass the `filter_safe_tarinfos` validation in Keras 3.12.0, enabling directo
Path traversal in Keras 3.14.0 exposes local file systems to arbitrary file and directory creation when processing malic
Unbounded memory allocation in Keras (keras-team/keras) versions ≤ 3.15.0 allows an attacker who can supply a crafted .k
EUVD-2026-41600
GHSA-5gwj-m78q-7pq3
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB