AI analysis
A link-following flaw (CWE-59) in CPython's tarfile module lets a crafted tar archive containing a hard link that points to a symbolic link defeat the 'data' and 'tar' extraction filters introduced to harden tarfile. If an application extracts such an attacker-supplied archive, extraction can follow the link chain and change the permissions or modification time of a file outside the intended destination directory, or copy the contents of that outside file into the extracted tree (information disclosure). Exploitation requires a victim or application to extract a malicious archive (CVSS 4.0 lists user interaction), so the practical risk is concentrated in software that unpacks untrusted tars: package mirrors, build/CI tooling, backup and restore agents, and file-upload pipelines. All CPython releases 3.13 and earlier are affected. No public proof of concept or in-the-wild exploitation is known at this time.
What to do: Upgrade to the latest Python maintenance release for each affected branch as soon as the fix is published, and check your Linux distribution or vendor (including macOS system Python) for patched packages. Audit first- and third-party code that calls tarfile.extract/extractall on user- or network-supplied archives and treat those inputs as untrusted in the meantime. As an interim mitigation, pre-scan archive members and reject or neutralize hard links whose target resolves to a symlink, and run extraction in a sandbox or with a low-privilege account to limit blast radius.
Affected
| Python Software Foundation CPython (Python) | 3.13 and earlier (including the 3.13.x, 3.12.x, 3.11.x and older series; fixed only in releases containing the tarfile filter patch) |
Estimated exposure
massPotentially >100 million systems, since Python 3 is preinstalled on most Linux distributions and macOS, though only the subset running code that extracts… — Python ships as a default component of virtually every mainstream Linux distribution and macOS, so the installed base plausibly exceeds 100M devices; actual vulnerable usage depends on applications calling tarfile extraction on untrusted…
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
Description
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.