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.
This problem is fixed starting with version 3.9
.
Only load models from trusted sources and model archives created with Keras.
{ "nvd_published_at": null, "cwe_ids": [ "CWE-94" ], "severity": "HIGH", "github_reviewed": true, "github_reviewed_at": "2025-03-11T20:07:32Z" }