{"id":"CVE-2026-102937","aliases":["CVE-2026-102937","GHSA-x78j-v8h9-3j2q","BIT-VIRTUALENV-2026-102937","PYSEC-2026-4014"],"related":[],"kind":"vulnerability","state":"published","title":"virtualenv: Command injection via --prompt in activate.bat (batch activator)","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.7.12, BatchActivator.quote() returns prompt text unchanged before activate.bat inserts it into a cmd.exe set \"VAR=value\" statement. An attacker who influences --prompt, VIRTUALENV_PROMPT, or the corresponding configuration value can include a double quote that closes the assignment and leaves following cmd.exe operators as executable syntax. When a user activates the generated Windows environment, the injected commands run with that user's privileges. This issue is fixed in version 21.7.12.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.7.12, BatchActivator.quote() returns prompt text unchanged before activate.bat inserts it into a cmd.exe set \"VAR=value\" statement. An attacker who influences --prompt, VIRTUALENV_PROMPT, or the corresponding configuration value can include a double quote that closes the assignment and leaves following cmd.exe operators as executable syntax. When a user activates the generated Windows environment, the injected commands run with that user's privileges. This issue is fixed in version 21.7.12.","source":"cvelist"},{"lang":"en","text":"`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","format":"markdown","source":"ghsa"},{"lang":"en","text":"`BatchActivator.quote()` returned its input unchanged, the only activator with\nno escaping at all. `--prompt`, the `VIRTUALENV_PROMPT` environment variable,\nand the config file all set the prompt, and `activate.bat` writes it straight\ninto `@set \"VAR=value\"`. A prompt containing a double quote closes that string\nearly, and whatever follows runs as live cmd.exe syntax. For example, a venv\ncreated with `--prompt 'x\" & calc & \"'` runs `calc` the moment someone runs\n`activate.bat`.\n\nAnyone who templates a prompt from untrusted input (a CI job using a branch\nname, a wrapper script deriving an environment name from user input) hands an\nattacker code execution in the shell of anyone who activates the resulting venv\non Windows.\n\nFixed in 21.7.12 by escaping the characters cmd.exe treats as live syntax\ninside this construct.","format":"markdown","source":"pysec"}],"published":"2026-09-18T01:41:45.000Z","modified":"2026-11-27T06:45:48.785Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.3,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.3,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"HIGH"}],"cwes":["CWE-78"],"affected":[{"ranges":[{"version":"< 21.7.12","status":"affected"}],"vendor":"pypa","product":"virtualenv","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"21.7.12"}],"ecosystem":"PyPI","package":"virtualenv","purl":"pkg:pypi/virtualenv","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"21.7.12"}],"vendor":"virtualenv","product":"virtualenv","cpe":"cpe:2.3:a:virtualenv:virtualenv:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"21.7.12"}],"ecosystem":"PyPI","package":"virtualenv","purl":"pkg:pypi/virtualenv","source":"pysec"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"21.7.12"}],"ecosystem":"Bitnami","package":"virtualenv","purl":"pkg:bitnami/virtualenv","source":"bitnami"}],"references":[{"url":"https://github.com/pypa/virtualenv/security/advisories/GHSA-x78j-v8h9-3j2q","tags":["advisory","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/pypa/virtualenv/pull/3250","tags":["fix","issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/pypa/virtualenv/commit/d721ff140ce4afdc2a9b76751e4584e25d9fbea6","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/pypa/virtualenv/releases/tag/21.7.12","tags":["article","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-102937","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/virtualenv/PYSEC-2026-4014.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/virtualenv","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/virtualenv","tags":["package","web"],"sources":["ghsa","pysec"]}],"credits":["Bernát Gábor"],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2026-10-02T12:28:00.914Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-102937","url":"https://www.cve.org/CVERecord?id=CVE-2026-102937","licence":"CVE Terms of Use","modified":"2026-10-02T12:28:15.446Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x78j-v8h9-3j2q","url":"https://github.com/advisories/GHSA-x78j-v8h9-3j2q","licence":"CC-BY-4.0","modified":"2026-10-06T15:26:00.196Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-102937","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-102937","licence":"Public domain","modified":"2026-11-19T19:28:37.540Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-4014","url":"https://osv.dev/vulnerability/PYSEC-2026-4014","licence":"CC-BY-4.0","modified":"2026-10-06T15:26:00.196Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-VIRTUALENV-2026-102937","url":"https://osv.dev/vulnerability/BIT-VIRTUALENV-2026-102937","licence":"Apache-2.0","modified":"2026-11-27T06:45:48.785Z"}],"updatedAt":"2026-11-27T07:07:25.377Z","epss":{"score":0.00209,"percentile":0.11722,"date":"2026-12-01T12:00:22.000Z"}}