CVE-2026-12484

Unsafe Deserialization in keras.layers.TorchModuleWrapper.from_config

Published Jul 19, 2026 CVSS 3.1 · 7.8 High EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

The vulnerability stems from Keras version 3.15.0’s keras.layers.TorchModuleWrapper.from_config method, which calls torch.load(...) with weights_only set to False and without requiring an explicit safe‑mode opt‑in. When this method processes an attacker‑controlled PyTorch pickle payload, deserialization occurs by default, satisfying the conditions of CWE‑502 and allowing the execution of arbitrary code within the process that loads the layer.

Affected Systems

The affected product is Keras, released by the keras‑team, specifically version 3.15.0. No other releases are listed as impacted, indicating that only this exact release contains the unsafe deserialization path.

Risk and Exploitability

The CVSS score of 7.8 indicates high severity, while the EPSS score of less than 1% shows a very low current likelihood of exploitation. The vulnerability is not listed in CISA’s KEV catalog. Based on the description, it is inferred that an attacker could remotely supply a crafted layer configuration to a Keras application that calls from_config outside a SafeModeScope context, leading to arbitrary code execution on the host that processes the configuration.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Keras to a release that enforces safe deserialization in TorchModuleWrapper.from_config, such as a patch that requires explicit safe mode or removes unsafe torch.load calls.
  • Wrap any calls to from_config for untrusted layer configurations inside a SafeModeScope(True) context to guarantee safe deserialization.
  • Validate or whitelist all layer configuration inputs to ensure only trusted, non‑picklable data is passed to the wrapper.

Generated by OpenCVE AI on August 1, 2026 at 07:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-v2w2-w228-c444 Keras: TorchModuleWrapper can deserialize unsafe PyTorch pickle data
History
Type Values Removed Values Added
First Time appeared Keras-team
Keras-team keras
Vendors & Products Keras-team
Keras-team keras
Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

threat_severity

Important

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description 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.
Title Unsafe Deserialization in keras.layers.TorchModuleWrapper.from_config
Weaknesses CWE-502
References
Metrics cvssV3_0

{'score': 7.8, 'vector': 'CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-502

    Deserialization of Untrusted Data

Sources

Status
PUBLISHED
Assigner
@huntr_ai
Published
Updated
Jul 20, 2026, 1:45 PM
Reserved
Jun 17, 2026, 2:52 AM
Status
Awaiting Analysis
Published
Jul 19, 2026, 8:16 PM
Modified
Oct 24, 2026, 8:10 PM
Severity
Important
Public date
Jul 19, 2026, 7:47 PM