VDB
KO
CRITICAL 9.8

PYSEC-2025-122

Details

The Keras Model.load_model function permits arbitrary code execution, even with safe_mode=True, through a manually constructed, malicious .keras archive. By altering the config.json file within the archive, an attacker can specify arbitrary Python modules and functions, along with their arguments, to be loaded and executed during model loading.

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI / keras
Introduced in: 3.0.0 Fixed in: 3.8.0
Fix pip install --upgrade 'keras>=3.8.0'

References