CVE-2026-102937
virtualenv: virtualenv: Arbitrary code execution via unescaped prompt in Windows activation script
Severity
ImportantRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · September 30, 2026
Updated · November 3, 2026
Description
A flaw was found in virtualenv. An attacker can achieve arbitrary code execution by supplying specially crafted prompt values or environment configurations containing unescaped quote characters when generating Windows virtual environments. When a user executes the resulting activation script, the injected commands run with the privileges of that user.
Statement
An IMPORTANT severity command injection flaw was found in virtualenv, a tool for creating isolated Python virtual environments that is shipped as a bundled dependency in Red Hat offerings such as Red Hat OpenShift AI, Red Hat Enterprise Linux UBI container images, Red Hat Hardened Images components, and Fedora/EPEL community projects. On Windows, virtualenv's BatchActivator did not escape the prompt value before writing it into the cmd.exe set "VAR=value" statement of a generated activate.bat script. An attacker who can influence the prompt value, via the --prompt option, the VIRTUALENV_PROMPT environment variable, or the corresponding configuration setting, can supply a double quote that terminates the assignment and injects arbitrary cmd.exe commands. When a user activates the generated virtual environment on Windows, the injected commands run with that user's privileges, resulting in arbitrary code execution. The vulnerability is limited to the Windows batch activation script because the injected syntax is cmd.exe-specific. Exploitation requires the attacker to influence the prompt text and a user to activate the crafted environment, so scenarios that template the prompt from untrusted input, such as CI jobs deriving prompts from branch names, are most exposed. Some Red Hat components that bundle virtualenv are not affected because the vulnerable code or the component itself is not present in the shipped versions. For the affected Red Hat and community offerings the impact is rated IMPORTANT, and because virtualenv reaches these products as a dependency, fixes are being pursued through the delegated product and community maintainers rather than a direct Red Hat security update. Red Hat scores this flaw 7.8 (CVSS:3.1) while the upstream CVEORG record scores it 7.3 (CVSS:4.0); the difference reflects differing assessments of attack complexity and required user interaction, and both scores place the flaw in the high severity range.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability. The upstream project has fixed this issue in virtualenv 21.7.12, so upgrading to a version that includes this fix is recommended where available. As a precaution, avoid deriving virtualenv prompt values (the --prompt option, the VIRTUALENV_PROMPT environment variable, or the corresponding configuration setting) from untrusted input on Windows.
CVSS / CWE
CVSS 3.1 · 7.8CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CWE-78 · Improper Neutralization of Special Elements used in an OS Command