CVE-2024-12718: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in Python Software Foundation CPython
CVE-2024-12718 is a path traversal vulnerability in the Python tarfile module affecting Python versions 3.12 and later. It allows modification of file metadata or permissions outside the intended extraction directory when using the extractall() or extract() methods with the filter parameter set to "data" or "tar". The default filter changed to "data" starting in Python 3.14, increasing the risk if relying on default behavior. This vulnerability does not significantly impact source distribution installations, which already permit arbitrary code execution during builds.
AI Analysis
Technical Summary
This vulnerability in CPython's tarfile module (CVE-2024-12718) involves improper limitation of pathnames (CWE-22) during extraction of tar archives. When using TarFile.extractall() or TarFile.extract() with the filter parameter set to "data" or "tar", an attacker can modify file metadata such as last modified timestamps or file permissions (chmod) on files outside the extraction directory. This affects Python versions 3.12 and later, as earlier versions do not support the extraction filter feature. Additionally, from Python 3.14 onward, the default filter value changed to "data", meaning that code relying on default filtering is also affected. The vulnerability does not significantly affect source distribution installations, which inherently allow arbitrary code execution during build processes.
Potential Impact
An attacker providing a crafted tar archive can cause modification of file metadata or permissions outside the intended extraction directory when the vulnerable extraction filters are used. This can lead to unauthorized changes to files on the system, potentially impacting system integrity. There is no direct confidentiality or availability impact reported. The vulnerability has a CVSS score of 5.3 (medium severity) with network attack vector, low attack complexity, no privileges required, and no user interaction needed.
Mitigation Recommendations
Patch status is not yet confirmed — check the Python Software Foundation advisory for current remediation guidance. Until a patch is available, avoid extracting untrusted tar archives using TarFile.extractall() or TarFile.extract() with the filter parameter set to "data" or "tar". For Python 3.14 or later, be aware that the default filter is "data", so explicitly specify a safe filter or avoid extraction of untrusted tar files. Exercise caution when installing source distributions with suspicious links, although this vulnerability does not significantly affect source distribution installations.
CVE-2024-12718: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in Python Software Foundation CPython
Description
CVE-2024-12718 is a path traversal vulnerability in the Python tarfile module affecting Python versions 3.12 and later. It allows modification of file metadata or permissions outside the intended extraction directory when using the extractall() or extract() methods with the filter parameter set to "data" or "tar". The default filter changed to "data" starting in Python 3.14, increasing the risk if relying on default behavior. This vulnerability does not significantly impact source distribution installations, which already permit arbitrary code execution during builds.
CVSS v3.1
Score 5.3medium
Affected software
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
This vulnerability in CPython's tarfile module (CVE-2024-12718) involves improper limitation of pathnames (CWE-22) during extraction of tar archives. When using TarFile.extractall() or TarFile.extract() with the filter parameter set to "data" or "tar", an attacker can modify file metadata such as last modified timestamps or file permissions (chmod) on files outside the extraction directory. This affects Python versions 3.12 and later, as earlier versions do not support the extraction filter feature. Additionally, from Python 3.14 onward, the default filter value changed to "data", meaning that code relying on default filtering is also affected. The vulnerability does not significantly affect source distribution installations, which inherently allow arbitrary code execution during build processes.
Potential Impact
An attacker providing a crafted tar archive can cause modification of file metadata or permissions outside the intended extraction directory when the vulnerable extraction filters are used. This can lead to unauthorized changes to files on the system, potentially impacting system integrity. There is no direct confidentiality or availability impact reported. The vulnerability has a CVSS score of 5.3 (medium severity) with network attack vector, low attack complexity, no privileges required, and no user interaction needed.
Mitigation Recommendations
Patch status is not yet confirmed — check the Python Software Foundation advisory for current remediation guidance. Until a patch is available, avoid extracting untrusted tar archives using TarFile.extractall() or TarFile.extract() with the filter parameter set to "data" or "tar". For Python 3.14 or later, be aware that the default filter is "data", so explicitly specify a safe filter or avoid extraction of untrusted tar files. Exercise caution when installing source distributions with suspicious links, although this vulnerability does not significantly affect source distribution installations.
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- PSF
- Date Reserved
- 2024-12-17T17:04:51.209Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 683ef51d182aa0cae27c315d
Added to database: 06/03/2025, 13:14:05 UTC
Last enriched: 08/07/2026, 14:56:49 UTC
Last updated: 09/10/2026, 19:36:47 UTC
Views: 270
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.