Executive brief
pip is a package installer for Python. When downloading packages from a package index, pip failed to properly decode specially-crafted URLs with double-encoded path separators, allowing an attacker controlling a malicious package index to place files outside their intended installation directory. This could lead to unauthorized file placement on a user's system, particularly affecting users of the `pip download --only-binary` command.
Technical details
This vulnerability is a path traversal issue (CWE-36) caused by double URL decoding in the Link class. The vulnerable code performed percent-decoding twice: once in Link.__init__() when parsing the URL path, and again in Link.filename when extracting the basename. A doubly-encoded separator like %252F would be decoded to %2F in __init__(), then to / in filename, converting a single path component like a%2Fb.whl into a/b.whl. An attacker controlling a malicious package index can craft package URLs with doubly-encoded separators to bypass path validation and install files to arbitrary locations. The vulnerability requires the victim to download or install from an untrusted index; it is patched in pip 26.2.0 by removing the second decode and treating the filename as a single path component.
Affected products
- Python Packaging Authority pip < 26.2.0
Timeline
- 2026-07-29: disclosed
- 2026-07-01: patched: Fix committed to main branch
- 2026-09-01: advisory: Reviewed and published to GitHub Advisory Database
References
- https://github.com/pypa/pip/pull/14110
- https://mail.python.org/archives/list/security-announce@python.org/thread/L2BNQGGVQCEV7DROOORQ7WFKKFF2OOQX
- http://www.openwall.com/lists/oss-security/2026/07/29/7
- https://github.com/pypa/pip/commit/10dfb6b9005484578b386f64b9f36982e3dc6679
- https://github.com/pypa/advisory-database/tree/main/vulns/pip/PYSEC-2026-3721.yaml