IT SBIT Services
Schneeberger
DEEN
CVE tracker

pypa virtualenv: Code execution via placeholder names in activation scripts

CVE-2026-113776High 7.8

← All vulnerabilities

Summary

virtualenv versions 20.26.6 up to but not including 21.14.2 replace template placeholders in a sequential, key-by-key manner. If the destination path or the --prompt value contains a placeholder name such as __VIRTUAL_NAME__, __VIRTUAL_ENV__ or __VIRTUAL_PROMPT__, that text can be rewritten during a later substitution pass, breaking out of the quoting. When a user activates the environment with bash, fish, xonsh or activate_this.py, the remaining part of the path can then be executed as commands. The attacker must be able to influence the path or prompt, and the victim must activate the environment.

Affected

  • virtualenv >= 20.26.6, < 21.14.2

Fixed in

  • Fixed in virtualenv 21.14.2 (GitHub advisory GHSA-8rjx-v5ww-45pp)

Workaround

  • Do not create environments whose path or --prompt contains a placeholder name (__VIRTUAL_NAME__, __VIRTUAL_ENV__, __VIRTUAL_PROMPT__, __VIRTUAL_PROMPT_DISPLAY_TCSH__).
  • Inspect the generated activation script before sourcing an environment you did not create.

Exploitation

  • CISA SSVC: exploitation none, automatable no, technical impact total.
  • No reports of exploitation in the wild were found; this status is unknown rather than confirmed absent.
  • EPSS about 0.00269 according to one mirror.

Our recommendation

  • Upgrade virtualenv to 21.14.2 or later, and check lockfiles and tooling, since it is often a transitive dependency.
  • Do not activate environments created from untrusted paths, names or templates.
  • Prioritise shared build and CI hosts that create environments from externally supplied names.

Public exploits

PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.

Research sources

Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 1 Nov 2026, 23:23.

Original description (NVD)

virtualenv is a tool for creating isolated virtual python environments. From 20.26.6 until 21.14.2, ViaTemplateActivator.instantiate_template() replaces placeholders one key at a time across the complete activation template, so trigger names such as __VIRTUAL_NAME__, __VIRTUAL_ENV__, or __VIRTUAL_PROMPT__ inside an already substituted and quoted environment path or prompt can be replaced during a later pass. The later value's quoting can close the earlier literal and execute the remaining path when a user activates the environment through bash, fish, xonsh, or activate_this.py. The distinct csh prompt-display token __VIRTUAL_PROMPT_DISPLAY_TCSH__ can instead break the generated script without establishing command execution. The attacker must influence the destination path or --prompt, and a value without a relevant placeholder name does not trigger this mechanism. This issue is fixed in version 21.14.2.

NVD references (3)

Sources

The tracker combines official, freely usable data sources – updated continuously:

This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.

Affected? We can help.

We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.