CVE-2026-113776: virtualenv activation scripts run code from a path that contains a placeholder name
virtualenv is a tool for creating isolated virtual python environments. From 20.26.6 until 21.14.2, ViaTemplateActivator.instantiatetemplate() replaces placeholders one key at a time across the complete activation template, so trigger names such as VIRTUALNAME, VIRTUALENV, or VIRTUALPROMPT 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 activatethis.py. The distinct csh prompt-display token VIRTUALPROMPTDISPLAYTCSH 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
virtualenvto a version that resolves this vulnerability.Fixed in 21.14.2
Event History
Frequently Asked Questions
Which activation methods are susceptible to command execution?
Command execution can occur when the environment is activated through bash, fish, xonsh, or activate_this.py. The csh-specific __VIRTUAL_PROMPT_DISPLAY_TCSH__ token may break the generated script instead, without establishing command execution.
What must an attacker control to exploit this issue?
The attacker must be able to influence the virtual environment destination path or the value supplied through --prompt. The controlled value must contain a relevant placeholder name, such as __VIRTUAL_NAME__, __VIRTUAL_ENV__, or __VIRTUAL_PROMPT__; values without one do not trigger this mechanism.
Are all affected virtualenv installations exploitable by default?
No. Exploitation depends on attacker influence over the destination path or --prompt and on that value containing a relevant placeholder token. User interaction is also required because a user must activate the generated environment.
What version resolves the issue?
Upgrade virtualenv to version 21.14.2, which fixes the placeholder replacement behavior.