virtualenv: Command injection via generated POSIX console launchers
Summary
virtualenv writes console scripts with a /bin/sh launcher whose interpreter path is only partially quoted when the path contains a space or the shebang exceeds 127 bytes. Command substitutions and backticks in the destination path are then executed by the shell. An attacker who can influence the environment destination can run commands with the user's privileges when that user later runs a generated launcher; creating or activating the environment does not trigger it.
Affected
- pypa virtualenv versions prior to 21.14.9
- Environments created or modified by affected versions, including pip-installed console scripts that were regenerated by pip's vendored distlib
Fixed in
- virtualenv 21.14.9 (released 2026-10-17)
- Existing launchers must be regenerated; upgrading virtualenv alone does not repair them
- A later pip install or upgrade inside an environment can reintroduce an affected launcher
Workaround
- Do not create environments in destination paths that other users or untrusted input can influence
- Recreate existing environments with virtualenv 21.14.9 or later instead of only upgrading the package
- Re-check launchers after any pip install or upgrade inside an environment
Exploitation
- CISA SSVC: exploitation status PoC, automatable: no, technical impact: total
- No evidence of exploitation in the wild found in the research; treat as unknown
- Trigger requires local influence on the destination path and user execution of a generated launcher
Our recommendation
- Find virtualenv installations and lockfiles, including those pulled in by tox, pre-commit or similar tools, and pin to 21.14.9 or later
- Recreate existing environments and verify that launchers are regenerated
- Re-run this check after pip upgrades inside affected environments
- Prioritise developer workstations and CI runners that use shared or untrusted project paths
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-c978-59m8-c77v github.com
- virtualenv release 21.14.9 github.com
- Fix commit 2519941 github.com
- Pull request #3417 github.com
- OSV entry BIT-virtualenv-2026-113722 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:33.
Original description (NVD)
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, virtualenv's ScriptMakerCustom and pip pass an incompletely quoted interpreter path to distlib ScriptMaker when generating POSIX console scripts. When the path contains a space or produces a shebang longer than 127 bytes, distlib emits a /bin/sh wrapper whose double-quoted interpreter path still expands command substitutions and backticks. An attacker who influences the environment destination can therefore execute commands with the user's privileges when the user later runs a generated launcher; environment creation and activation do not trigger the command. Existing launchers are not repaired by upgrading virtualenv alone and must be regenerated, while a later independent pip installation or upgrade can reintroduce an affected launcher because pip's vendored distlib is unchanged. The virtualenv fix is released in version 21.14.9.
NVD references (5)
- https://github.com/pypa/virtualenv/commit/2519941bed33ee0d3ac99277f67913e439e476a9
- https://github.com/pypa/virtualenv/pull/3417
- https://github.com/pypa/virtualenv/releases/tag/21.14.9
- https://github.com/pypa/virtualenv/security/advisories/GHSA-c978-59m8-c77v
- https://github.com/pypa/virtualenv/security/advisories/GHSA-c978-59m8-c77v
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.
