Arbitrary code injection vulnerability in Keras framework < 2.13
Description
A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary code with the same permissions as the application using a model that allow arbitrary code irrespective of the application.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Arbitrary code injection in TensorFlow Keras (<2.13) via Lambda layers allows attackers to execute code when loading malicious models, risking supply chain attacks.
Vulnerability
CVE-2024-3660 is an arbitrary code injection vulnerability in TensorFlow's Keras framework prior to version 2.13. The root cause is the Lambda layer, which allows developers to embed arbitrary Python lambda functions into models. In versions before 2.13, the Model.load_model() method does not adequately restrict deserialization of these Lambda layers, enabling code injection [1][2].
Exploitation
An attacker can craft a model containing a malicious Lambda layer, save it (e.g., in Keras v3, v2 SavedModel, or legacy H5 format), and redistribute it. When a victim loads the model with load_model() without safe_mode (available only in v3 format on 2.13+), the attacker's code executes with the application's permissions. No prior authentication is needed; the attack vector is supply chain through model files [1][2].
Impact
Successful exploitation grants arbitrary code execution in the context of the vulnerable application. This can lead to data theft, system compromise, or supply chain attacks, especially in AI/ML pipelines where models are shared [2][3].
Mitigation
Upgrade to Keras 2.13 or later, which introduces safe_mode that blocks Lambda layer deserialization by default. For older versions, avoid loading models from untrusted sources [4].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
kerasPyPI | < 2.13.1rc0 | 2.13.1rc0 |
Affected products
2- tensorflow/kerasv5Range: *
Patches
1b3ffea6602dbVulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5News mentions
0No linked articles in our index yet.