# CVE-2024-3660: Arbitrary code injection vulnerability in Keras framework < 2.13


- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 16 Apr 2024
- **Updated:** 13 Feb 2025
- **Also known as:** AZL-67629, DEBIAN-CVE-2024-3660, GHSA-x4wf-678h-2pmq, PYSEC-2026-369, UBUNTU-CVE-2024-3660

## What is CVE-2024-3660?

CVE-2024-3660 is a critical vulnerability in tensorflow keras, published on 16 Apr 2024. 

### Official description

A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary code with the same permissions as the application using a model that allow arbitrary code irrespective of the application.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2024-3660?

3 open source packages ship an affected version, including keras. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `keras` | PyPI | All versions | 2.13.1rc0 |
| `keras` | PyPI | All versions | 2.13.1rc0 |
| `keras` | PyPI | All versions | 2.13.1rc0 |

Products: Keras Keras.

## How do I fix CVE-2024-3660?

Upgrade keras to 2.13.1rc0 or later.

## Is CVE-2024-3660 being exploited?

There is no known exploitation of CVE-2024-3660 in the wild and no public exploit code.

Public exploit code:

- A PoC for CVE-2024-3660. Arbitrary Code Execution in Keras. (github_poc): https://github.com/aaryanbhujang/CVE-2024-3660-PoC

## Other vulnerabilities in tensorflow keras

- [CVE-2026-12481](https://insights.sbomify.com/CVE-2026-12481/): Deserialization of Untrusted Data in keras-team/keras (high 8.8)
- [CVE-2026-1462](https://insights.sbomify.com/CVE-2026-1462/): Safe Mode Bypass in keras-team/keras (high 8.8)
- [CVE-2025-9906](https://insights.sbomify.com/CVE-2025-9906/): Arbitrary Code execution in Keras Safe Mode (high 8.6)
- [CVE-2025-8747](https://insights.sbomify.com/CVE-2025-8747/): Keras safe_mode bypass allows arbitrary code execution when loading a malicious model. (high 8.6)
- [CVE-2026-11816](https://insights.sbomify.com/CVE-2026-11816/): Path Traversal in keras-team/keras (high 8.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-3660 and fix it if it is affected.

What it is: CVE-2024-3660 is a critical vulnerability in tensorflow keras, published on 16 Apr 2024. 
Exploitation: There is no known exploitation of CVE-2024-3660 in the wild and no public exploit code.

Affected packages and fixed versions:
- keras (PyPI): affected all versions; fixed in 2.13.1rc0
- keras (PyPI): affected all versions; fixed in 2.13.1rc0
- keras (PyPI): affected all versions; fixed in 2.13.1rc0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-3660/ (Markdown: https://insights.sbomify.com/CVE-2024-3660/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-3660
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-3660
- OSV: https://osv.dev/vulnerability/CVE-2024-3660

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-3660/
Summaries are generated and may contain mistakes; the official description above is the record.
