# CVE-2025-12060: Keras keras.utils.get_file Utility Path Traversal Vulnerability

> Remote attackers can write arbitrary files to the filesystem via malicious tar archives in Keras get_file utility when extract option is enabled.

- **Severity:** High 8.9 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 30 Oct 2025
- **Updated:** 26 Feb 2026
- **Also known as:** AZL-69472, CLSA-2026-1787149068, DEBIAN-CVE-2025-12060, GHSA-hjqc-jx6g-rwp9, MINI-5g32-8rrh-h62w, PYSEC-2026-1486, UBUNTU-CVE-2025-12060

## What is CVE-2025-12060?

CVE-2025-12060 is a high-severity path traversal vulnerability in Keras, published on 30 Oct 2025. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

The keras.utils.get_file API in Keras, when used with the extract=True option for tar archives, is vulnerable to a path traversal attack. The utility uses Python's tarfile.extractall function without the filter="data" feature. A remote attacker can craft a malicious tar archive containing special symlinks, which, when extracted, allows them to write arbitrary files to any location on the filesystem outside of the intended destination folder. This vulnerability is linked to the underlying Python tarfile weakness, identified as CVE-2025-4517. Note that upgrading Python to one of the versions that fix CVE-2025-4517 (e.g. Python 3.13.4) is not enough. One additionally needs to upgrade Keras to a version with the fix (Keras 3.12).

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2025-12060?

3 open source packages ship an affected version, including keras.


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

## How do I fix CVE-2025-12060?

Upgrade keras to 3.12.0 or later.

## Is CVE-2025-12060 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-12060 and fix it if it is affected.

What it is: CVE-2025-12060 is a high-severity path traversal vulnerability in Keras, published on 30 Oct 2025. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2025-12060 in the wild and no public exploit code.

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

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-2025-12060/ (Markdown: https://insights.sbomify.com/CVE-2025-12060/index.md)
```

## Sources

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

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