# CVE-2026-113776: virtualenv command injection in activation script template substitution

Source: https://junglewise.ai/threats/cve-2026-113776-virtualenv-is-a-tool-for-creating-isolated-virtual-python  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-10-20. Updated: 2026-10-20  
License: CC BY 4.0 with a link back

CVE-2026-113776 · Severity: high · CVSS 7.8 · Published 2026-10-20

virtualenv is a tool that creates isolated Python environments with activation scripts. Versions 20.26.6 to 21.14.1 contain a flaw where placeholder tokens in directory paths or prompts are replaced sequentially, allowing path or directory names containing tokens like __VIRTUAL_NAME__ to break out of quotes and execute arbitrary commands when the activation script runs in bash, fish, xonsh, or activate_this.py.

Technologies: [Pypa Virtualenv](https://junglewise.ai/threats/technologies/pypa-virtualenv), [virtualenv (PyPI)](https://junglewise.ai/threats/technologies/virtualenv). Vendors: [Pypa](https://junglewise.ai/threats/vendors/pypa), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-113776 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-113776 being exploited in the wild.

**How severe is CVE-2026-113776?** High severity, with a CVSS score of 7.8, published 20 October 2026.

**Which products and versions are affected?** Pypa Virtualenv 20.26.6 to 21.14.1; virtualenv (PyPI) >= 20.26.6, <= 21.14.1, ECOSYSTEM:introduced=20.26.6,fixed=21.14.2.

**Is there a fix for CVE-2026-113776?** Yes. virtualenv (PyPI): upgrade to 21.14.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-113776 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-113776?** Check whether you run Pypa Virtualenv or virtualenv (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- virtualenv (PyPI): upgrade to 21.14.2 or later

  ```sh
  pip install "virtualenv>=21.14.2"
  ```


## Technical details

The ViaTemplateActivator.instantiate_template() function performs sequential placeholder substitution across the activation script template, allowing nested placeholder names within quoted paths to be substituted multiple times. An attacker who controls the virtual environment destination path or the --prompt parameter can inject placeholder token names (e.g., __VIRTUAL_NAME__, __VIRTUAL_ENV__, __VIRTUAL_PROMPT__) that will be expanded on subsequent passes, breaking quote context and executing arbitrary shell code. The csh variant breaks the script without establishing code execution via the __VIRTUAL_PROMPT_DISPLAY_TCSH__ token.

## Affected products

- PyPA virtualenv 20.26.6 to 21.14.1

## Identifiers

- CVE-2026-113776
- GHSA-8rjx-v5ww-45pp

## Timeline

- 2026-10-20: disclosed
- 2026-10-01: patched: Version 21.14.2 released with fix

## References

- [https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74](https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74)
- [https://github.com/pypa/virtualenv/releases/tag/21.14.2](https://github.com/pypa/virtualenv/releases/tag/21.14.2)

## Related threats

- [virtualenv bash activate command injection via unescaped prompt](https://junglewise.ai/threats/cve-2026-115586-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv command injection in Fish shell activation script](https://junglewise.ai/threats/cve-2026-113732-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [pypa virtualenv command injection in bash activate script](https://junglewise.ai/threats/cve-2026-113726-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv bash activate script command injection in PS1](https://junglewise.ai/threats/cve-2026-113725-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv safe_delete symlink mode change vulnerability](https://junglewise.ai/threats/cve-2026-113724-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
