BREW-CLOUDISCOVERY-CVE-2… (PYSEC-2026-4012)
Vulnerability from osv_homebrew – Published: 2026-09-30 21:05 – Updated: 2026-09-30 21:05 – Source websitepyvenv.cfg is a line-based format with no escape syntax. PyEnvCfg.write()
wrote values verbatim, while PyEnvCfg._read_values() parses the file with
str.splitlines(). A value containing a line boundary therefore became
additional configuration lines, and because reading is last-wins, the injected
keys replaced any key written earlier in the file.
The prompt value is the reachable input: it is set by --prompt, by the
VIRTUALENV_PROMPT environment variable, or from the config file, and
write() emits prompt before home. A crafted prompt can therefore set
home in the generated pyvenv.cfg. home is what tooling reads to locate
the base interpreter, so a consumer that trusts it can be pointed elsewhere.
implementation, version_info, version, executable, command and
virtualenv are also written before prompt and can be replaced the same
way.
This requires the prompt to come from somewhere other than the person running
the command, for example a CI job templating a branch name into it, tooling
deriving an environment name from user-supplied data, or an inherited
VIRTUALENV_PROMPT.
The boundary set is the one str.splitlines() recognizes, which is wider than
\n: \r, \v, \f, the file, group and record separators, U+0085,
U+2028 and U+2029 were all written through unchanged and all split the
line when read back.
Fixed in 21.7.11: PyEnvCfg.write() now collapses those boundaries to spaces
as it serializes each line, so it cannot emit a structurally invalid file
regardless of what a caller places in content.
{
"affected": [
{
"ecosystem_specific": {
"fix": null,
"range_state": "affected",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@20.31.2",
"upstream_fixed_in": "21.7.11"
},
"package": {
"ecosystem": "Homebrew",
"name": "cloudiscovery",
"purl": "pkg:brew/cloudiscovery"
},
"ranges": [
{
"events": [
{
"introduced": "2.4.4_4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/virtualenv@20.31.2",
"name": "virtualenv",
"resource": "virtualenv",
"strategy": "registry",
"subject_version": "20.31.2"
}
]
},
"details": "`pyvenv.cfg` is a line-based format with no escape syntax. `PyEnvCfg.write()`\nwrote values verbatim, while `PyEnvCfg._read_values()` parses the file with\n`str.splitlines()`. A value containing a line boundary therefore became\nadditional configuration lines, and because reading is last-wins, the injected\nkeys replaced any key written earlier in the file.\n\nThe `prompt` value is the reachable input: it is set by `--prompt`, by the\n`VIRTUALENV_PROMPT` environment variable, or from the config file, and\n`write()` emits `prompt` before `home`. A crafted prompt can therefore set\n`home` in the generated `pyvenv.cfg`. `home` is what tooling reads to locate\nthe base interpreter, so a consumer that trusts it can be pointed elsewhere.\n`implementation`, `version_info`, `version`, `executable`, `command` and\n`virtualenv` are also written before `prompt` and can be replaced the same\nway.\n\nThis requires the prompt to come from somewhere other than the person running\nthe command, for example a CI job templating a branch name into it, tooling\nderiving an environment name from user-supplied data, or an inherited\n`VIRTUALENV_PROMPT`.\n\nThe boundary set is the one `str.splitlines()` recognizes, which is wider than\n`\\n`: `\\r`, `\\v`, `\\f`, the file, group and record separators, `U+0085`,\n`U+2028` and `U+2029` were all written through unchanged and all split the\nline when read back.\n\nFixed in 21.7.11: `PyEnvCfg.write()` now collapses those boundaries to spaces\nas it serializes each line, so it cannot emit a structurally invalid file\nregardless of what a caller places in `content`.\n",
"id": "BREW-cloudiscovery-CVE-2026-102938",
"modified": "2026-09-30T21:05:15Z",
"published": "2026-09-30T21:05:15Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-9h9j-4vrj-gf7g"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/3247"
},
{
"type": "FIX",
"url": "https://github.com/pypa/virtualenv/commit/a30f995461043acb6cacbf3a890951563ccf7140"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.7.11"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "PACKAGE",
"url": "https://pypi.org/project/virtualenv"
}
],
"schema_version": "1.7.3",
"summary": "virtualenv writes prompt values into pyvenv.cfg without sanitizing line boundaries, allowing configuration injection",
"upstream": [
"PYSEC-2026-4012",
"CVE-2026-102938",
"GHSA-9h9j-4vrj-gf7g"
]
}
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.
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.