PYSEC-2026-4013: virtualenv bash and fish activation scripts execute commands embedded in paths
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.7.13, the generated activate (bash and zsh) and activate.fish scripts place values already escaped by shlex.quote inside an additional quoted context. In the bash and zsh script, a crafted virtual environment path reaches VIRTUALENV when a relocated environment's recorded directory is absent; in the fish script, crafted Tcl or Tk library paths reach TCLLIBRARY or TKLIBRARY. The surplus quotes can terminate the data-only quoted run and leave shell metacharacters parsed as commands when a user sources the activation script, allowing code execution with that user's privileges. This issue is fixed in version 21.7.13.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
bitnami/virtualenvto a version that resolves this vulnerability.Fixed in 21.7.13 - Upgrade
Upgrade
virtualenvto a version that resolves this vulnerability.Fixed in 21.7.13
Event History
Frequently Asked Questions
Who is exposed to this issue?
Users who source activation scripts generated by virtualenv before 21.7.13 are exposed when those scripts contain attacker-crafted path values. Bash and zsh are affected through a relocated environment whose recorded directory is absent; fish is affected through crafted Tcl or Tk library paths.
What must an attacker do to achieve code execution?
The attacker must cause crafted path data containing shell metacharacters to be embedded in the generated activation script, then persuade or cause a user to source that script. Commands run with the privileges of the user activating the environment.
Are all activation scenarios affected?
No. The described bash and zsh path requires a relocated environment and an absent recorded directory. The fish case depends on crafted Tcl or Tk library paths being written into the activation script.
What version fixes the issue?
Upgrade virtualenv to version 21.7.13 or later. The issue is fixed in 21.7.13.