CVE-2026-102937 — virtualenv
Fix: pypa/virtualenv@d721ff1CVE-2026-102937 is a OS Command Injection vulnerability in virtualenv. A fix is available for virtualenv — see the affected versions and patch details below.
virtualenv: Command injection via --prompt in activate.bat (batch activator)
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-102937.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
virtualenvReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
BatchActivator.quote() returned its input unchanged, the only activator with no escaping at all. --prompt, the VIRTUALENV_PROMPT environment variable, and the config file all set the prompt, and activate.bat writes it straight into @set "VAR=value". A prompt containing a double quote closes that string early, and whatever follows runs as live cmd.exe syntax:
$ virtualenv --prompt 'x" & calc & "' venv
$ venv\Scripts\activate.bat
runs calc the moment someone activates the environment. Confirmed on a real Windows runner. Anyone who templates a prompt from untrusted input (a CI job using a branch name, a wrapper script deriving an environment name from user input) hands an attacker code execution in the shell of anyone who activates the resulting venv on Windows.
Fixed in 21.7.12 by escaping the characters cmd.exe treats as live syntax inside this construct. Fix: https://github.com/pypa/virtualenv/pull/3250
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | virtualenv | all versions | 21.7.12pip install --upgrade 'virtualenv==21.7.12' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for virtualenv, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update virtualenv to 21.7.12 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-102937 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
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…
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.Source: Red Hat security advisory for CVE-2026-102937 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift AI 3.4 | rhoai/odh-feature-server-rhel9:1791863220 | RHSA-2026:84734 |
Frequently Asked Questions
Is CVE-2026-102937 in your dependencies?
Find it across PyPI, including transitive dependencies.