CVE-2026-12482: Keras path traversal via symlink in filter_safe_tarinfos

CVE-2026-12482 · Severity: low · CVSS 3.1 · Published 2026-07-14

Keras, a popular deep learning library, contains a vulnerability in how it handles compressed archive files. An attacker could provide a specially crafted archive that, when extracted, creates symbolic links pointing to locations outside the intended folder. This could allow an attacker to overwrite sensitive files or gain unauthorized access to data on the system running the Keras code.

Technologies: keras (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-12482 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-12482 being exploited in the wild.
How severe is CVE-2026-12482?
Low severity, with a CVSS score of 3.1, published 14 July 2026.
Which products and versions are affected?
keras (PyPI) ECOSYSTEM:introduced=0,fixed=3.12.3, ECOSYSTEM:introduced=0,fixed=3.12.3,introduced=3.13.0,fixed=3.15.0.
Is there a fix for CVE-2026-12482?
Yes. keras (PyPI): upgrade to 3.12.3, 3.15.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-12482 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-12482?
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.3, 3.15.0 or later
    pip install "keras>=3.15.0"

Technical details

A path traversal vulnerability exists in `keras/src/utils/file_utils.py` due to improper validation of symbolic links during tar archive extraction. The `filter_safe_tarinfos` function and its underlying `resolve_path` utility used `os.path.abspath` before `os.path.realpath`. Because `abspath` collapses '..' segments lexically before symlinks are resolved, a path like 'link/../file' could bypass the `is_path_in_dir` containment check if 'link' is a symlink. An attacker can exploit this by crafting a tar archive containing a symlink and a subsequent file entry that resolves through that symlink to a location outside the extraction directory. This is particularly critical on Python 3.10 and 3.11 where Keras's filter is the primary defense. The issue is fixed in versions 3.12.3 and 3.15.0 by ensuring `realpath` is used directly to resolve symlinks before path normalization.

Affected products

  • keras-team Keras 3.12.0, >= 3.13.0, < 3.15.0

Identifiers

  • CVE-2026-12482
  • GHSA-58hv-7753-xmfq
  • PYSEC-2026-3630

Timeline

  • 2026-06-01: patched: Initial fix submitted via PR 23015
  • 2026-06-25: patched: Security release 3.12.3 merged
  • 2026-07-14: disclosed: CVE-2026-12482 published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.