Skip to main content

CVE-2025-4435: Vulnerability in Python Software Foundation CPython

High
VulnerabilityCVE-2025-4435cvecve-2025-4435
Published: Tue Jun 03 2025 (06/03/2025, 12:59:06 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

Description

When using a TarFile.errorlevel = 0 and extracting with a filter the documented behavior is that any filtered members would be skipped and not extracted. However the actual behavior of TarFile.errorlevel = 0 in affected versions is that the member would still be extracted and not skipped.

AI-Powered Analysis

AILast updated: 07/11/2025, 05:49:57 UTC

Technical Analysis

CVE-2025-4435 is a high-severity vulnerability affecting multiple versions of CPython, the reference implementation of the Python programming language maintained by the Python Software Foundation. The vulnerability arises from incorrect handling of the TarFile.errorlevel attribute when extracting members from tar archives using a filter. Specifically, when TarFile.errorlevel is set to 0, the documented behavior is that any archive members filtered out should be skipped and not extracted. However, in the affected CPython versions (including 3.10.0 through 3.14.0a1), the actual behavior is that filtered members are still extracted despite the errorlevel setting. This discrepancy constitutes a logic error (CWE-682) that can lead to unintended extraction of archive members that should have been excluded by the filter. The vulnerability has a CVSS 3.1 base score of 7.5, indicating high severity, with the vector AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N. This means the vulnerability is remotely exploitable over the network without authentication or user interaction, has low attack complexity, and impacts integrity but not confidentiality or availability. The integrity impact arises because unauthorized or unexpected files may be extracted, potentially overwriting or injecting malicious files into the filesystem. Although no known exploits are currently in the wild, the flaw could be leveraged by attackers who can supply crafted tar archives to applications using the vulnerable CPython versions for archive extraction. This could lead to code injection, privilege escalation, or disruption of application logic depending on the context in which the extraction occurs. The vulnerability affects a broad range of CPython versions, including recent stable releases and alpha versions, indicating that many Python-based applications and environments are potentially vulnerable. Since Python is widely used in server-side applications, automation, and development tools, this vulnerability poses a significant risk if unpatched.

Potential Impact

For European organizations, the impact of CVE-2025-4435 can be substantial due to the widespread use of Python in enterprise environments, including web services, data processing pipelines, and automation scripts. The vulnerability allows attackers to bypass intended filtering controls during tar archive extraction, potentially leading to unauthorized file extraction and integrity compromise. This can result in malicious code injection, unauthorized modification of critical files, or disruption of application workflows. Organizations relying on Python for handling tar archives, especially in automated deployment or update mechanisms, may face risks of supply chain attacks or remote code execution if attackers can supply crafted archives. The integrity compromise could also facilitate lateral movement within networks or persistence mechanisms for advanced threats. Given the remote exploitability without authentication or user interaction, attackers could exploit vulnerable systems over the network, increasing the risk of widespread impact. The absence of known exploits in the wild currently provides a window for mitigation, but organizations should act promptly to prevent exploitation. The vulnerability does not directly affect confidentiality or availability but can indirectly lead to data breaches or service disruptions if exploited as part of a larger attack chain.

Mitigation Recommendations

To mitigate CVE-2025-4435, European organizations should take the following specific actions beyond generic patching advice: 1) Audit all Python environments to identify usage of affected CPython versions (0, 3.10.0 through 3.14.0a1) and prioritize upgrading to patched versions once available. 2) Review all codebases and third-party libraries that perform tar archive extraction using the TarFile module, especially those that rely on the errorlevel attribute and filtering mechanisms. 3) Implement additional validation and sanitization of tar archive contents before extraction, such as verifying file paths to prevent directory traversal and ensuring only expected files are processed. 4) Employ runtime monitoring and integrity checking on directories where tar archives are extracted to detect unauthorized file modifications. 5) Restrict network exposure of services that accept tar archives from untrusted sources and implement strict input validation and authentication controls. 6) Consider using alternative archive extraction libraries or sandboxed environments for handling untrusted archives until patches are applied. 7) Establish incident response procedures to quickly identify and remediate any exploitation attempts involving tar extraction anomalies. These targeted mitigations will reduce the risk of exploitation and limit potential damage from this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 683f0dc3182aa0cae27ff441

Added to database: 6/3/2025, 2:59:15 PM

Last enriched: 7/11/2025, 5:49:57 AM

Last updated: 8/17/2025, 7:48:11 PM

Views: 127

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

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