Keras
CVE-2025-49655
CRITICAL
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious .keras file with TorchModuleWrapper
-
ExploitVictim loads model via load_model()
-
Executiontorch.load() runs despite safe mode
-
ImpactArbitrary code executes on victim host
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 victim to load an attacker-supplied Keras model file (local or remote URL) containing a TorchModuleWrapper class, which triggers torch.load() during from_config() deserialization in Keras 3.11.0, 3.11.1, or 3.11.2. The defining condition is that this path executes even with safe_mode ENABLED (the default), so the usual safeguard does not stop it. Limiting factors: the attack needs the victim to obtain and deliberately load the malicious .keras file (user interaction), and only the narrow version band 3.11.0-3.11.2 is affected - 3.11.3 and later raise a ValueError in safe mode, and earlier branches are unaffected. |
| Impact | The input CVSS of 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) rates this CRITICAL, and CWE-502 deserialization leading to RCE is a genuinely dangerous class. However, the signals partially conflict: the NVD vector marks UI:N, yet the description states the code only runs 'when loaded' - i.e. a victim must actively load an attacker-supplied Keras model file - which is user interaction and materially lowers real-world likelihood versus a true no-interaction network RCE. No EPSS score was provided in the input, so exploitation probability cannot be quantified here. The CVE is NOT listed in CISA KEV and no public exploit was flagged in the input, so there is no confirmation of active exploitation; the referenced HiddenLayer security advisory indicates researcher attention but is not a POC signal. The most security-relevant fact is that exploitation bypasses Keras safe_mode, the DEFAULT protection users rely on - this elevates priority for anyone loading untrusted .keras files. Net assessment: a real, high-priority issue for ML pipelines that ingest third-party models, but the required user interaction and narrow affected range (3.11.0-3.11.2) make it closer to a targeted/social-engineering vector than mass-exploitable network RCE. The UI:N in the NVD vector should be verified with the vendor, as it likely overstates the no-interaction nature of the flaw. |
| Exploit ScenarioDerived | An attacker publishes a trojanized model to a model hub or sends it directly, embedding a TorchModuleWrapper that invokes torch.load(). When a victim loads the file with Keras 3.11.0-3.11.2 using keras.saving.load_model() - even with safe_mode enabled - the malicious payload deserializes and executes arbitrary code on the victim's host. No public exploit was identified in the input, though a HiddenLayer advisory describes the issue. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 19, 2026
Deserialization of untrusted data in Keras 3.11.0 through 3.11.2 allows remote code execution when a victim loads a maliciously crafted Keras model file containing a TorchModuleWrapper, even with safe mode enabled (the default). The bypass occurs because torch.load() is invoked during from_config() deserialization without the safe-mode check; exploitation requires user interaction to load the file, which can be local or fetched from a remote URL. No public exploit code or confirmed active exploitation was identified at time of analysis, but the unauthenticated network vector and high impact make this critical.
RemediationAI
Upgrade to Keras 3.11.3 or later, which enforces the safe-mode check and raises a ValueError when a TorchModuleWrapper is encountered during safe-mode deserialization (vendor-released patch: 3.11.3). If immediate upgrade is not possible, treat all .keras files as untrusted: do not load models from untrusted sources, and restrict model loading to vetted, internally produced artifacts. Because safe_mode is bypassed in affected versions, there is no configuration-only fix; disabling or avoiding TorchModuleWrapper in model files and blocking untrusted model downloads at the network/proxy layer are compensating controls, but they trade functionality for risk reduction. See the advisory at https://hiddenlayer.com/sai_security_advisor/2025-10-keras/ and the fix PR at https://github.com/keras-team/keras/pull/21575.
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 deep learning framework that serializes model architectures and weights into .keras files. The TorchModuleWrapper class in keras/src/utils/torch_utils.py wraps a PyTorch nn.Module and implements from_config(); prior to the fix, this method called torch.load() on attacker-controlled data without checking Keras's safe_mode flag. This is a CWE-502 deserialization flaw: loading a malicious .keras file causes arbitrary code execution via PyTorch's pickle-based deserialization. The fix in PR 21575 adds an in_safe_mode() check that raises a ValueError by default, requiring explicit opt-in (safe_mode=False or keras.config.enable_unsafe_deserialization()) to load torch.nn.Module objects. Affected versions are 3.11.0, 3.11.1, and 3.11.2; 3.11.3 and later include the guard.
Know when 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
Code runs only when a victim loads the attacker-supplied model, so UI:R rather than NVD's UI:N; remote/local file delivery keeps AV:N, AC:L and full C/I/A impact from arbitrary code execution.
Primary rating from Vendor (6f8de1f0-f67e-45a6-b68f-98777fdb759c).
CVSS VectorVendor: 6f8de1f0-f67e-45a6-b68f-98777fdb759c
DescriptionCVE.org
Deserialization of untrusted data can occur in versions of the Keras framework running versions 3.11.0 up to but not including 3.11.3, enabling a maliciously uploaded Keras file containing a TorchModuleWrapper class to run arbitrary code on an end user’s system when loaded despite safe mode being enabled. The vulnerability can be triggered through both local and remote files.
Executive ViewAI
A critical deserialization flaw in Keras versions 3.11.0 through 3.11.2 allows a booby-trapped model file to run attacker code on any machine that loads it, and it defeats the library's default safe-mode protection. The exposure is concentrated in data science, MLOps, and research teams that routinely download or exchange pretrained models, where a single malicious file could hand an intruder control of a developer workstation or a build/inference server. Leadership should care because model artifacts are shared with far less scrutiny than software packages, the flaw cannot be fixed by configuration alone, and no vendor patch exists yet.
No vendor-released patch identified at time of analysis; interim mitigations are to downgrade to Keras 3.10.x or earlier, refuse to load model files from untrusted or unverified sources, verify hashes or signatures on all model artifacts before loading, run model-loading workloads in sandboxed low-privilege containers or VMs with restricted egress and no access to production secrets, and block or closely monitor use of TorchModuleWrapper in inbound model files.
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.
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. Rated
A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary c
Directory traversal in Keras through 3.11.3 allows an attacker who supplies a crafted tar archive to keras.utils.get_fil
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. Rated
Path traversal in Keras archive extraction utilities prior to version 3.14.0 allows remote attackers to write files outs
Memory-exhaustion denial of service in Google Keras 3.0.0 through 3.13.0 lets a remote attacker crash the Python interpr
Arbitrary local file disclosure in Keras 3.0.0 through 3.13.1 allows a remote attacker to read sensitive files from a vi
Keras Model.load_model fails to enforce safe_mode=True for the StringLookup layer's vocabulary path handling, so a malic
A safe mode bypass vulnerability in the `Model.load_model` method in Keras versions 3.0.0 through 3.10.0 allows an attac
An issue in keras 3.7.0 allows attackers to write arbitrary files to the user's machine via downloading a crafted tar fi
GHSA-cvhh-q5g5-qprp
NVD
CVE.org
EPSS
Exploit-DB