virtualenv: bash activator stores unescaped --prompt in PS1, enabling command execution on later prompt expansion (CVE-2026-115586)
Severity: high · Patch status: patched · Since 2026-10-22 · CVE-2026-115586
A regression in virtualenv 21.14.9 (introduced by the fix for GHSA-6w3r-xr62-4xcp) removed unconditional escaping of $ and backticks from the bash bin/activate script. When promptvars is off at activation time, the caller-supplied --prompt value is stored raw in PS1; since promptvars and posix mode are runtime shell state, re-enabling prompt expansion (shopt -s promptvars, set -o posix) or spawning an interactive child bash that inherits exported PS1 causes bash to expand the stored value and execute embedded command substitution. An attacker controlling the prompt value (e.g. via project metadata or tool config) gains command execution as the user sourcing bin/activate. Fixed in 21.14.13; 21.14.8 is not affected.
What to do
- Upgrade virtualenv to 21.14.13 or later and recreate any virtual environments created with 21.14.9–21.14.12
- Audit CI pipelines and tooling that pass --prompt sourced from project metadata or untrusted config; treat such prompts as attacker-controlled
- Avoid sourcing bin/activate in shells where promptvars/posix mode may later be enabled, and unset/scrub exported PS1 in non-interactive contexts
- Check whether any environments were activated in shells with prompt expansion re-enabled; investigate for signs of executed command substitution
Fixed versions
Sources
All live incidents on Threat Watch