Every CVE Search/ Get API key

CVE-2026-113776

virtualenv activation scripts run code from a path that contains a placeholder name

7.8 HighFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
Low
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

0.27%Unchanged since Oct 21, 2026
90%50%10%1%

What each source reports

CVE List Score used 7.8

virtualenv activation scripts run code from a path that contains a placeholder name

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.

Record
CVE-2026-113776
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-78, CWE-94
Updated
2026-11-02
EUVDEUVD-2026-106868 7.8

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.

Record
EUVD-2026-106868
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-8rjx-v5ww-45pp 7.8

virtualenv activation scripts run code from a path that contains a placeholder name

Impact

ViaTemplateActivator.instantiate_template replaces the placeholders in an activation template one key at a time, each across the whole text. When a value that it already substituted and quoted contains the name of a later placeholder, the later pass rewrites that name inside the quoted literal. The inserted value brings its own quotes, which close the outer literal, and the rest of the path runs as code when a user activates the environment.

__VIRTUAL_NAME__ holds the environment's directory name, so a destination such as A__VIRTUAL_NAME__B/x'$(touch PWNED)'y is enough. In the default activate for bash, the VIRTUAL_ENV line renders as:

VIRTUAL_ENV='/tmp/t/A'x'"'"'$(touch PWNED)'"'"'y'B/x'"'"'$(touch PWNED)'"'"'y'

Sourcing that script runs touch PWNED. The same payload in a path without the placeholder name runs nothing. activate.fish runs the command the same way, and the reporter also showed Python code execution through activate.xsh and bin/activate_this.py. In activate.csh, a directory named after a prompt display placeholder, such as __VIRTUAL_PROMPT_DISPLAY_TCSH__, breaks the script with Unmatched '''.

No change to quote() can stop this, because the rewrite happens after quote() ran; it defeats shlex.quote and repr() alike.

An attacker needs to influence the destination path or --prompt: a CI job or wrapper tool that builds the path from a branch or project name, or a directory in a cloned repository or unpacked archive.

The bug affects versions 20.26.6 through 21.14.1. Version 20.26.6 first quoted template values (#2768) and introduced the per-key loop.

Patches

Fixed in 21.14.2. Activation scripts now keep a placeholder name in the environment's path or prompt as plain text, and activating the example above runs nothing. Fix: https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74

Workarounds

Do not create an environment whose path or --prompt contains a placeholder name such as __VIRTUAL_NAME__, __VIRTUAL_ENV__ or __VIRTUAL_PROMPT__, and inspect the generated activation script before you source one you did not create.

Credits

Kevin Stubbings (@Kwstubbs) of GitHub Security Lab reported this issue.

Record
GHSA-8rjx-v5ww-45pp
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-78, CWE-94
Updated
2026-11-02
NVD 7.8

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.

Record
CVE-2026-113776
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-78, CWE-94
Updated
2026-11-02
OSV 7.8

virtualenv activation scripts run code from a path that contains a placeholder name

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.

Record
CVE-2026-113776
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-78, CWE-94
Updated
2026-11-02
OSVDEBIAN-CVE-2026-113776 7.8

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.

Record
DEBIAN-CVE-2026-113776
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 5 moreShow less
OSVGHSA-8rjx-v5ww-45pp 7.8

virtualenv activation scripts run code from a path that contains a placeholder name

Impact

ViaTemplateActivator.instantiate_template replaces the placeholders in an activation template one key at a time, each across the whole text. When a value that it already substituted and quoted contains the name of a later placeholder, the later pass rewrites that name inside the quoted literal. The inserted value brings its own quotes, which close the outer literal, and the rest of the path runs as code when a user activates the environment.

__VIRTUAL_NAME__ holds the environment's directory name, so a destination such as A__VIRTUAL_NAME__B/x'$(touch PWNED)'y is enough. In the default activate for bash, the VIRTUAL_ENV line renders as:

VIRTUAL_ENV='/tmp/t/A'x'"'"'$(touch PWNED)'"'"'y'B/x'"'"'$(touch PWNED)'"'"'y'

Sourcing that script runs touch PWNED. The same payload in a path without the placeholder name runs nothing. activate.fish runs the command the same way, and the reporter also showed Python code execution through activate.xsh and bin/activate_this.py. In activate.csh, a directory named after a prompt display placeholder, such as __VIRTUAL_PROMPT_DISPLAY_TCSH__, breaks the script with Unmatched '''.

