# CVE-2025-1550: Keras arbitrary code execution in Model.load_model

Source: https://junglewise.ai/threats/cve-2025-1550-keras-arbitrary-code-execution-in-model-load-model  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2025-03-11. Updated: 2026-06-06  
License: CC BY 4.0 with a link back

CVE-2025-1550 · Severity: high · CVSS 4 · Published 2025-03-11

Keras, a popular deep learning library, contains a vulnerability that allows malicious code to run when a specially crafted model file is loaded. Even when using the library's 'safe mode,' an attacker can hide malicious commands inside the model's configuration file. If a user or automated system loads a compromised model, an attacker could gain full control over the system, potentially leading to data theft or service disruption.

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

## Quick answers

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

**How severe is CVE-2025-1550?** High severity, with a CVSS score of 4, published 11 March 2025.

**Which products and versions are affected?** keras (PyPI) >= 3.0.0, < 3.9.0, ECOSYSTEM:introduced=3.0.0,fixed=3.8.0, ECOSYSTEM:introduced=3.0.0,fixed=3.9.0.

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

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

**Am I affected by CVE-2025-1550?** 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.8.0, 3.9.0 or later

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


## Technical details

A code injection vulnerability exists in the Keras `Model.load_model` function. The root cause is improper validation of the `config.json` file within the `.keras` archive format, which allows an attacker to specify arbitrary Python modules and functions to be executed during the deserialization process. This bypasses the intended protections of `safe_mode=True`. An attacker must provide a maliciously crafted model file to a victim; when the victim loads this model locally, the attacker's code executes with the privileges of the running process. The issue is resolved in Keras version 3.9.0 by improving the safety of the model loading mechanism.

## Affected products

- Keras Team Keras >= 3.0.0, < 3.9.0

## Identifiers

- CVE-2025-1550
- GHSA-48g7-3x6r-xfhp
- PYSEC-2025-122

## Timeline

- 2025-03-11: disclosed
- 2025-03-11: advisory
- 2025-03-11: patched: Fixed in version 3.9.0

## References

- [https://api.github.com/users/io-no](https://api.github.com/users/io-no)
- [https://github.com/io-no](https://github.com/io-no)
- [https://api.github.com/users/io-no/gists%7B/gist_id%7D](https://api.github.com/users/io-no/gists%7B/gist_id%7D)
- [https://api.github.com/users/io-no/repos](https://api.github.com/users/io-no/repos)
- [https://avatars.githubusercontent.com/u/58036457?v=4](https://avatars.githubusercontent.com/u/58036457?v=4)
- [https://api.github.com/users/io-no/events%7B/privacy%7D](https://api.github.com/users/io-no/events%7B/privacy%7D)

## 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)
