Impact
Virtualenv’s script generator for POSIX console scripts fails to fully quote the interpreter path when creating consoles. If a destination directory contains spaces or produces a shebang longer than 127 bytes, distlib emits a /bin/sh wrapper whose quoted interpreter path still expands shell substitutions and backticks. An attacker who can influence the destination name can inject a command into the path, which runs with the current user’s privileges when the launcher is later executed. The flaw does not affect environment creation or activation directly, but the launcher provides a later execution window.
Affected Systems
The vulnerability affects PyPA’s virtualenv tool prior to version 21.14.9. It is tied to the bundled distlib used by virtualenv’s ScriptMakerCustom and pip pass components, and can reappear when pip upgrades to a version that still includes the unpatched distlib. All virtual environments created with affected releases are potentially compromised unless the launchers are regenerated.
Risk and Exploitability
With a CVSS score of 7.8 the flaw is considered high impact. The EPSS score is not available, so the exploitation likelihood is unclear, but the change is currently in use until the user recreates the environment. The vulnerability is not listed in CISA KEV. Attackers who control the environment destination—such as automated deployment scripts or local developers—can trigger the flaw by naming a directory that forces the shebang to exceed 127 bytes or includes shell metacharacters. Applying the 21.14.9 release mitigates the issue.
OpenCVE Enrichment
Github GHSA