Skip to main content

Keras CVE-2026-12481

| EUVDEUVD-2026-41600 CRITICAL
Deserialization of Untrusted Data (CWE-502)
2026-07-03 @huntr_ai GHSA-5gwj-m78q-7pq3
9.8
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malicious Lambda config with marshal bytecode
  2. Delivery
    Deliver model file to victim load path
  3. Exploit
    deserialize() called outside SafeModeScope
  4. Execution
    Guard bypassed on safe_mode=None
  5. Persist
    marshal bytecode executed
  6. Impact
    Arbitrary 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 keras.layers.deserialize(config), keras.models.clone_model(model), or Lambda.from_config(config) while NOT inside an enclosing SafeModeScope(True) context - the default safe_mode=None is precisely the vulnerable state. The malicious payload must contain a Lambda layer carrying marshal bytecode. The key limiting factor is that exploitation depends on the victim actually loading untrusted model/config data: environments that only load trusted, internally-generated models, or that already wrap deserialization in SafeModeScope(True), are not exposed. No authentication of the attacker is required (PR:N) and no user interaction beyond the application loading the model.

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 Lambda layer whose function is marshal-encoded bytecode, then delivers it to a victim service that loads user-supplied models (e.g., a model-hosting or AutoML pipeline). When the service calls keras.layers.deserialize() or clone_model() outside a SafeModeScope, the guard is bypassed and the attacker's bytecode runs as the server process. A proof-of-concept is available via the Huntr bounty, and the low attack complexity (AC:L) makes reliable exploitation straightforward once a malicious model reaches a vulnerable load path.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – 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)
v1 Jul 03, 2026 - 21:51 CVSS 8.8

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

keras-team/keras unspecified ≤latest

Affected Packages

pypi keras fix: 3.12.3, 3.15.0

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

Vendor (huntr_ai) PRIMARY HIGH
NVD 9.8 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
vuln.today AI 9.8 CRITICAL

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).

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 8.8 HIGH

Primary rating from Vendor (huntr_ai).

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Analysis Updated
Jul 08, 2026 - 15:13 vuln.today
v2 - CVSS changed
Severity Changed
Jul 08, 2026 - 15:07 NVD
HIGH CRITICAL
CVSS changed
Jul 08, 2026 - 15:07 NVD
8.8 (HIGH) 9.8 (CRITICAL)

DescriptionNVD

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
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 1 pypi packages depend on keras (1 direct, 0 indirect)

Ecosystem-wide dependent count for version 3.13.0.

Executive ViewAI

Why It Matters

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.

Business Impact: Severe
Compensating Controls

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

EPSS Score
0.4%
Top 68% exploitable
Prevalence
High
Keras is one of the most widely used deep-learning frameworks
Threat Intel
1
1 sources
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
Very High
Technical Impact
Total

Priority Score

49
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +49
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy