CVE-2026-82049
Tarfile extraction may follow a hard‑link to a symlink, altering or exposing files outside the target directory.
- CVSS 8.4
- CWE-59
- Input Validation and Sanitization
- Remote
In CPython 3.13 and earlier, the tarfile module's data and tar extraction filters are vulnerable to crafted archives containing a hard link to a symbolic link. Such archives may cause extraction to modify the permissions or modification time of a file outside the destination directory, or expose the contents of that file within the extracted tree.
- CWE
- CWE-59
- CVSS base score
- 8.4
- Published
- 2026-09-14
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Path Traversal
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- tarfile
- Fixed by upgrading
- Yes
Solution
Upgrade to Python 3.13.1 (or any later release) where the tarfile extraction hard‑link‑to‑symlink vulnerability is fixed.
Vulnerable code sample
import tarfile
def extract_archive(archive_path, dest_dir):
"""Extract a tar archive without any safety checks."""
# VULNERABLE: hard‑link to symlink can escape dest_dir
with tarfile.open(archive_path, 'r:*') as tar:
tar.extractall(path=dest_dir)Patched code sample
import tarfile
def extract_archive(archive_path, dest_dir):
"""Extract a tar archive using a safe extraction filter."""
# FIX: use the 'data' filter to block hard‑link to symlink attacks
with tarfile.open(archive_path, 'r:*') as tar:
tar.extractall(path=dest_dir, filter='data')Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- [3.10] gh-157190: Fix tarfile `data`/`tar` filter bypass via hard link to a symlink (GH-157191) (#158457) (python/cpython)
Lib/tarfile.py · TarFile.makelink_with_filter - gh-157190: Follow symlinks when extracting `tarfile` hard links (GH-157191) (python/cpython)
Lib/tarfile.py · TarFile.makelink_with_filter - [3.13] gh-157190: Fix tarfile `data`/`tar` filter bypass via hard link to a symlink (GH-157191) (GH-157192) (python/cpython)
Lib/tarfile.py · TarFile.makelink_with_filter - [3.14] gh-157190: Follow symlinks when extracting `tarfile` hard links (GH-157191) (#157261) (python/cpython)
Lib/tarfile.py · TarFile.makelink_with_filter - [3.15] gh-157190: Follow symlinks when extracting `tarfile` hard links (GH-157191) (GH-157262) (python/cpython)
Lib/tarfile.py · TarFile.makelink_with_filter
Cite this entry
@misc{vaitp:cve202682049,
title = {{Tarfile extraction may follow a hard‑link to a symlink, altering or exposing files outside the target directory.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-82049},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-82049/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
