Summary
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
.
Impact
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.
Conditions
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.
Remediation
The fix, while available as a patch that can be manually applied, has not yet been put into a numbered version but is planned for 25.3
. 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.
References
Summary
In the fallback extraction path for source distributions,
pip
used Python’starfile
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 duringpip install
.Impact
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.Conditions
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.Remediation
The fix, while available as a patch that can be manually applied, has not yet been put into a numbered version but is planned for
25.3
. Using a Python interpreter that implements the safe-extraction behavior described by PEP 706 provides additional defense in depth for othertarfile
issues but is not a substitute for upgrading pip for this specific flaw.References