Overview
This report covers the CVE-2025-4138 vulnerability, a significant flaw in the Python tarfile module. This vulnerability allows the extraction filter to be bypassed, enabling symlink targets to point outside the destination directory and the modification of some file metadata. This affects developers and organizations that employ the tarfile module to extract untrusted tar archives using specific parameters. The vulnerability is of particular concern due to its potential for system compromise or data leakage.
Vulnerability Summary
CVE ID: CVE-2025-4138
Severity: High (7.5 CVSS score)
Attack Vector: Network
Privileges Required: Low
User Interaction: None
Impact: Potential system compromise and data leakage
Affected Products
Escape the Surveillance Era
Most apps won’t tell you the truth.
They’re part of the problem.
Phone numbers. Emails. Profiles. Logs.
It’s all fuel for surveillance.
Ameeba Chat gives you a way out.
- • No phone number
- • No email
- • No personal info
- • Anonymous aliases
- • End-to-end encrypted
Chat without a trace.
Product | Affected Versions
Python Tarfile Module | Python 3.14 or later
How the Exploit Works
The exploit operates by bypassing the extraction filter in the Python tarfile module, allowing symlink targets to point outside the destination directory. This allows an attacker to modify file metadata and potentially extract data or compromise the system. The exploit specifically targets the use of TarFile.extractall() or TarFile.extract() with the filter= parameter with a value of “data” or “tar”.
Conceptual Example Code
Here is a conceptual example of how the vulnerability might be exploited:
import tarfile
def malicious_extract(tar_path, extract_path):
with tarfile.open(tar_path) as tar:
for member in tar.getmembers():
if '..' in member.name:
continue
tar.extract(member, path=extract_path, set_attrs=False)
malicious_extract('untrusted_archive.tar', '/safe/directory/')
In this example, the `malicious_extract` function opens a tar file and iterates over its members. If a member’s name contains ‘..’, symbolizing a path above the current directory level, it is ignored, and the extraction continues, potentially allowing harmful code execution or data extraction.

