virtualenv: Command injection via environment name in bash activate script
Summary
virtualenv versions before 21.14.7 do not escape the environment name correctly for both passes that bash makes over the prompt variable PS1. A crafted name containing a backslash followed by $(...) or backticks is executed as commands each time bash draws the prompt. An attacker who gets a user to activate a crafted virtual environment, for example from an untrusted repository or shared folder, can run commands with that user's privileges for as long as the shell stays open.
Affected
- virtualenv before 21.14.7 (PyPI package virtualenv, pypa/virtualenv)
- Bash activation script only
Fixed in
- 21.14.7 (fix in commit c3104e0)
- 21.14.9 is the newer release and also addresses further activation-script advisories
Workaround
- Set VIRTUAL_ENV_DISABLE_PROMPT=1 before sourcing the activate script (temporary measure)
- Activate only environments you created yourself or whose names you have checked
Exploitation
- No reports of in-the-wild exploitation found.
- CISA SSVC assessment: exploitation none, automatable no, technical impact total.
- EPSS 0.00193 (low).
- The advisory contains a reproduction example; it is not reproduced here.
Our recommendation
- Find all virtualenv installs and pins (requirements files, poetry.lock, uv.lock, CI images) and upgrade to 21.14.9 or later.
- Tell developers not to activate untrusted virtual environments until the upgrade is done.
- Apply the workaround on systems that cannot be patched immediately.
- Prioritise developer workstations and CI/build runners.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-vxj4-q4g9-crj7 github.com
- Fix commit c3104e0 github.com
- virtualenv release 21.14.7 github.com
- OSV BIT-virtualenv-2026-113725 osv.dev
- OSV GHSA-vxj4-q4g9-crj7 osv.dev
- virtualenv changelog virtualenv.pypa.io
- PyPI virtualenv 21.14.7 pypi.org
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:32.
Original description (NVD)
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.7, the bash activate script escapes the environment name for only one of the two passes bash makes over PS1, so a backslash in the name undoes the escaping and a name containing \$(...) runs as commands in the user's shell each time bash draws the prompt. This issue is fixed in version 21.14.7.
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.
