CVE-2026-113732: virtualenv activate.fish runs commands from a path or prompt with a backslash before a quote
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX shlex.quote() even though fish interprets backslashes and single quotes differently. An attacker-influenced environment path, --prompt, or VIRTUALENVPROMPT value containing a backslash before a quote can therefore terminate the generated fish literal and execute command substitution when the user sources activate.fish. This issue is fixed in version 21.14.2.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
virtualenvto a version that resolves this vulnerability.Fixed in 21.14.2
Event History
Frequently Asked Questions
Who is exposed to this issue?
Users of virtualenv versions earlier than 21.14.2 who use the fish shell and source a generated activate.fish script are exposed when the environment path, --prompt value, or VIRTUALENV_PROMPT value is attacker-influenced and contains a backslash immediately before a quote.
What must an attacker control to exploit it?
The attacker must be able to influence the virtual environment path, the --prompt option, or the VIRTUALENV_PROMPT value used when generating the activation script. Exploitation also requires a user to source the resulting activate.fish script in fish.
Are other activation shells affected by the described flaw?
The issue described is specific to FishActivator and the generated activate.fish script. The vulnerable behavior comes from using POSIX shlex.quote() despite fish handling backslashes and single quotes differently.
How can I remediate the issue?
Upgrade virtualenv to version 21.14.2 or later. If upgrading is not immediately possible, avoid sourcing activate.fish scripts generated from attacker-influenced environment paths or prompt values, especially values containing a backslash before a quote.
How can I determine whether a generated activation script is risky?
Review the inputs used to generate it: the environment path, --prompt value, and VIRTUALENV_PROMPT. A script is at risk when one of those attacker-influenced values contains a backslash immediately before a quote and the script is sourced by fish.