CVE-2026-12481: Deserialization of Untrusted Data in keras-team/keras
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 raiseforlambdadeserialization() function fails to enforce the safe-mode guard when safemode is set to None, which is the default value when fromconfig() 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.clonemodel(model), and any direct invocation of Lambda.fromconfig(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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
keras-team/kerasto a version that resolves this vulnerability.Fixed in 3.14.0 - Configuration
When using `keras.layers.deserialize(config)`, `keras.models.clone_model(model)`, or `Lambda.from_config(config)`, ensure deserialization of potentially untrusted data occurs inside `SafeModeScope(True)` so the safe-mode guard is enforced (avoid calling these outside a `SafeModeScope` context, where `safe_mode` defaults to `None`).
keras-team/keras (SafeModeScope / from_config) safe_mode (SafeModeScope(True) vs default) = Enforce SafeModeScope(True) when deserializing untrusted configs
Event History
Frequently Asked Questions
What is the severity of CVE-2026-12481?
The severity of CVE-2026-12481 is rated high with a CVSS score of 8.8.
How do I fix CVE-2026-12481?
To fix CVE-2026-12481, update keras-team/keras to version 3.14.1 or later, where the deserialization issue has been resolved.
What type of vulnerability is CVE-2026-12481?
CVE-2026-12481 is a deserialization of untrusted data vulnerability that allows for arbitrary code execution.
Who is affected by CVE-2026-12481?
Users of keras-team/keras version 3.14.0 are affected by CVE-2026-12481.
What components of keras are impacted by CVE-2026-12481?
The vulnerability specifically impacts the `Lambda` layer's handling of deserialization in keras-team/keras.