CVE-2025-12638 Path Traversal Vulnerability in keras-team/keras via Tar Archive Extraction in keras.utils.get_file()

High 8.0 Published Updated

Attackers can write arbitrary files outside the cache directory via path traversal in Keras get_file(), potentially leading to code execution.

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

What is CVE-2025-12638?

CVE-2025-12638 is a high-severity path traversal vulnerability in keras-team/keras, published on 28 Nov 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

Keras version 3.11.3 is affected by a path traversal vulnerability in the keras.utils.get_file() function when extracting tar archives. The vulnerability arises because the function uses Python's tarfile.extractall() method without the security-critical filter='data' parameter. Although Keras attempts to filter unsafe paths using filter_safe_paths(), this filtering occurs before extraction, and a PATH_MAX symlink resolution bug triggers during extraction. This bug causes symlink resolution to fail due to path length limits, resulting in a security bypass that allows files to be written outside the intended extraction directory. This can lead to arbitrary file writes outside the cache directory, enabling potential system compromise or malicious code execution. The vulnerability affects Keras installations that process tar archives with get_file() and does not affect versions where this extraction method is secured with the appropriate filter parameter.

Weakness: CWE-22

Which versions are affected by CVE-2025-12638?

How do I fix CVE-2025-12638?

Apply the vendor's patch.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2025-12638 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-12638 exists.

Sources

Also known as AZL-71185, DEBIAN-CVE-2025-12638, UBUNTU-CVE-2025-12638.

Is CVE-2025-12638 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free