CVE-2026-102937: virtualenv Command Injection Vulnerability
HIGHCVE-2026-102937 is a HIGH command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting virtualenv libraries in the PyPI ecosystem. The issue involves command injection via --prompt in activate.bat (batch activator). Remediation is available by upgrading affected packages to version 21.7.12.
CVE-2026-102937 at a Glance
How to Fix CVE-2026-102937
To remediate this vulnerability, upgrade all affected virtualenv dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install virtualenv>=21.7.12
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show virtualenv
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-102937, inspect your installed packages using pip:
pip show virtualenv
Analyze the terminal output to locate any version of virtualenv in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 21.7.12), your application is affected.
Note: The pip show virtualenv command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In virtualenv, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-102937 Affected virtualenv Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
virtualenv
|
PyPI |
< 21.7.12
|
21.7.12
|
References
Frequently Asked Questions
What is CVE-2026-102937?
Which virtualenv versions are affected?
What version fixes CVE-2026-102937?
Is virtualenv affected?
What CWE is associated with CVE-2026-102937?
How can I check PyPI dependencies for CVE-2026-102937?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x78j-v8h9-3j2q",
"modified" : "2026-10-01T15:08:30Z",
"published" : "2026-10-01T15:08:29Z",
"aliases" : [ "CVE-2026-102937" ],
"summary" : "virtualenv: Command injection via --prompt in activate.bat (batch activator)",
"details" : "`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:\n\n```console\n$ virtualenv --prompt 'x\" & calc & \"' venv\n$ venv\\Scripts\\activate.bat\n```\n\nruns `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.\n\nFixed 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",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "virtualenv"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "21.7.12"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 21.7.11"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pypa/virtualenv/security/advisories/GHSA-x78j-v8h9-3j2q"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-102937"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/virtualenv/pull/3250"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/virtualenv/commit/d721ff140ce4afdc2a9b76751e4584e25d9fbea6"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/virtualenv/PYSEC-2026-4014.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pypa/virtualenv"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/virtualenv/releases/tag/21.7.12"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/virtualenv"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-01T15:08:29Z",
"nvd_published_at" : "2026-09-29T21:17:18Z"
}
}