CVE-2025-4517 Arbitrary writes via tarfile realpath overflow

Critical 9.4 Published Updated

Attackers can write arbitrary files outside the extraction directory when extracting untrusted tar archives using specific filters in Python's tarfile module.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-4517?

CVE-2025-4517 is a critical path traversal vulnerability in CPython, published on 3 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Allows arbitrary filesystem writes outside the extraction directory during extraction with filter="data".

You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile extraction filters documentation https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter  for more information.

Note that for Python 3.14 or later the default value of filter= changed from "no filtering" to `"data", so if you are relying on this new default behavior then your usage is also affected.

Note that none of these vulnerabilities significantly affect the installation of source distributions which are tar archives as source distributions already allow arbitrary code execution during the build process. However when evaluating source distributions it's important to avoid installing source distributions with suspicious links.

Weakness: CWE-22

Which versions are affected by CVE-2025-4517?

3 open source packages ship an affected version, including libpython, python and python-min.

PackageAffectedFixed in
libpython BitnamiAll versions3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4
python BitnamiAll versions3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4
python-min BitnamiAll versions3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4

How do I fix CVE-2025-4517?

Upgrade libpython to a fixed version for your release line: 3.9.23, 3.10.18, 3.11.13 or 3.12.11.

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

Is CVE-2025-4517 being exploited?

There is no known exploitation of CVE-2025-4517 in the wild and no public exploit code.

Public exploit code: 8 proofs of concept on GitHub.

Sources

Also known as ALPINE-CVE-2025-4517, AZL-62307, AZL-62318, BELL-CVE-2025-4517, BIT-libpython-2025-4517, BIT-python-2025-4517 and 12 more.

Is CVE-2025-4517 in your software?

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

Check your SBOMs for free