Skip to main content
EPSS 1.4%top 29%

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

0
High
VulnerabilityCVE-2025-4138cvecve-2025-4138cwe-22gcve
Published: 06/03/2025 (06/03/2025, 12:59:02 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

Description

CVE-2025-4138 is a path traversal vulnerability in the Python tarfile module that allows the extraction filter to be bypassed, enabling symlink targets to point outside the intended extraction directory and permitting modification of some file metadata. This affects usage of TarFile.extractall() or TarFile.extract() when using the filter parameter set to "data" or "tar". The default filter value changed to "data" starting with Python 3.14, so code relying on this default is also affected. This vulnerability does not significantly impact source distribution installations, which already allow arbitrary code execution during build.

CVSS v3.1

Score 7.5high

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected software

Affected versions
=3.10.0=3.11.0=3.12.0=3.13.0=3.14.0

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/07/2026, 14:59:41 UTC

Technical Analysis

The vulnerability in CPython's tarfile module (CVE-2025-4138) involves improper limitation of pathnames (CWE-22) during extraction of tar archives. Specifically, when using the extraction filters "data" or "tar" with TarFile.extractall() or TarFile.extract(), the filter can be ignored, allowing symbolic link targets to escape the intended extraction directory. This can lead to modification of file metadata outside the target directory. The issue affects Python versions 3.10.0 through 3.14.0a1, with the default filter changing to "data" in Python 3.14, increasing the risk for code relying on default behavior. The vulnerability does not significantly affect source distribution installations due to their inherent arbitrary code execution risk during build.

Potential Impact

An attacker providing a crafted tar archive can cause extraction operations to write files or modify metadata outside the intended directory via symlink traversal, potentially leading to unauthorized file modifications. The CVSS score of 7.5 (high) reflects the network attack vector, low complexity, no privileges required, no user interaction, and high confidentiality impact. There is no indication of integrity or availability impact. No known exploits in the wild have been reported.

Mitigation Recommendations

No official patch or fix information is provided in the available data. Patch status is not yet confirmed — check the Python Software Foundation advisory for current remediation guidance. Users should avoid extracting untrusted tar archives with the affected filter parameters until a fix is available. For Python 3.14 or later, be aware that the default filter value changed to "data", which is affected. Exercise caution when installing source distributions with suspicious symbolic links, although this vulnerability does not significantly increase risk in that context.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.1
Assigner Short Name
PSF
Date Reserved
2025-04-30T13:35:55.675Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 683ef89a182aa0cae27cb26f

Added to database: 06/03/2025, 13:28:58 UTC

Last enriched: 08/07/2026, 14:59:41 UTC

Last updated: 09/10/2026, 19:36:50 UTC

Views: 168

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 more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses