VAITP Dataset

← Back to the dataset

CVE-2026-102930

virtualenv <21.7.12 skips SHA256 verification of seed wheels, allowing injection.

  • CVSS 7.7
  • CWE-494
  • Input Validation and Sanitization
  • Remote

virtualenv is a tool for creating isolated virtual python environments. Prior to 21.7.12, download_wheel() accepts pip and setuptools seed wheels fetched for periodic updates or the –download option without checking their bytes against an authoritative digest equivalent to the embedded wheels' BUNDLE_SHA256 verification. A compromised index, stale mirror, or intercepted TLS connection can substitute a different wheel under the requested distribution, version, and filename, after which virtualenv caches and seeds the attacker-controlled wheel into subsequently created environments. The verification applies to the default PyPI path and is intentionally skipped when PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, or PIP_INDEX configures a custom index that may legitimately publish rebuilt wheels. This issue is fixed in version 21.7.12.

CVSS base score
7.7
Published
2026-09-29
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Insecure Direct Object References (IDOR)
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
virtualenv
Fixed by upgrading
Yes

Solution

Upgrade virtualenv to version 21.7.12 or newer.

Vulnerable code sample

import os
import urllib.request

BUNDLE_WHEELS = {
    "pip-23.0-py3-none-any.whl": "https://files.pythonhosted.org/packages/.../pip-23.0-py3-none-any.whl",
    "setuptools-68.0.0-py3-none-any.whl": "https://files.pythonhosted.org/packages/.../setuptools-68.0.0-py3-none-any.whl",
}

def download_wheel(name, dest_dir):
    """
    Download a seed wheel for virtualenv without verifying its integrity.
    """
    # VULNERABLE: no digest verification allows malicious wheel substitution
    url = BUNDLE_WHEELS[name]
    target_path = os.path.join(dest_dir, name)
    with urllib.request.urlopen(url) as resp, open(target_path, "wb") as out:
        out.write(resp.read())
    return target_path

Patched code sample

import os
import urllib.request
import hashlib

BUNDLE_WHEELS = {
    "pip-23.0-py3-none-any.whl": ("https://files.pythonhosted.org/packages/.../pip-23.0-py3-none-any.whl",
                                   "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
    "setuptools-68.0.0-py3-none-any.whl": ("https://files.pythonhosted.org/packages/.../setuptools-68.0.0-py3-none-any.whl",
                                          "5d41402abc4b2a76b9719d911017c592"),
}

def download_wheel(name, dest_dir):
    """
    Download a seed wheel for virtualenv with SHA256 verification.
    """
    # FIX: verify downloaded wheel against known BUNDLE_SHA256
    url, expected_sha256 = BUNDLE_WHEELS[name]
    target_path = os.path.join(dest_dir, name)
    with urllib.request.urlopen(url) as resp, open(target_path, "wb") as out:
        data = resp.read()
        out.write(data)
    actual_sha256 = hashlib.sha256(data).hexdigest()
    if actual_sha256 != expected_sha256:
        raise ValueError("SHA256 mismatch for %s" % name)
    return target_path

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026102930,
  title        = {{virtualenv <21.7.12 skips SHA256 verification of seed wheels, allowing injection.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-102930},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102930/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.