# CVE-2026-1462: Keras TFSMLayer arbitrary code execution via safe_mode bypass

Source: https://junglewise.ai/threats/cve-2026-1462-keras-tfsmlayer-arbitrary-code-execution-via-safe-mode-bypass  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-13. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-1462 · Severity: high · CVSS 8.8 · Published 2026-04-13

A security flaw has been identified in Keras, a widely used artificial intelligence library. This vulnerability allows a malicious actor to hide harmful code inside a machine learning model file. If a user loads this file, the hidden code will automatically run on their computer, potentially allowing the attacker to steal data or take control of the system, even if the user has enabled security protections like 'safe mode'.

Technologies: [keras (PyPI)](https://junglewise.ai/threats/technologies/keras). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-1462 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-1462 being exploited in the wild.

**How severe is CVE-2026-1462?** High severity, with a CVSS score of 8.8, published 13 April 2026.

**Which products and versions are affected?** keras (PyPI) < 3.13.2, ECOSYSTEM:introduced=0,fixed=3.13.2.

**Is there a fix for CVE-2026-1462?** Yes. keras (PyPI): upgrade to 3.13.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-1462 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-1462?** Check whether you run keras (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- keras (PyPI): upgrade to 3.13.2 or later

  ```sh
  pip install "keras>=3.13.2"
  ```


## Technical details

A deserialization vulnerability exists in the `TFSMLayer` class of the Keras package (specifically version 3.13.0). The root cause is the unconditional loading of external TensorFlow SavedModels during the deserialization of `.keras` files, which bypasses the `safe_mode=True` security setting. The `from_config()` method fails to validate attacker-controlled file paths, allowing the execution of arbitrary code embedded within a malicious SavedModel during inference. Attackers can exploit this by tricking a user into loading a crafted model file. The issue has been addressed in Keras version 3.13.2 by implementing safe mode checks in the `TFSMLayer.from_config()` method.

## Affected products

- Keras Team Keras 3.13.0, < 3.13.2
- Red Hat OpenShift AI 2.25

## Identifiers

- CVE-2026-1462
- GHSA-4f3f-g24h-fr8m
- PYSEC-2026-2547

## Timeline

- 2026-04-13: disclosed
- 2026-04-13: advisory: NVD and Red Hat published advisories
- 2026-06-10: patched: Red Hat released fixed images for OpenShift AI 2.25.7

## References

- [https://github.com/keras-team/keras/commit/b6773d3decaef1b05d8e794458e148cb362f163f](https://github.com/keras-team/keras/commit/b6773d3decaef1b05d8e794458e148cb362f163f)
- [https://huntr.com/bounties/7e78d6f1-6977-4300-b595-e81bdbda331c](https://huntr.com/bounties/7e78d6f1-6977-4300-b595-e81bdbda331c)
- [https://access.redhat.com/errata/RHSA-2026:24977](https://access.redhat.com/errata/RHSA-2026:24977)
- [https://access.redhat.com/security/cve/CVE-2026-1462](https://access.redhat.com/security/cve/CVE-2026-1462)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2457856](https://bugzilla.redhat.com/show_bug.cgi?id=2457856)
- [https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-1462.json](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-1462.json)

## Related threats

- [Keras model loading denial of service via HDF5 shape bombs](https://junglewise.ai/threats/cve-2026-12570-keras-model-loading-denial-of-service-via-hdf5-shape-bombs)
- [Keras HDF5 arbitrary file disclosure via ExternalLinks](https://junglewise.ai/threats/cve-2026-9335-keras-hdf5-arbitrary-file-disclosure-via-externallinks)
- [Keras unsafe deserialization in TorchModuleWrapper](https://junglewise.ai/threats/cve-2026-12484-keras-unsafe-deserialization-in-torchmodulewrapper)
- [Keras path traversal via symlink in filter_safe_tarinfos](https://junglewise.ai/threats/cve-2026-12482-keras-path-traversal-via-symlink-in-filter-safe-tarinfos)
- [Keras Team Keras arbitrary code execution in Lambda layer](https://junglewise.ai/threats/cve-2026-12481-keras-team-keras-arbitrary-code-execution-in-lambda-layer)
