Nixpkgs Security Tracker

Login with GitHub

Details of issue NIXPKGS-2025-0003

NIXPKGS-2025-0003
published on 30 Oct 2025
updated 2 months, 3 weeks ago by @LeSuisse Activity log
  • Created automatic suggestion
  • @Erethon dismissed
  • @Erethon marked as untriaged
  • @LeSuisse removed package python312Packages.tf-keras
  • @balsoft added package python312Packages.tf-keras
  • @balsoft dismissed
  • @LeSuisse accepted as draft
  • @LeSuisse removed package python312Packages.tf-keras
  • @LeSuisse published on GitHub
Arbitary Code execution in Keras load_model()

The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. One can create a specially crafted .h5/.hdf5 model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special .h5 archive file that uses the Lambda layer feature of keras which allows arbitrary Python code in the form of pickled code. The vulnerability comes from the fact that the safe_mode=True option is not honored when reading .h5 archives. Note that the .h5/.hdf5 format is a legacy format supported by Keras 3 for backwards compatibility.

Affected products

keras
  • =<3.11.2

Matching in nixpkgs

pkgs.python312Packages.keras

Multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch

Package maintainers: 1