BIT-python-min-2026-7774: tarfile.data_filter path traversal bypass allows writing outside the extraction directory
tarfile.datafilter could be bypassed using crafted link entries, including symlinks with empty or directory-like names, to redirect later archive members outside the intended extraction directory. This allowed a malicious tar archive to cause tarfile.extractall() to write files outside the destination directory, subject to the permissions of the extracting process.
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications that call tarfile.extractall() on attacker-controlled or untrusted tar archives are exposed. The impact is limited by the permissions of the process performing extraction.
What does an attacker need to exploit it?
An attacker needs to persuade the application or user to extract a crafted tar archive. No authentication or prior privileges are required, but user interaction is required according to the supplied vector.
How can the issue be exploited despite use of data_filter?
A crafted archive can use link entries, including symlinks with empty or directory-like names, to redirect later archive members outside the selected extraction directory. As a result, data_filter does not reliably prevent writes outside that directory in the affected condition.
How can I determine whether an extraction workflow is affected?
Review whether the workflow uses tarfile.extractall() and accepts archives from untrusted sources while relying on data_filter for path containment. Test only in a controlled environment with archives containing crafted link entries and later file members, and verify whether files are written outside the extraction destination.