# Keras keras.utils.get_file path traversal in TAR extraction

Source: https://junglewise.ai/threats/keras-keras-utils-get-file-path-traversal-in-tar-extraction-d88c39fb  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2025-10-30. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 4 · Published 2025-10-30

Keras is a machine learning library that provides a utility function (keras.utils.get_file) for downloading and extracting datasets. When extracting TAR archives with the extract option enabled, the function is vulnerable to path traversal attacks that allow malicious archives to write files outside the intended extraction directory, potentially compromising the integrity of the system and enabling attackers to overwrite critical files.

Technologies: [keras (PyPI)](https://junglewise.ai/threats/technologies/keras). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 4, published 30 October 2025.

**Which products and versions are affected?** keras (PyPI) ECOSYSTEM:introduced=0,fixed=3.12.0.

**Is there a fix for This vulnerability?** Yes. keras (PyPI): upgrade to 3.12.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run keras (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- keras (PyPI): upgrade to 3.12.0 or later

  ```sh
  pip install "keras>=3.12.0"
  ```


## Technical details

The vulnerability exists in Keras's extract_archive() function in keras/src/utils/file_utils.py, which uses Python's tarfile.extractall() method without the security-critical filter="data" parameter. While Keras implements filter_safe_paths() to validate tar member paths, this filtering occurs during member parsing, before extraction. However, a PATH_MAX symlink resolution bug in Python's tarfile module triggers during actual file system operations, causing excessively long symlink paths to fail resolution and be interpreted literally, bypassing the path filter. This allows attackers to craft malicious tar archives with carefully constructed symlink chains that exploit the PATH_MAX resolution issue to write files to arbitrary locations outside the intended extraction directory. The vulnerability affects all Keras versions prior to 3.12.0 and requires the attacker to provide a malicious tar archive that will be processed with extract=True.

## Affected products

- Keras Team Keras <3.12.0

## Timeline

- 2025-10-30: disclosed
- 2025-12-02: patched: Keras 3.12.0 fixes the vulnerability
- 2025-12-02: other: Advisory GHSA-28jp-44vh-q42h withdrawn as duplicate of GHSA-hjqc-jx6g-rwp9

## References

- [https://github.com/keras-team/keras/security/advisories/GHSA-hjqc-jx6g-rwp9](https://github.com/keras-team/keras/security/advisories/GHSA-hjqc-jx6g-rwp9)

## Related threats

- [Keras model loading denial of service via HDF5 shape bombs](https://junglewise.ai/threats/cve-2026-12570-keras-model-loading-denial-of-service-via-hdf5-shape-bombs)
- [Keras HDF5 arbitrary file disclosure via ExternalLinks](https://junglewise.ai/threats/cve-2026-9335-keras-hdf5-arbitrary-file-disclosure-via-externallinks)
- [Keras unsafe deserialization in TorchModuleWrapper](https://junglewise.ai/threats/cve-2026-12484-keras-unsafe-deserialization-in-torchmodulewrapper)
- [Keras path traversal via symlink in filter_safe_tarinfos](https://junglewise.ai/threats/cve-2026-12482-keras-path-traversal-via-symlink-in-filter-safe-tarinfos)
- [Keras Team Keras arbitrary code execution in Lambda layer](https://junglewise.ai/threats/cve-2026-12481-keras-team-keras-arbitrary-code-execution-in-lambda-layer)
