GHSA-94p9-xgh2-xp45: Pip/virtualenv vulnerability
downloadwheel() runs pip download and hands the result straight to the seeder, with nothing checking the bytes it gets back. The embedded pip and setuptools wheels carry a BUNDLESHA256 that virtualenv checks on every load, but a wheel fetched over the network for the periodic-update feature or the --download flag had no equivalent verification.
A compromised index, a stale mirror, or a MITM'd download (when TLS is intercepted, e.g. via a misconfigured or malicious CA) could substitute a different wheel under the same distribution/version/filename, and virtualenv would cache and seed it into every environment created afterward with no warning.
Fixed by computing the downloaded wheel's sha256 and comparing it against the digest PyPI's public JSON API reports for that exact release, independent of which index actually served the file. The check is skipped, not treated as failure, when a custom index (PIPINDEXURL, PIPEXTRAINDEXURL, PIPINDEX) is configured, since a private index can legitimately serve a different, intentionally rebuilt wheel. Fix: https://github.com/pypa/virtualenv/pull/3251
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/virtualenvto a version that resolves this vulnerability.Fixed in 21.7.12 - Upgrade
Upgrade
virtualenvto a version that resolves this vulnerability.Patch 3251
Event History
Frequently Asked Questions
Which virtualenv workflows are exposed to this issue?
The issue affects wheels fetched over the network by the periodic-update feature or when using the --download flag. Embedded pip and setuptools wheels are checked against their bundled BUNDLE_SHA256 values and are not described as affected.
What access or conditions would an attacker need to exploit this?
An attacker would need to cause virtualenv to receive a substituted wheel from a compromised index, stale mirror, or an intercepted TLS download. The substituted file could use the same distribution, version, and filename as the expected wheel.
What is the impact after a substituted wheel is downloaded?
Virtualenv could cache the substituted wheel and use it to seed every environment created afterward. The vulnerable behavior provided no warning when this occurred.
Does the new digest verification protect installations using a private or custom package index?
No. The verification is skipped when PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or PIP_INDEX is configured, because a private index may intentionally serve a rebuilt wheel with a different digest.