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.
Published: 2025-06-03
Score: 9.4 Critical
EPSS: < 1% Very Low
KEV: No
Impact: Unrestricted file writes outside the intended extraction directory.
Action: Immediate Patch
AI Analysis

Impact

The vulnerability arises from a logic flaw in Python’s tarfile module that resolves extraction paths without properly sanitizing them, allowing attackers to craft archive entries that resolve to paths outside the intended extraction directory. When an archive is extracted with the filter parameter set to 'data' or 'tar' – which is also the default from Python 3.14 onward – the library expands paths using an insecure realpath algorithm. As a result, an adversary can extract files to any location within the process’s writable filesystem, enabling arbitrary overwrite or creation of files. This represents a CWE‑22 path traversal flaw and can be leveraged for modifications or persistence.

Affected Systems

The flaw is present in CPython, the standard Python interpreter, for versions that allow the use of tarfile with the filter parameter set to 'data' or 'tar'. Since Python 3.14 changed the default filter to 'data', this vulnerability affects all installations running Python 3.14 or later when the default extraction behavior is used. Earlier Python versions are affected only when applications explicitly pass filter='data' or filter='tar'. The vulnerability does not depend on any particular operating‑system runtime and is therefore relevant to any platform that runs CPython, including Red Hat Enterprise Linux families and other distributions.

Risk and Exploitability

The CVSS score of 9.4 indicates a severe impact if exploited. The EPSS score is below 1 %, suggesting a low present exploitation probability, and the issue is not listed in the CISA KEV catalog. Based on the description, the likely attack vector is an attacker supplying a malicious tar archive to a Python process that calls TarFile.extractall or TarFile.extract with a safe filter. In practice this could occur when a software component or user processes untrusted archives, for instance during package installation or data import. A locally running Python process, especially one with elevated privileges, could modify or create arbitrary files, potentially leading to privilege escalation or persistence.

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

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade CPython to the most recent stable release that includes the fix (consult CPython changelog or release notes for the relevant commit).
  • If an upgrade is not possible, enforce a safer extraction filter by explicitly specifying filter="safe" or replacing the default filter behavior with a custom implementation that validates extracted paths.
  • Review code that processes untrusted tar archives and restrict or sandbox the extraction process, ensuring the process has minimal privileges; use a dedicated, unprivileged user for extraction when possible.

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

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
EUVD EUVD EUVD-2025-16736 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.
Ubuntu USN Ubuntu USN USN-7583-1 Python vulnerabilities
History

Wed, 16 Jul 2025 13:45:00 +0000

Type Values Removed Values Added
Metrics epss

{'score': 0.00103}

epss

{'score': 0.0014}


Wed, 09 Jul 2025 02:30:00 +0000

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

Tue, 08 Jul 2025 02:45:00 +0000

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

Wed, 02 Jul 2025 14:45:00 +0000

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

Wed, 02 Jul 2025 02:30:00 +0000

Type Values Removed Values Added
First Time appeared Redhat enterprise Linux
CPEs cpe:/a:redhat:enterprise_linux:8
Vendors & Products Redhat enterprise Linux

Tue, 01 Jul 2025 02:30:00 +0000

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

Thu, 19 Jun 2025 06:45:00 +0000

Type Values Removed Values Added
References

Fri, 06 Jun 2025 19:00:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Thu, 05 Jun 2025 14:15:00 +0000

Type Values Removed Values Added
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. Only Python versions 3.12 or later are affected by these vulnerabilities, earlier versions don't include the extraction filter feature. 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. 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.

Tue, 03 Jun 2025 21:00:00 +0000


Tue, 03 Jun 2025 15:30:00 +0000


Tue, 03 Jun 2025 15:00:00 +0000


Tue, 03 Jun 2025 14:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Tue, 03 Jun 2025 13:45:00 +0000

Type Values Removed Values Added
References

Tue, 03 Jun 2025 13:30:00 +0000


Tue, 03 Jun 2025 13:15:00 +0000

Type Values Removed Values Added
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. Only Python versions 3.12 or later are affected by these vulnerabilities, earlier versions don't include the extraction filter feature. 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.
Title Arbitrary writes via tarfile realpath overflow
Weaknesses CWE-22
References
Metrics cvssV3_1

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


Subscriptions

Python Cpython
Redhat Enterprise Linux Rhel Aus Rhel E4s Rhel Eus Rhel Eus Long Life Rhel Tus
cve-icon MITRE

Status: PUBLISHED

Assigner: PSF

Published:

Updated: 2026-04-21T20:17:01.375Z

Reserved: 2025-05-09T15:05:07.139Z

Link: CVE-2025-4517

cve-icon Vulnrichment

Updated: 2025-06-03T13:28:45.452Z

cve-icon NVD

Status : Deferred

Published: 2025-06-03T13:15:20.837

Modified: 2026-04-15T00:35:42.020

Link: CVE-2025-4517

cve-icon Redhat

Severity : Important

Publid Date: 2025-06-03T12:58:50Z

Links: CVE-2025-4517 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-04-22T12:15:16Z

Weaknesses