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.
{
"cwe_ids": [
"CWE-94"
],
"github_reviewed_at": "2025-03-11T20:07:32Z",
"nvd_published_at": null,
"severity": "HIGH",
"github_reviewed": true
}