pypa virtualenv: Code execution via placeholder names in activation scripts
Summary
virtualenv versions 20.26.6 up to but not including 21.14.2 replace template placeholders in a sequential, key-by-key manner. If the destination path or the --prompt value contains a placeholder name such as __VIRTUAL_NAME__, __VIRTUAL_ENV__ or __VIRTUAL_PROMPT__, that text can be rewritten during a later substitution pass, breaking out of the quoting. When a user activates the environment with bash, fish, xonsh or activate_this.py, the remaining part of the path can then be executed as commands. The attacker must be able to influence the path or prompt, and the victim must activate the environment.
Affected
- virtualenv >= 20.26.6, < 21.14.2
Fixed in
- Fixed in virtualenv 21.14.2 (GitHub advisory GHSA-8rjx-v5ww-45pp)
Workaround
- Do not create environments whose path or --prompt contains a placeholder name (__VIRTUAL_NAME__, __VIRTUAL_ENV__, __VIRTUAL_PROMPT__, __VIRTUAL_PROMPT_DISPLAY_TCSH__).
- Inspect the generated activation script before sourcing an environment you did not create.
Exploitation
- CISA SSVC: exploitation none, automatable no, technical impact total.
- No reports of exploitation in the wild were found; this status is unknown rather than confirmed absent.
- EPSS about 0.00269 according to one mirror.
Our recommendation
- Upgrade virtualenv to 21.14.2 or later, and check lockfiles and tooling, since it is often a transitive dependency.
- Do not activate environments created from untrusted paths, names or templates.
- Prioritise shared build and CI hosts that create environments from externally supplied names.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-8rjx-v5ww-45pp github.com
- Fix commit 602b266 github.com
- virtualenv release 21.14.2 github.com
- OSV GHSA-8rjx-v5ww-45pp osv.dev
- virtualenv changelog virtualenv.pypa.io
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 1 Nov 2026, 23:23.
Original description (NVD)
virtualenv is a tool for creating isolated virtual python environments. From 20.26.6 until 21.14.2, ViaTemplateActivator.instantiate_template() replaces placeholders one key at a time across the complete activation template, so trigger names such as __VIRTUAL_NAME__, __VIRTUAL_ENV__, or __VIRTUAL_PROMPT__ inside an already substituted and quoted environment path or prompt can be replaced during a later pass. The later value's quoting can close the earlier literal and execute the remaining path when a user activates the environment through bash, fish, xonsh, or activate_this.py. The distinct csh prompt-display token __VIRTUAL_PROMPT_DISPLAY_TCSH__ can instead break the generated script without establishing command execution. The attacker must influence the destination path or --prompt, and a value without a relevant placeholder name does not trigger this mechanism. This issue is fixed in version 21.14.2.
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
