Keras
CVE-2025-12060
HIGH
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessHost malicious tar archive with crafted symlinks
-
DeliveryVictim app calls get_file(extract=True)
-
ExploitSymlink/PATH_MAX quirk bypasses path filter
-
ExecutionWrite arbitrary file outside target dir
-
ImpactOverwrite startup/module file for code execution
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK
2 techniques across 2 tactics: Discovery, Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires a victim application to call keras.utils.get_file() with the non-default extract=True option on a tar archive whose source or contents are attacker-controlled; plain (non-extracted) downloads and zip archives via the same API are not the vector described. The bypass further depends on the underlying Python tarfile PATH_MAX symlink-resolution behavior (CVE-2025-4517), so it needs sufficiently long/crafted symlink paths to make failed resolution fall back to literal traversal paths. Limiting factors that reduce real-world risk: the victim must initiate the fetch/extraction of an attacker-influenced archive (user interaction), the target must still run Keras <= 3.11.3 (upgrading Python alone does NOT remediate - Keras 3.12.0 is required), and deployments that only extract trusted vendor datasets/models are not practically exposed. |
| Impact | The vendor CVSS 4.0 base score of 8.9 (AV:N/AC:L/AT:P/PR:L/UI:P) looks severe at first glance, but several signals temper the real-world urgency. The network vector (AV:N) reflects that the malicious tar is fetched remotely, yet exploitation is gated by two conditions the attacker does not fully control: a victim application must call keras.utils.get_file() with extract=True against attacker-influenced content (UI:P), and the bypass depends on the Python tarfile PATH_MAX symlink-resolution quirk inherited from CVE-2025-4517 (AT:P). No CISA KEV listing is present, so this is NOT confirmed actively exploited; no EPSS score was supplied, so widespread-exploitation probability cannot be quantified from the input. However, publicly available exploit code exists - the GHSA advisory (GHSA-hjqc-jx6g-rwp9) includes a Proof of Concept section with working code - which raises the practical risk above a theoretical path-traversal. Signals conflict on access: the vendor vector encodes PR:L (implying some privilege/authentication), but the actual gate is victim interaction plus an attacker-controlled archive, not authentication to the target - treat the 'authenticated' implication of PR:L with caution and verify against your deployment. No SSVC decision data (exploitation/automatable/technical-impact) was provided. Net: a genuine, high-impact arbitrary-file-write-to-RCE risk for ML pipelines that download and extract untrusted or user-supplied tar archives, but materially lower risk for deployments that only fetch from trusted, vendor-controlled sources. |
| Exploit ScenarioDerived | An attacker hosts a specially crafted tar archive containing long-path symlinks and induces a victim ML application to retrieve it via keras.utils.get_file(url, extract=True). During extraction, tarfile.extractall() runs without filter="data" and the PATH_MAX symlink-resolution bug causes a traversal path to be written literally, placing attacker files (e.g. a malicious Python module, cron entry, or SSH authorized_keys) outside the intended directory and enabling code execution. A working Proof of Concept is published in the GHSA advisory; because the trigger relies on a normal library call and a symlink quirk, exploitation is realistic but requires the victim to extract attacker-controlled content. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 19, 2026
Directory traversal in Keras through 3.11.3 allows an attacker who supplies a crafted tar archive to keras.utils.get_file(..., extract=True) to write files outside the intended extraction directory, including via symlink-based traversal that bypasses Keras's existing path filter. The issue is tied to Python tarfile's PATH_MAX symlink-resolution behavior (CVE-2025-4517) and to Keras calling tarfile.extractall without filter='data'; upgrading Python alone does not remediate it. Publicly available exploit code exists (a proof-of-concept is included in the GitHub advisory), exploitation requires the victim application to fetch and extract an attacker-influenced tar archive, and no CISA KEV entry is available.
RemediationAI
Upgrade Keras to 3.12.0 or later; this is required even if Python has already been updated for CVE-2025-4517 (for example, Python 3.13.4). Vendor advisories and the fix are at https://github.com/keras-team/keras/security/advisories/GHSA-hjqc-jx6g-rwp9 and https://github.com/keras-team/keras/pull/21760. If upgrading immediately is not possible, do not call keras.utils.get_file with extract=True on tar archives from untrusted or attacker-influenced sources; instead download and inspect or extract archives with an external tool that enforces filter='data' on Python 3.12 or later, and restrict extraction to a sandboxed directory with minimal filesystem permissions. These workarounds reduce exposure but do not fix the in-process Keras code path, and they trade automation convenience for manual archive handling.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerability is a CWE-22 path traversal in Keras's archive-handling utilities, specifically keras.utils.get_file with the non-default extract=True option for tar archives. Keras previously enumerated archive members with filter_safe_paths() but still invoked Python's tarfile.extractall without the security-critical filter='data' option introduced in Python 3.12. During extraction, tarfile's symlink resolution can fail when crafted paths exceed PATH_MAX, causing the symlink to be interpreted as a literal path; this allows archive members to escape the destination directory despite the pre-filter. The same underlying Python defect is tracked as CVE-2025-4517. Zip archives and plain, non-extracted downloads through the same API are not the described vector. The upstream fix replaces direct extractall calls with extract_open_archive(), applies filter='data' on Python 3.12 through 3.13, and adds tar and zip member filtering.
Know when Keras gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
Victim must extract an attacker-supplied tar via get_file(extract=True) (UI:R) and the PATH_MAX symlink quirk raises complexity (AC:H); no target privileges (PR:N), arbitrary write escapes the extraction dir (S:C) enabling code execution (C/I/A:H).
Primary rating from Vendor (google).
CVSS VectorVendor: google
DescriptionCVE.org
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).
Blast Radius
ecosystem impact- 3 pypi packages depend on keras (3 direct, 0 indirect)
Ecosystem-wide dependent count for version 3.12.0.
Executive ViewAI
Keras, a widely used open-source machine learning library embedded in many internal data-science and model-training pipelines, has a high-severity file-write vulnerability in versions through 3.11.3 that can let an attacker plant or overwrite files on systems that download and unpack model or dataset archives. Any team that uses Keras to fetch third-party archives is exposed, which raises supply-chain and data-integrity concerns beyond a single application. Leadership should care because the flaw has publicly available exploit code and no vendor patch yet, so exposure persists until engineering changes how archives are handled.
No vendor-released patch identified at time of analysis. Interim mitigations: avoid keras.utils.get_file(..., extract=True) on untrusted tar archives; pre-validate archive members and reject absolute paths, traversal sequences, and symlinks/hardlinks that resolve outside the destination; perform extraction in a sandboxed, low-privilege container with read-only mounts and no access to sensitive paths; restrict outbound fetches to allowlisted, hash-verified sources; monitor for unexpected file creation outside extraction directories.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. Rated
Deserialization of untrusted data in Keras 3.11.0 through 3.11.2 allows remote code execution when a victim loads a mali
A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary c
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. Rated
Path traversal in Keras archive extraction utilities prior to version 3.14.0 allows remote attackers to write files outs
Memory-exhaustion denial of service in Google Keras 3.0.0 through 3.13.0 lets a remote attacker crash the Python interpr
Arbitrary local file disclosure in Keras 3.0.0 through 3.13.1 allows a remote attacker to read sensitive files from a vi
Keras Model.load_model fails to enforce safe_mode=True for the StringLookup layer's vocabulary path handling, so a malic
A safe mode bypass vulnerability in the `Model.load_model` method in Keras versions 3.0.0 through 3.10.0 allows an attac
An issue in keras 3.7.0 allows attackers to write arbitrary files to the user's machine via downloading a crafted tar fi
NVD
CVE.org
EPSS
GitHub
Exploit-DB