OESA-2026-4905: python-virtualenv security update
Virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module. Note though, that the venv module does not offer all features of this library (e.g. cannot create bootstrap scripts, cannot create virtual environments for other python versions than the host python, not relocatable, etc.). Tools in general as such still may prefer using virtualenv for its ease of upgrading (via pip), unified handling of different Python versions and some more advanced features. Security Fix(es):
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.13.0, the bash activate script that zsh also sources leaves the environment name unescaped; from 21.13.0 until 21.14.4, it escapes backslashes, dollar signs, and backticks only when BASHVERSION is set, so zsh receives the raw value. The script assigns that value to PS1. In zsh with PROMPTSUBST, an attacker-influenced environment directory, --prompt, or VIRTUALENVPROMPT value containing command, parameter, or arithmetic expansion syntax can therefore execute commands in the user's shell each time the prompt is drawn. A percent sign is separately interpreted as a zsh prompt escape but does not by itself execute commands. Plain zsh with PROMPTSUBST disabled and bash are not affected by this mechanism. This issue is fixed in version 21.14.4.(CVE-2026-113726)
virtualenv is a tool for creating isolated virtual python environments. From 20.26.6 until 21.14.2, ViaTemplateActivator.instantiatetemplate() replaces placeholders one key at a time across the complete activation template, so trigger names such as VIRTUALNAME, VIRTUALENV, or VIRTUALPROMPT inside an already substituted and quoted environment path or prompt can be replaced during a later pass. The later value's quoting can close the earlier literal and execute the remaining path when a user activates the environment through bash, fish, xonsh, or activatethis.py. The distinct csh prompt-display token VIRTUALPROMPTDISPLAYTCSH can instead break the generated script without establishing command execution. The attacker must influence the destination path or --prompt, and a value without a relevant placeholder name does not trigger this mechanism. This issue is fixed in version 21.14.2.(CVE-2026-113776)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
openeuler/python-virtualenvto a version that resolves this vulnerability.Fixed in 20.26.6-3.oe2403sp3 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 21.14.4
Event History
Frequently Asked Questions
Which users are exposed to command execution through the activation script?
Users are exposed when they source a virtual environment activation script in zsh with PROMPT_SUBST enabled. The issue occurs when the prompt value contains command, parameter, or arithmetic expansion syntax.
What attacker control is needed to exploit this issue?
An attacker needs to influence the virtual environment directory name, the value supplied through --prompt, or the VIRTUALENV_PROMPT environment variable. The malicious value is assigned to PS1 and can execute whenever zsh draws the prompt.
Which virtualenv versions are described as affected?
Versions before 21.13.0 leave the environment name unescaped in the bash activation script that zsh also sources. Versions from 21.13.0 through 21.14.4 escape certain characters only when BASH_VERSION is set, leaving zsh with the raw value.