CVE-2025-4435

Tarfile extracts filtered members when errorlevel=0

Published Jun 3, 2025 CVSS 3.1 · 7.5 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

When a Python TarFile instance has its errorlevel attribute set to 0, the documented behavior is that any archive entries that are filtered out should be ignored during extraction. In the affected CPython releases, however, the extraction logic fails to honor this contract and still writes the filtered members to the target directory. The result is that an attacker can supply a tar archive containing entries that are intended to be skipped, and those entries will nevertheless be extracted, potentially creating or overwriting files on the filesystem. The vulnerability stems from incorrect control flow (CWE‑706) and a faulty use of the filtering mechanism (CWE‑682), leading to unauthorized creation of files and loss of isolation between the archive contents and the application environment.

Affected Systems

The flaw resides in CPython’s tarfile module. All CPython versions prior to the patch commit that introduces the fix are considered vulnerable. Red Hat Enterprise Linux 8, 9, and their extended‑service releases (RHEL EUS, RHEL E4S, RHEL EUS Long Life, RHEL TUS) that ship unpatched Python packages are at risk. Because the CVE record does not list specific CPython release numbers, users should identify which Python interpreter they are using and verify whether the version includes the commit that resolves the issue.

Risk and Exploitability

The CVSS score of 7.5 indicates high severity. The EPSS score of less than 1 % and the absence from the CISA KEV catalog suggest that exploitation is currently rare, but the potential for disruptive file writes remains. The likely attack vector is an application that runs Python code and can set TarFile.errorlevel = 0 while processing a user‑supplied tar archive. Based on the description, it is inferred that an attacker who can control this environment can extract or overwrite files, thereby possibly exposing sensitive data or altering system configuration. Although the exploitation probability is low, the impact of unintended file creation or overwrite warrants timely remediation.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade CPython to a release that contains the tarfile logic fix.
  • Avoid setting TarFile.errorlevel = 0; instead use the default extraction behavior or apply an explicit filter before invoking extract members.
  • If a patch cannot be applied immediately, perform extraction in a restricted environment (e.g., a read‑only chroot or container) to limit the scope of any file writes.

Generated by OpenCVE AI on April 22, 2026 at 12:09 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
EUVD EUVD EUVD-2025-16725 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.
Ubuntu USN Ubuntu USN USN-7583-1 Python vulnerabilities
History
Type Values Removed Values Added
CPEs cpe:/a:redhat:rhel_e4s:8.8
cpe:/a:redhat:rhel_eus_long_life:8.8
cpe:/a:redhat:rhel_tus:8.8
Type Values Removed Values Added
First Time appeared Redhat rhel Aus
Redhat rhel E4s
Redhat rhel Eus Long Life
Redhat rhel Tus
CPEs cpe:/a:redhat:rhel_aus:8.6
cpe:/a:redhat:rhel_e4s:8.6
cpe:/a:redhat:rhel_eus_long_life:8.6
cpe:/a:redhat:rhel_tus:8.6
Vendors & Products Redhat rhel Aus
Redhat rhel E4s
Redhat rhel Eus Long Life
Redhat rhel Tus
Type Values Removed Values Added
CPEs cpe:/a:redhat:enterprise_linux:9
cpe:/o:redhat:enterprise_linux:10.0
cpe:/o:redhat:enterprise_linux:8
cpe:/o:redhat:enterprise_linux:9
Type Values Removed Values Added
First Time appeared Redhat enterprise Linux
CPEs cpe:/a:redhat:enterprise_linux:8
Vendors & Products Redhat enterprise Linux
Type Values Removed Values Added
First Time appeared Redhat
Redhat rhel Eus
CPEs cpe:/a:redhat:rhel_eus:9.4
Vendors & Products Redhat
Redhat rhel Eus
Type Values Removed Values Added
Weaknesses CWE-706
References
Metrics threat_severity

None

threat_severity

Moderate

Type Values Removed Values Added
Weaknesses CWE-682
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Tarfile extracts filtered members when errorlevel=0
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N'}

Weaknesses
  • CWE-682

    Incorrect Calculation

  • CWE-706

    Use of Incorrectly-Resolved Name or Reference

Sources

Status
PUBLISHED
Assigner
PSF
Published
Updated
Jul 31, 2026, 2:02 PM
Reserved
May 8, 2025, 3:05 PM
Status
Deferred
Published
Jun 3, 2025, 1:15 PM
Modified
Jul 31, 2026, 2:16 PM
Severity
Moderate
Public date
Jun 3, 2025, 12:59 PM