Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-102930 Overview
CVE-2026-102930 affects virtualenv, a widely used tool for creating isolated Python environments. Versions prior to 21.7.12 fail to verify the cryptographic digest of pip and setuptools seed wheels fetched during periodic updates or via the --download option. The download_wheel() function accepts remote wheels without comparing their bytes against the authoritative BUNDLE_SHA256 digest embedded in virtualenv. This allows a compromised package index, a stale mirror, or an intercepted TLS connection to substitute an attacker-controlled wheel under a legitimate distribution name, version, and filename. virtualenv then caches and seeds the malicious wheel into every subsequently created environment. The issue is fixed in version 21.7.12.
Critical Impact
A single successful wheel substitution can persistently poison seed wheels, resulting in arbitrary code execution across all Python environments created by the affected virtualenv installation.
Affected Products
- pypa/virtualenv versions prior to 21.7.12
- Python environments seeded via download_wheel() for periodic updates
- Systems invoking virtualenv with the --download option against the default PyPI index
Discovery Timeline
- 2026-09-29 - CVE-2026-102930 published to NVD
- 2026-09-29 - Last updated in NVD database
Technical Details for CVE-2026-102930
Vulnerability Analysis
The vulnerability is classified as Download of Code Without Integrity Check [CWE-494]. virtualenv ships with bundled pip and setuptools wheels whose SHA-256 digests are embedded at build time as BUNDLE_SHA256. When virtualenv performs periodic updates or the user explicitly requests fresh wheels through --download, download_wheel() fetches replacements from PyPI. Prior to 21.7.12, the fetched bytes were never compared against any authoritative digest. The downloaded wheel was written to the on-disk cache and used to seed subsequent virtual environments. Because seeded wheels execute installer logic and become the base of every new environment, tampering propagates automatically to downstream Python projects.
Root Cause
The root cause is a missing integrity check between the network-retrieved wheel and virtualenv's embedded BUNDLE_SHA256 reference. The trust boundary implicitly relied on TLS to PyPI and the correctness of any intermediate mirror. No end-to-end verification tied the on-disk artifact back to a value controlled by the virtualenv maintainers.
Attack Vector
An attacker able to influence the wheel bytes returned to the client can substitute a malicious wheel with matching distribution, version, and filename. Viable positions include a compromised or malicious package index, a stale or hostile mirror, or an on-path attacker capable of manipulating the TLS session. User interaction is required in the form of running virtualenv against the default PyPI path. The fix intentionally skips verification when PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or PIP_INDEX configure a custom index, since private indexes may legitimately republish rebuilt wheels under identical names.
from operator import eq, lt
from pathlib import Path
from subprocess import PIPE, CalledProcessError, Popen
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Final
from .bundle import from_bundle
-from .periodic_update import add_wheel_to_update_log
+from .periodic_update import add_wheel_to_update_log, verify_wheel_digest
from .util import Version, Wheel, discover_wheels
if TYPE_CHECKING:
from virtualenv.app_data.base import AppData
LOGGER = logging.getLogger(__name__)
+# A private index can legitimately serve a rebuilt wheel under the same distribution, version, and
+# filename PyPI also uses - an internal mirror re-signing or re-packaging a release for policy reasons,
+# for example. Verifying that file against PyPI's own digest would then reject a wheel that came from
+# exactly the source it was configured to come from, not a compromised one.
+_CUSTOM_INDEX_ENV_VARS: Final[tuple[str, ...]] = ("PIP_INDEX_URL", "PIP_EXTRA_INDEX_URL", "PIP_INDEX")
+
+
+def _uses_default_index(env: dict[str, str]) -> bool:
+ return not any(env.get(var) for var in _CUSTOM_INDEX_ENV_VARS)
Source: GitHub Commit a01ed3e2. The patch introduces verify_wheel_digest and only skips verification when a custom index is explicitly configured via the listed environment variables.
Detection Methods for CVE-2026-102930
Indicators of Compromise
- Wheels present in the virtualenv wheel cache whose SHA-256 does not match the BUNDLE_SHA256 recorded for the corresponding pip or setuptools version.
- Newly created virtual environments containing seeded pip or setuptools distributions that execute unexpected post-install code or spawn network connections during environment creation.
- Unexpected outbound HTTP(S) requests from virtualenv invocations that resolve to non-PyPI hosts while no PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or PIP_INDEX variable is set.
Detection Strategies
- Inventory installed virtualenv versions across build agents, developer workstations, and container images, and flag any version below 21.7.12.
- Hash all wheels under the virtualenv app data cache and compare against digests published by PyPA for the seeded pip and setuptools releases.
- Correlate CI/CD pipeline logs that invoke virtualenv --download or trigger periodic updates with the source IPs and TLS certificates observed during wheel retrieval.
Monitoring Recommendations
- Monitor DNS and proxy logs for resolutions of pypi.org and files.pythonhosted.org originating from build hosts, and alert on unexpected redirects or alternate CDNs.
- Track the creation of Python virtual environments and record the wheels installed during seeding to establish a baseline for anomaly detection.
- Alert on changes to environment variables PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, and PIP_INDEX on shared build infrastructure, as these disable the new digest verification path.
How to Mitigate CVE-2026-102930
Immediate Actions Required
- Upgrade virtualenv to version 21.7.12 or later on every host that creates Python environments, including CI/CD workers and container base images.
- Purge the existing virtualenv wheel cache to remove any potentially substituted pip or setuptools wheels before creating new environments.
- Rebuild container images and reissue application deployments that were produced by vulnerable virtualenv releases in the last update cycle.
Patch Information
The fix landed in pull request #3251 and is included in virtualenv 21.7.12. Refer to the GitHub Security Advisory GHSA-94p9-xgh2-xp45 for the vendor's authoritative guidance. The patched download_wheel() calls verify_wheel_digest and rejects wheels whose SHA-256 does not match the embedded BUNDLE_SHA256 when the default PyPI index is in use.
Workarounds
- Avoid using the --download option and disable periodic seed wheel updates until the upgrade to 21.7.12 is deployed, forcing virtualenv to fall back to its verified embedded wheels.
- Restrict outbound traffic from build systems to an internal, trusted PyPI mirror with verified TLS termination, and audit that mirror's contents against upstream digests.
- Do not set PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or PIP_INDEX on general-purpose build hosts unless a private index is genuinely required, since these variables disable digest verification.
# Upgrade virtualenv and clear cached seed wheels
python -m pip install --upgrade 'virtualenv>=21.7.12'
# Remove cached wheels so seeding refetches and verifies them
rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv/wheel"
rm -rf "$HOME/Library/Application Support/virtualenv/wheel" 2>/dev/null || true
# Verify installed version
python -m virtualenv --version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