No change to quote() can stop this, because the rewrite happens after quote() ran; it defeats shlex.quote and repr() alike.

An attacker needs to influence the destination path or --prompt: a CI job or wrapper tool that builds the path from a branch or project name, or a directory in a cloned repository or unpacked archive.

The bug affects versions 20.26.6 through 21.14.1. Version 20.26.6 first quoted template values (#2768) and introduced the per-key loop.

Patches

Fixed in 21.14.2. Activation scripts now keep a placeholder name in the environment's path or prompt as plain text, and activating the example above runs nothing. Fix: https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74

Workarounds

Do not create an environment whose path or --prompt contains a placeholder name such as __VIRTUAL_NAME__, __VIRTUAL_ENV__ or __VIRTUAL_PROMPT__, and inspect the generated activation script before you source one you did not create.

Credits

Kevin Stubbings (@Kwstubbs) of GitHub Security Lab reported this issue.

Record
GHSA-8rjx-v5ww-45pp
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-78, CWE-94
Updated
2026-11-02
OSVUBUNTU-CVE-2026-113776 7.8

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.

Record
UBUNTU-CVE-2026-113776
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVAZL-110106 No score

CVE-2026-113776 affecting package python-virtualenv for versions less than 20.36.1-10

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.

Record
AZL-110106
Updated
2026-11-07
OSVBIT-virtualenv-2026-113776 No score

virtualenv activation scripts run code from a path that contains a placeholder name

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.

Record
BIT-virtualenv-2026-113776
Updated
2026-11-02
OSVROOT-APP-PYPI-CVE-2026-113776 No score

CVE-2026-113776 in virtualenv - Patched by Root

Root has patched CVE-2026-113776 in the virtualenv package for Root:PyPI. Multiple fixed versions available.

Record
ROOT-APP-PYPI-CVE-2026-113776
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
virtualenv
PyPI
20.26.6 to 21.14.1
21.14.2
python-virtualenv
Azure Linux:3
before 20.36.1-10
20.36.1-10
virtualenv
Bitnami
20.26.6 up to 21.14.2
21.14.2
python-virtualenv
Debian:12
All versions, plus listed versions
20.17.1+ds-120.19.0+ds-120.21.0+ds-120.23.0+ds-120.23.0+ds-2
Show 28 moreShow less
20.24.1+ds-120.24.6+ds-120.24.6+ds-220.25.0+ds-120.25.0+ds-220.25.1+ds-120.26.1+ds-120.26.2+ds-120.26.6+ds-120.27.0+ds-120.28.0+ds-120.29.1+ds-120.29.3+ds-120.30.0+ds-120.30.0+ds-220.30.0+ds-320.31.2+ds-120.33.1+ds-120.34.0+ds-120.35.3+ds-120.35.4+ds-120.36.1+ds-120.38.0+ds-121.2.0+ds-121.2.4+ds-121.3.1+ds-121.4.1+ds-121.5.1+ds-1
None known
python-virtualenv
Debian:13
All versions, plus listed versions
20.31.2+ds-120.31.2+ds-1+deb13u120.33.1+ds-120.34.0+ds-120.35.3+ds-1
Show 8 moreShow less
20.35.4+ds-120.36.1+ds-120.38.0+ds-121.2.0+ds-121.2.4+ds-121.3.1+ds-121.4.1+ds-121.5.1+ds-1
None known
python-virtualenv
Debian:14
All versions, plus listed versions
20.31.2+ds-120.33.1+ds-120.34.0+ds-120.35.3+ds-120.35.4+ds-1
Show 7 moreShow less
20.36.1+ds-120.38.0+ds-121.2.0+ds-121.2.4+ds-121.3.1+ds-121.4.1+ds-121.5.1+ds-1
None known
virtualenv
PyPI
20.26.6 up to 21.14.2, plus listed versions
20.27.020.27.120.28.020.28.120.29.0
Show 45 moreShow less
20.29.120.29.220.29.320.30.020.31.020.31.120.31.220.32.020.33.020.33.120.34.020.35.020.35.120.35.220.35.320.35.420.36.020.36.120.38.020.39.020.39.121.0.021.1.021.10.021.11.021.11.121.12.021.12.121.13.021.14.021.14.121.2.021.2.121.2.221.2.321.2.421.3.021.3.121.3.221.3.321.4.021.4.121.4.221.4.321.5.0
21.14.2
virtualenv
Root:PyPI
before 20.26.6+aikido.5
20.26.6+aikido.521.3.2+aikido.221.3.2+aikido.321.7.1+aikido.321.13.0+aikido.121.7.5+aikido.421.14.1+aikido.121.2.4+aikido.321.7.4+aikido.521.7.8+aikido.321.9.0+aikido.221.7.13+aikido.221.11.1+aikido.221.7.10+aikido.521.7.4+aikido.621.6.1+aikido.321.4.2+aikido.221.9.0+aikido.321.7.5+aikido.521.7.1+aikido.421.12.1+aikido.321.7.9+aikido.421.4.3+aikido.321.2.4+aikido.421.7.16+aikido.221.3.2+aikido.4
python-virtualenv
Ubuntu:14.04:LTS
All versions, plus listed versions
1.10.1-11.11-11.11-21.11.4-11.11.4-1ubuntu1
None known
python-virtualenv
Ubuntu:16.04:LTS
All versions, plus listed versions
1.11.6+ds-114.0.5+ds-114.0.5+ds-214.0.5+ds-415.0.0+ds-1
Show 6 moreShow less
15.0.0+ds-215.0.1+ds-115.0.1+ds-215.0.1+ds-315.0.1+ds-3ubuntu115.0.1+ds-3ubuntu1.1
None known
Show 6 moreShow less
Affected packages
PackageAffectedFixed
python-virtualenv
Ubuntu:18.04:LTS
All versions, plus listed versions
15.1.0+ds-115.1.0+ds-1.1
None known
python-virtualenv
Ubuntu:Pro:20.04:LTS
All versions, plus listed versions
15.1.0+ds-215.1.0+ds-2build115.1.0+ds-2ubuntu120.0.13-120.0.17-120.0.17-1ubuntu0.320.0.17-1ubuntu0.420.0.17-1ubuntu0.4+esm1
None known
python-virtualenv
Ubuntu:Pro:22.04:LTS
All versions, plus listed versions
20.4.6+ds-220.10.0+ds-120.12.1+ds-120.13.0+ds-120.13.0+ds-220.13.0+ds-2ubuntu0.1~esm1
None known
python-virtualenv
Ubuntu:Pro:24.04:LTS
All versions, plus listed versions
20.24.1+ds-120.24.6+ds-120.24.6+ds-220.25.0+ds-120.25.0+ds-220.25.0+ds-2ubuntu0.1~esm1
None known
python-virtualenv
Ubuntu:26.10
All versions, plus listed versions
20.36.1+ds-121.4.1+ds-121.5.1+ds-1
None known
python-virtualenv
Ubuntu:26.04:LTS
All versions, plus listed versions
20.31.2+ds-120.35.3+ds-120.35.4+ds-120.36.1+ds-1
None known

History

History
RecordedChangedSources
affectedOSV
factsOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-113776 is a high vulnerability (CVSS 7.8) in Pypa Virtualenv, published October 20, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.27%, the 19th percentile. Fixed in virtualenv 21.14.2.

References

Show 4 moreShow less
This page doesn't list everything

Left out here: 24 versions. The JSON record has them.

MoveEnter Open