Severity by source
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Local because a victim must load the crafted model (AV:L, UI:R); no prior privileges needed (PR:N); deserialized code grants full host impact, so C/I/A all High.
Primary rating from Vendor (huntr_ai).
CVSS VectorVendor: huntr_ai
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Lifecycle Timeline
12Blast Radius
ecosystem impact- 7 pypi packages depend on keras (5 direct, 2 indirect)
Ecosystem-wide dependent count for version 3.13.2.
DescriptionCVE.org
A vulnerability in the TFSMLayer class of the keras package, version 3.13.0, allows attacker-controlled TensorFlow SavedModels to be loaded during deserialization of .keras models, even when safe_mode=True. This bypasses the security guarantees of safe_mode and enables arbitrary attacker-controlled code execution during model inference under the victim's privileges. The issue arises due to the unconditional loading of external SavedModels, serialization of attacker-controlled file paths, and the lack of validation in the from_config() method.
AnalysisAI
Arbitrary code execution in Keras 3.13.0 occurs because the TFSMLayer class unconditionally loads attacker-supplied TensorFlow SavedModels while deserializing a .keras model, even with safe_mode=True engaged. Any user who loads a malicious model triggers attacker-controlled code at inference time under their own privileges, defeating the protection safe_mode is supposed to provide. The flaw (CWE-502) has publicly available exploit code via huntr but is not in CISA KEV; EPSS is very low at 0.06% (19th percentile), consistent with the local, user-interaction-dependent attack path.
Technical ContextAI
Keras is a high-level deep-learning API (here the standalone keras-team/keras 3.x stack on TensorFlow) whose native .keras archive format supports layer reconstruction via from_config(). The TFSMLayer wraps a TensorFlow SavedModel directory so a saved Graph can be reused as a Keras layer. The root cause is a classic CWE-502 deserialization-of-untrusted-data flaw: from_config() serializes and trusts an attacker-controlled filesystem path and unconditionally loads the referenced external SavedModel, with no validation and no enforcement of the safe_mode gate that normally blocks Lambda/arbitrary-callable deserialization. Because a SavedModel can embed arbitrary TensorFlow ops/custom code that execute when the graph runs, loading the crafted model results in code execution during inference. CPE cpe:2.3:a:keras-team:keras-team/keras identifies the affected component as the keras-team Keras package specifically.
RemediationAI
Primary fix: upgrade Keras to 3.13.2 or later, which contains the upstream fix (commit b6773d3decaef1b05d8e794458e148cb362f163f); the EUVD affected range (<3.13.2) confirms 3.13.2 as the patched line. Red Hat users should apply the platform errata RHSA-2026:24977. Until patched, treat all .keras model files as untrusted code: do not load models from untrusted or unverified sources, and avoid relying on safe_mode=True as a security boundary since this flaw bypasses it. As compensating controls, load untrusted models only inside a sandboxed/isolated environment (container with no network egress and least-privilege filesystem access) so any executed payload is contained - at the cost of added pipeline complexity; and where feasible avoid using TFSMLayer to wrap externally-supplied SavedModels, and validate the provenance/integrity (signing/hashes) of model artifacts before deserialization. Advisory and patch URLs: https://github.com/keras-team/keras/commit/b6773d3decaef1b05d8e794458e148cb362f163f and https://access.redhat.com/errata/RHSA-2026:24977.
More in Keras Team Keras
View allArbitrary code execution in keras-team/keras 3.14.0 lets remote attackers run OS-level commands by supplying a malicious
Local HDF5 file content disclosure in keras-team/keras versions 3.14.0 and earlier allows an attacker who can deliver a
Symlink entries in malicious tar archives bypass the `filter_safe_tarinfos` validation in Keras 3.12.0, enabling directo
Path traversal in Keras 3.14.0 exposes local file systems to arbitrary file and directory creation when processing malic
Unbounded memory allocation in Keras (keras-team/keras) versions ≤ 3.15.0 allows an attacker who can supply a crafted .k
Same weakness CWE-502 – Deserialization of Untrusted Data
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-21970
GHSA-4f3f-g24h-fr8m