BREW-POETRY-CVE-2026-113776 (GHSA-8RJX-V5WW-45PP)
Vulnerability from osv_homebrew – Published: 2026-10-29 22:19 – Updated: 2026-11-19 09:13 – Source websiteImpact
ViaTemplateActivator.instantiate_template replaces the placeholders in an activation template one key at a time, each across the whole text. When a value that it already substituted and quoted contains the name of a later placeholder, the later pass rewrites that name inside the quoted literal. The inserted value brings its own quotes, which close the outer literal, and the rest of the path runs as code when a user activates the environment.
__VIRTUAL_NAME__ holds the environment's directory name, so a destination such as A__VIRTUAL_NAME__B/x'$(touch PWNED)'y is enough. In the default activate for bash, the VIRTUAL_ENV line renders as:
VIRTUAL_ENV='/tmp/t/A'x'"'"'$(touch PWNED)'"'"'y'B/x'"'"'$(touch PWNED)'"'"'y'
Sourcing that script runs touch PWNED. The same payload in a path without the placeholder name runs nothing. activate.fish runs the command the same way, and the reporter also showed Python code execution through activate.xsh and bin/activate_this.py. In activate.csh, a directory named after a prompt display placeholder, such as __VIRTUAL_PROMPT_DISPLAY_TCSH__, breaks the script with Unmatched '''.
No change to quote() can stop this, because the rewrite happens after quote() ran; it defeats shlex.quote and repr() alike.
An attacker needs to influence the destination path or --prompt: a CI job or wrapper tool that builds the path from a branch or project name, or a directory in a cloned repository or unpacked archive.
The bug affects versions 20.26.6 through 21.14.1. Version 20.26.6 first quoted template values (#2768) and introduced the per-key loop.
Patches
Fixed in 21.14.2. Activation scripts now keep a placeholder name in the environment's path or prompt as plain text, and activating the example above runs nothing. Fix: https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74
Workarounds
Do not create an environment whose path or --prompt contains a placeholder name such as __VIRTUAL_NAME__, __VIRTUAL_ENV__ or __VIRTUAL_PROMPT__, and inspect the generated activation script before you source one you did not create.
Credits
Kevin Stubbings (@Kwstubbs) of GitHub Security Lab reported this issue.
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "virtualenv",
"resource_purl": "pkg:pypi/virtualenv@21.14.13",
"upstream_fixed_in": "21.14.2"
},
"package": {
"ecosystem": "Homebrew",
"name": "poetry",
"purl": "pkg:brew/poetry"
},
"ranges": [
{
"events": [
{
"introduced": "1.8.3_2"
},
{
"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": "### Impact\n\n`ViaTemplateActivator.instantiate_template` replaces the placeholders in an activation template one key at a time, each across the whole text. When a value that it already substituted and quoted contains the name of a later placeholder, the later pass rewrites that name inside the quoted literal. The inserted value brings its own quotes, which close the outer literal, and the rest of the path runs as code when a user activates the environment.\n\n`__VIRTUAL_NAME__` holds the environment\u0027s directory name, so a destination such as `A__VIRTUAL_NAME__B/x\u0027$(touch PWNED)\u0027y` is enough. In the default `activate` for bash, the `VIRTUAL_ENV` line renders as:\n\n```sh\nVIRTUAL_ENV=\u0027/tmp/t/A\u0027x\u0027\"\u0027\"\u0027$(touch PWNED)\u0027\"\u0027\"\u0027y\u0027B/x\u0027\"\u0027\"\u0027$(touch PWNED)\u0027\"\u0027\"\u0027y\u0027\n```\n\nSourcing that script runs `touch PWNED`. The same payload in a path without the placeholder name runs nothing. `activate.fish` runs the command the same way, and the reporter also showed Python code execution through `activate.xsh` and `bin/activate_this.py`. In `activate.csh`, a directory named after a prompt display placeholder, such as `__VIRTUAL_PROMPT_DISPLAY_TCSH__`, breaks the script with `Unmatched \u0027\u0027\u0027`.\n\nNo change to `quote()` can stop this, because the rewrite happens after `quote()` ran; it defeats `shlex.quote` and `repr()` alike.\n\nAn attacker needs to influence the destination path or `--prompt`: a CI job or wrapper tool that builds the path from a branch or project name, or a directory in a cloned repository or unpacked archive.\n\nThe bug affects versions 20.26.6 through 21.14.1. Version 20.26.6 first quoted template values (#2768) and introduced the per-key loop.\n\n### Patches\n\nFixed in 21.14.2. Activation scripts now keep a placeholder name in the environment\u0027s path or prompt as plain text, and activating the example above runs nothing. Fix: https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74\n\n### Workarounds\n\nDo not create an environment whose path or `--prompt` contains a placeholder name such as `__VIRTUAL_NAME__`, `__VIRTUAL_ENV__` or `__VIRTUAL_PROMPT__`, and inspect the generated activation script before you source one you did not create.\n\n### Credits\n\nKevin Stubbings (@Kwstubbs) of GitHub Security Lab reported this issue.",
"id": "BREW-poetry-CVE-2026-113776",
"modified": "2026-11-19T09:13:01Z",
"published": "2026-10-29T22:19:24Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-8rjx-v5ww-45pp"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113776"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/21.14.2"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "virtualenv activation scripts run code from a path that contains a placeholder name",
"upstream": [
"GHSA-8rjx-v5ww-45pp",
"BIT-virtualenv-2026-113776",
"CVE-2026-113776",
"PYSEC-2026-4387"
]
}
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
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
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.