The Keras `Model.load_model` method **silently** ignores `safe_mode=True` and allows arbitrary code execution when a `.h5`/`.hdf5` file is l
CVE-2025-9905 · GHSA-36rr-ww3j-vrjv · published 2025-09-19 · updated 2026-06-06
- Severity
- High
- CVSS score
- 8.7
- Chance of exploitation (EPSS)
- 0.22%
- Fixed in
- 3.11.3
- Exploitation No known exploitation
- Automatable No
- Technical impact Total
- CISA SSVC
Note: This report has already been discussed with the Google OSS VRP team, who recommended that I reach out directly to the Keras team. I’ve chosen to do so privately rather than opening a public issue, due to the potential security implications. I also attempted to use the email address listed in your SECURITY.md, but received no response.
Upgrade keras to 3.11.3 or later.
Since the release of the new .keras format, I believe the simplest and most effective way to address this misleading behavior—and to improve security in Keras—is to have the safe_mode parameter raise an explicit error when safe_mode=True is used with .h5/.hdf5 files. This error should be clear and informative, explaining that the legacy format does not support safe_mode and outlining the associated risks of loading such files. I recognize this fix may have minor backward compatibility considerations. If you confirm that you're open to this approach, I’d be happy to open a PR that includes the missing check.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| keras | PyPI | >= 3.0.0, < 3.11.3 | 3.11.3 |
- CriticalLiteLLM has SQL Injection in Proxy API key verificationlitellmExploited
- Criticaln8n Vulnerable to Remote Code Execution via Expression Injectionn8n, n8nExploited
- HighLiteLLM has a sandbox escape in custom-code guardraillitellmExploited
- HighLangflow affected by Remote Code Execution via validate_code() exec()langflowExploited
- CriticalJupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routesjupyter-mcp-server
- Criticalmem0ai Databricks vector store vulnerable to SQL injectionmem0ai
- CriticalKeras framework vulnerable to deserialization of untrusted datakeras
- CriticalKeras code injection vulnerabilitykeras
- HighKeras: TorchModuleWrapper can deserialize unsafe PyTorch pickle datakeras, keras
- HighKeras: Lambda deserialization can bypass safe mode and execute codekeras, keras
- HighKeras archive extraction utilities allow path traversal and arbitrary file writeskeras
- HighKeras vulnerable to DoS via Malicious .keras Model (HDF5 Shape Bomb Causes Petabyte Allocation in KerasFileEditor)keras, keras
The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.