In the fallback extraction path for source distributions, pip
used Python’s tarfile
module without verifying that symbolic/hard link targets resolve inside the intended extraction directory. A malicious sdist can include links that escape the target directory and overwrite arbitrary files on the invoking host during pip install
.
Successful exploitation enables arbitrary file overwrite outside the build/extraction directory on the machine running pip
. This can be leveraged to tamper with configuration or startup files and may lead to further code execution depending on the environment, but the direct, guaranteed impact is integrity compromise on the vulnerable system.
The issue is triggered when installing an attacker-controlled sdist (e.g., from an index or URL) and the fallback extraction code path is used. No special privileges are required beyond running pip install
; active user action is necessary.
Upgrade to pip 25.2 or later, which validates member paths and rejects unsafe link targets. Using a Python interpreter that implements the safe-extraction behavior described by PEP 706 provides additional defense in depth for other tarfile
issues but is not a substitute for upgrading pip for this specific flaw.
{ "github_reviewed": true, "github_reviewed_at": "2025-09-24T20:04:58Z", "severity": "MODERATE", "cwe_ids": [ "CWE-59" ], "nvd_published_at": "2025-09-24T15:15:41Z" }