CVE-2025-1550·Python vulnerability
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.
- Severity
- critical
- Software
- Python
- Fixed in
- 3.8.0
- Published
- 2025-03-11
Affected versions
From: 3.0.0
Until: 3.8.0
Fixed in: 3.8.0
How to fix this CVE
Update Python and Keras to version 3.8.0 or later to patch the arbitrary code execution vulnerability in the Model.load_model function. The vulnerability allows attackers to execute malicious code by crafting a .keras archive with a tampered config.json file, bypassing safe_mode protections. Immediately review and restrict access to model loading operations in your infrastructure.
sudo dnf update python3 python3-kerasDefensia detects this vulnerability
How to check if you are affected
- Check the installed Keras version: python3 -c "import keras; print(keras.__version__)"
- Verify if Keras is in use: grep -r "from keras" /path/to/your/application/ /path/to/venv/
- Search for suspicious model loading calls in application logs: grep -i "model.load_model\|load_model" /var/log/application.log
- Confirm the patch by running: python3 -c "import keras; print('3.8.0+' if tuple(map(int, keras.__version__.split('.')[:2])) >= (3, 8) else 'Vulnerable')" and verify output shows 3.8.0 or higher
FAQ
What is CVE-2025-1550?
CVE-2025-1550 is a critical remote code execution vulnerability in Keras' Model.load_model function that allows attackers to execute arbitrary Python code by crafting a malicious .keras archive file, even when safe_mode is enabled. The vulnerability exploits config.json manipulation within the archive to load and execute attacker-controlled modules and functions.
Is CVE-2025-1550 being actively exploited?
While not listed in the CISA KEV catalog, public exploits are available on Exploit-DB (ID 52359), making active exploitation a realistic threat. Organizations should prioritize patching immediately.
What versions of Python/Keras are affected by CVE-2025-1550?
Keras versions 3.0.0 through 3.8.0 are vulnerable. The fix is available in Keras 3.8.0 and later. All Python versions using affected Keras releases are at risk.
How do I check if my server is vulnerable to CVE-2025-1550?
Run `python3 -c "import keras; v = tuple(map(int, keras.__version__.split('.')[:2])); print('VULNERABLE' if (3, 0) <= v <= (3, 7) else 'PATCHED')"` to determine vulnerability status.
Does Defensia detect CVE-2025-1550?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Keras is installed on a monitored server, CVE-2025-1550 will appear in your dashboard with remediation steps.
Related Python CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2025-1550. Free for 1 server.
Get started free