Python tarfile Arbitrary FS Write via filter='data' (pre-3.14) CVE-2025-4517
CVE-2025-4517 Published on June 3, 2025
Arbitrary writes via tarfile realpath overflow
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.
Vulnerability Analysis
CVE-2025-4517 can be exploited with network access, and does not require authorization privileges or user interaction. This vulnerability is considered to have a low attack complexity. The potential impact of an exploit of this vulnerability is considered to have a high impact on confidentiality and integrity, and a small impact on availability.
Weakness Type
What is a Directory traversal Vulnerability?
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
CVE-2025-4517 has been classified to as a Directory traversal vulnerability or weakness.
Products Associated with CVE-2025-4517
stack.watch emails you whenever new vulnerabilities are published in Python or Oracle. Just hit a watch button to start following.
Affected Versions
Python Software Foundation CPython:- Before 3.9.23 is affected.
- Version 3.10.0 and below 3.10.18 is affected.
- Version 3.11.0 and below 3.11.13 is affected.
- Version 3.12.0 and below 3.12.11 is affected.
- Version 3.13.0 and below 3.13.4 is affected.
- Version 3.14.0a1 and below 3.14.0b3 is affected.
Exploit Probability
EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.