CVE-2025-4517: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in Python Software Foundation CPython
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 Analysis
Technical Summary
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.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Ireland, Belgium
CVE-2025-4517: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in Python Software Foundation 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
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.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
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 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.
Related Threats
CVE-2023-30806: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in Sangfor Net-Gen Application Firewall
CriticalCVE-2024-0401: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ASUS ExpertWiFi
HighCVE-2024-23690: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in Netgear FVS336Gv3
HighCVE-2024-13976: CWE-427 Uncontrolled Search Path Element in Commvault Commvault for Windows
HighCVE-2024-12856: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in Four-Faith F3x24
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.