Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2025-4517: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in Python Software Foundation CPython

0
Critical
VulnerabilityCVE-2025-4517cvecve-2025-4517cwe-22
Published: Tue Jun 03 2025 (06/03/2025, 12:58:50 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

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.

AI-Powered Analysis

AILast updated: 10/24/2025, 04:08:23 UTC

Technical Analysis

CVE-2025-4517 is a critical security vulnerability classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) affecting the Python Software Foundation's CPython implementation, specifically its tarfile module. The flaw allows attackers to perform arbitrary filesystem writes outside the intended extraction directory during the extraction of tar archives when using the TarFile.extractall() or TarFile.extract() methods with the filter parameter set to "data" or "tar". This improper pathname validation enables path traversal attacks, where crafted tar archives contain file paths that escape the extraction directory, potentially overwriting critical system or application files. The vulnerability affects Python versions from 0 up to 3.14.0a1, with the default filter value changing to "data" starting in Python 3.14, thereby increasing exposure for users relying on default settings. The vulnerability does not significantly impact the installation of source distributions since these already allow arbitrary code execution during build processes, but it is critical to avoid installing suspicious source distributions. The CVSS v3.1 score of 9.4 reflects a critical severity with network attack vector, low attack complexity, no privileges required, no user interaction, and high impact on confidentiality and integrity, with a low impact on availability. No known exploits are currently reported in the wild. This vulnerability is particularly dangerous in environments where untrusted tar archives are processed automatically or without sufficient validation, such as CI/CD pipelines, automated deployment systems, or software distribution platforms using Python scripts. The flaw can lead to unauthorized file overwrites, potentially resulting in system compromise, data breaches, or persistent backdoors.

Potential Impact

For European organizations, the impact of CVE-2025-4517 is significant, especially for those heavily reliant on Python for software development, automation, and deployment processes. The ability to write arbitrary files outside the extraction directory can lead to unauthorized modification or replacement of critical system files, configuration files, or application binaries, resulting in system compromise or data integrity loss. Confidentiality is at high risk as attackers could overwrite sensitive files or implant malicious payloads. Integrity is severely impacted due to unauthorized file modifications, and availability could be affected if critical system files are corrupted. Organizations using vulnerable Python versions in CI/CD pipelines, automated software deployment, or handling untrusted tar archives from external sources are particularly vulnerable. The vulnerability could be exploited remotely without authentication or user interaction, increasing the risk of widespread attacks. This threat could disrupt business operations, lead to data breaches, and cause reputational damage. Given the critical CVSS score and ease of exploitation, European entities must prioritize mitigation to protect their infrastructure and software supply chains.

Mitigation Recommendations

1. Immediately audit all Python environments to identify usage of tarfile.extractall() or extract() with the filter parameter set to "data" or "tar". 2. Avoid extracting tar archives from untrusted or unauthenticated sources. Implement strict validation and integrity checks on tar files before extraction. 3. Apply official patches or updates from the Python Software Foundation as soon as they become available for affected Python versions. 4. For environments using Python 3.14 or later, explicitly specify the filter parameter to a safe value or implement additional path validation to prevent path traversal. 5. Employ sandboxing or containerization techniques to isolate extraction processes, limiting filesystem access and minimizing potential damage from exploitation. 6. Integrate security scanning tools in CI/CD pipelines to detect suspicious tar archives or unsafe extraction code patterns. 7. Educate developers and DevOps teams about the risks associated with tarfile extraction and secure coding practices. 8. Monitor logs and filesystem changes for unusual activity indicative of exploitation attempts. 9. Consider using alternative extraction libraries or custom extraction logic that enforce strict path sanitization. 10. Establish incident response procedures to quickly address potential exploitation events.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
PSF
Date Reserved
2025-05-09T15:05:07.139Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 683eff8d182aa0cae27db844

Added to database: 6/3/2025, 1:58:37 PM

Last enriched: 10/24/2025, 4:08:23 AM

Last updated: 11/22/2025, 4:47:50 PM

Views: 50

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats