CVE-2025-12638
JSON

8.0high

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

Severity
8.0high CVSS:3.0 by @huntr_ai
Exploit likelihood
0.71% (higher than 54% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
@huntr_ai
Also known as
GHSA-9g7v-8wxv-mwxp

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.

Affected

Product or packageVersionsReported by
keras-team keras-team/kerasfrom unspecified up to latestCVE List
keras (PyPI)before 3.12.0GitHub Advisory Database

All scores

@huntr_ai8.0high CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
GitHub8.0high CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-22

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database
Duplicate Advisory

This advisory has been withdrawn because it is a duplicate of GHSA-hjqc-jx6g-rwp9. This link is maintained to preserve external references.

Original 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.

NVD (es)

La versión 3.11.3 de Keras está afectada por una vulnerabilidad de salto de ruta en la función keras.utils.get_file() al extraer archivos tar. La vulnerabilidad surge porque la función utiliza el método tarfile.extractall() de Python sin el parámetro crítico de seguridad filter='data'. Aunque Keras intenta filtrar rutas inseguras utilizando filter_safe_paths(), este filtrado ocurre antes de la extracción, y un error de resolución de enlaces simbólicos PATH_MAX se activa durante la extracción. Este error provoca que la resolución de enlaces simbólicos falle debido a los límites de longitud de ruta, lo que resulta en una omisión de seguridad que permite que los archivos se escriban fuera del directorio de extracción previsto. Esto puede conducir a escrituras de archivos arbitrarias fuera del directorio de caché, lo que permite un posible compromiso del sistema o la ejecución de código malicioso. La vulnerabilidad afecta a las instalaciones de Keras que procesan archivos tar con get_file() y no afecta a las versiones donde este método de extracción está asegurado con el parámetro de filtro apropiado.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-12638 changed 2025-11-28CVE Terms of Use
GitHub Advisory DatabaseGHSA-9g7v-8wxv-mwxp changed 2026-09-10CC-BY-4.0
NVDCVE-2025-12638 changed 2026-10-19Public domain