CVE-2026-1703
Path Traversal in pip Wheel Extraction Allows Directory Escape
Publication date: 2026-02-02
Last updated on: 2026-02-02
Assigner: Python Software Foundation
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| pypa | pip | 26.0 |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-22 | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-1703 is a security vulnerability in the Python package installer pip where, during installation and extraction of a maliciously crafted wheel archive, files may be extracted outside the intended installation directory due to improper path prefix checking. The issue arises because pip used os.path.commonprefix(), which compares paths character-by-character and can be tricked by paths that share common prefixes but are not actually inside the directory. This could allow limited path traversal. The vulnerability was fixed by replacing commonprefix() with os.path.commonpath(), which compares path segments properly, preventing such traversal. [1, 2, 3]
How can this vulnerability impact me? :
This vulnerability can cause files from a malicious wheel archive to be extracted outside the intended installation directory during pip installation. Although the path traversal is limited to prefixes within the installation directory and does not typically allow injection or overwriting of executable files, it could still lead to unexpected file placement, potentially affecting system integrity or causing confusion in file management. [3]
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by examining if pip versions prior to 26.0 are in use, as the issue was fixed in pip 26.0 by replacing `os.path.commonprefix()` with `os.path.commonpath()` to prevent path traversal during wheel extraction. To check your pip version, you can run the command `pip --version`. Additionally, inspecting wheel archives for malicious path traversal attempts would require custom scripts or tools to analyze wheel contents for paths that escape the intended installation directory, but no specific detection commands are provided in the resources. [1, 2]
What immediate steps should I take to mitigate this vulnerability?
The immediate mitigation step is to upgrade pip to version 26.0 or later, where the vulnerability has been fixed by using `os.path.commonpath()` for secure path validation during wheel extraction. This update was released on January 30, 2026, and includes the security fix along with other improvements. Avoid installing or extracting wheel archives from untrusted sources until the upgrade is applied. [1, 2, 3]