Executive brief
CPython's tarfile module contains a vulnerability in its data and tar extraction filters that can be exploited via specially crafted archive files. An attacker can create a malicious tar archive that, when extracted, modifies file permissions or timestamps outside the intended extraction directory, or exposes the contents of files within the extracted tree. This could allow an attacker to manipulate system files or leak sensitive data during routine archive extraction operations.
Technical details
The vulnerability exists in CPython 3.13 and earlier versions, specifically in the tarfile module's extraction filters. The root cause is improper handling of hard links to symbolic links within tar archives. When a crafted archive containing a hard link pointing to a symbolic link is extracted, the module fails to properly validate the target path, allowing directory traversal or symlink-following attacks. The vulnerability requires no special authentication but does require the victim to extract a malicious tar archive. An attacker can achieve permission/timestamp modification on arbitrary files or content disclosure by following symlinks outside the extraction boundary. Patches are available in the cpython repository (commits referencing gh-157190 and gh-81793).
Affected products
- Python CPython 3.13 and earlier
Timeline
- 2026-09-14: disclosed
- 2025-05-04: patched: Fix available in cpython repository (gh-157190, gh-81793)