Python 3.12+ Tarfile Filter CVE-2024-12718: External Metadata Modification
CVE-2024-12718 Published on June 3, 2025
Bypass extraction filter to modify file metadata outside extraction directory
Allows modifying some file metadata (e.g. last modified) with filter="data" or file permissions (chmod) with filter="tar" of files outside the extraction directory.
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. Only Python versions 3.12 or later are affected by these vulnerabilities, earlier versions don't include the extraction filter feature.
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-2024-12718 is exploitable with network access, and does not require authorization privileges or user interaction. This vulnerability is considered to have a low attack complexity. An automatable proof of concept (POC) exploit exists. The potential impact of an exploit of this vulnerability is considered to have no impact on confidentiality, with no impact on integrity, and no 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-2024-12718 has been classified to as a Directory traversal vulnerability or weakness.
Products Associated with CVE-2024-12718
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.