Skip to main content

Keras CVE-2026-12484

| EUVDEUVD-2026-45872 HIGH
Deserialization of Untrusted Data (CWE-502)
2026-07-19 security@huntr.dev GHSA-v2w2-w228-c444
7.8
CVSS 3.0 · Vendor: huntr
View

Attack ChainAIDerived

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

  1. Access
    Craft malicious Torch pickle in Keras layer config
  2. Delivery
    Distribute config via model hub or shared file
  3. Exploit
    Victim calls TorchModuleWrapper.from_config
  4. Execution
    torch.load(weights_only=False) unpickles payload
  5. Impact
    Arbitrary code execution in victim context

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 that a victim application or user deserialize an attacker-controlled Keras layer configuration via keras.layers.TorchModuleWrapper.from_config while NOT inside a SafeModeScope(True) context (the default state), on the PyTorch backend where torch.load is used. The concrete prerequisites are: (1) use of the TorchModuleWrapper / PyTorch backend, and (2) processing of an untrusted config through from_config without an active Keras safe-mode scope. Limiting factors per the CVSS vector: exploitation is local (AV:L) and requires user interaction (UI:R) - the attacker cannot trigger it remotely without the victim loading the malicious config - and it does not apply to pipelines that only ever load first-party/trusted models or that already enforce SafeModeScope(True) around deserialization.

Impact

The supplied CVSS 3.0 vector (AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H, base 7.8) is internally consistent with the description: exploitation is not a remote network service compromise but rather requires a victim to load an attacker-supplied config, hence AV:L and UI:R, while the payload yields full code execution (C:H/I:H/A:H). No EPSS score, KEV entry, POC reference, or SSVC decision data was provided, so exploitation-probability signals are absent - the only corroborating signal is the huntr researcher submission and the Deserialization/RCE tags. This is a genuine, high-impact issue for anyone in an ML supply-chain or model-sharing scenario (loading models from Hugging Face-style hubs, shared checkpoints, or multi-tenant pipelines), but it is not a mass-scannable internet-facing bug: the UI:R requirement means it depends on convincing a target to deserialize a hostile config, so real-world risk is elevated for ML/MLOps environments handling untrusted models and comparatively low for isolated first-party deployments. Note the vector is authored as CVSS:3.0 rather than 3.1, and no independent EPSS/KEV data was available to confirm or contradict prioritization.

Exploit ScenarioDerived

An attacker publishes a seemingly benign Keras model or layer configuration (e.g., on a public model hub or shared via a colleague) whose serialized TorchModuleWrapper state embeds a malicious pickle payload. When a data scientist or an automated MLOps pipeline loads that config through from_config outside a SafeModeScope(True), torch.load(weights_only=False) unpickles the payload and executes arbitrary code in the victim's context. No public POC is referenced in the input, but crafting a pickle __reduce__ gadget for this class of flaw is straightforward.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Jul 19, 2026

Arbitrary code execution in keras-team/keras 3.15.0 arises because the public keras.layers.TorchModuleWrapper.from_config method calls torch.load(..., weights_only=False) without any explicit unsafe opt-in, so a maliciously crafted Keras layer configuration deserialized outside a SafeModeScope(True) context triggers execution of attacker-controlled PyTorch pickle payloads (CWE-502). Any application or pipeline that loads untrusted or third-party Keras model/layer configs is affected; CVSS is 7.8 (High) with a local vector requiring user interaction. There is no public exploit identified at time of analysis and the flaw is not listed in CISA KEV, but the vulnerability class is well understood and reliably weaponizable via standard pickle reduce gadgets.

RemediationAI

No vendor-released patch version is identified in the provided data, so a specific fixed release cannot be cited - consult the huntr advisory (https://huntr.com/bounties/ab14df49-13b5-4442-b754-3189430bfa28) and the keras-team/keras releases for an upgraded version and apply it once published. As the primary compensating control, never call TorchModuleWrapper.from_config (or deserialize Keras models/layers) on configurations from untrusted or unverified sources; treat model files like executable code. Where deserialization of external configs is unavoidable, wrap the operation in a SafeModeScope(True) context so Keras safe mode blocks the unsafe torch.load path - with the trade-off that legitimate configs relying on that Torch-wrapper load will fail and must be sourced only from trusted parties. Additionally, isolate model-loading in a sandboxed, least-privilege process or container without network egress or sensitive credentials to limit blast radius if a hostile config is loaded, accepting the added operational complexity of a separate deserialization service.

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 high-level neural-network API; version 3 (Keras Core) supports multiple backends including PyTorch, and TorchModuleWrapper is the adapter that embeds a native torch.nn.Module inside a Keras layer. Model/layer serialization in Keras round-trips through get_config/from_config dictionaries, and for the Torch wrapper the persisted state is restored via torch.load. PyTorch's torch.load defaults to the pickle protocol, and with weights_only=False it will unpickle arbitrary Python objects - invoking __reduce__ methods that can run any code during load. The root cause (CWE-502, Deserialization of Untrusted Data) is that from_config performs this unsafe load unconditionally: Keras has a safe-mode mechanism (SafeModeScope) intended to block unsafe deserialization, but this code path only honors it when a SafeModeScope(True) is already active and provides no per-call safe_mode=False gate, so the insecure behavior is the default rather than an explicit, audited opt-in.

Know when the next one hits your stack

  • 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) PRIMARY 7.8 HIGH
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI 7.8 HIGH

Exploitation needs a victim to load an untrusted config (AV:L, UI:R) with no auth (PR:N), and unpickling yields full code execution, so C/I/A all High.

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

Primary rating from Vendor (huntr).

CVSS VectorVendor: huntr

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

DescriptionCVE.org

A vulnerability in keras-team/keras version 3.15.0 allows unsafe deserialization of attacker-controlled PyTorch pickle data through the public keras.layers.TorchModuleWrapper.from_config method. This method invokes torch.load(..., weights_only=False) without requiring an explicit unsafe opt-in, such as a safe_mode=False parameter. When called outside a SafeModeScope(True) context, the absence of an ambient safe mode state permits unsafe deserialization by default. This issue can lead to arbitrary code execution if untrusted Keras layer configurations are processed using this method. The vulnerability arises because the method does not enforce safe deserialization practices unless explicitly guarded by Keras safe mode.

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.15.0 contains an arbitrary code execution vulnerability triggered when deserializing externally sourced or user-supplied model configurations, creating risk for organizations that accept model uploads or integrate third-party machine learning assets. Exploitation could compromise application integrity, enable data exfiltration, and facilitate lateral movement within infrastructure.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: (1) Wrap keras.layers.TorchModuleWrapper.from_config calls within SafeModeScope(True) to restrict pickle gadget execution; (2) disable model loading from untrusted external sources; (3) implement file-type validation and size limits on model uploads; (4) execute model deserialization in isolated, low-privilege containers with restricted network egress.

Threat Intelligence Overview

EPSS Score
0.2%
Top 89% exploitable
Prevalence
High
Keras is a widely deployed deep-learning framework across ML/research environments
Threat Intel
1
1 sources
Social Media
9
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL VulDB

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 HIGH
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
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
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

39
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +39
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