Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-113723 Overview
CVE-2026-113723 is a command injection vulnerability in virtualenv, the widely used tool for creating isolated Python environments. In versions prior to 21.14.9, caller-supplied prompt text can become executable shell syntax inside the bash activation script. An attacker who influences the --prompt value passed to virtualenv can embed backticks, dollar expansions, or other shell metacharacters. When a user later activates the environment and bash redraws the prompt, the embedded syntax executes in the user's shell. The flaw is tracked under [CWE-78] Improper Neutralization of Special Elements used in an OS Command.
Critical Impact
Arbitrary command execution in a user's interactive shell session upon activating a maliciously crafted virtual environment.
Affected Products
- virtualenv versions prior to 21.14.9
- Environments activated via the POSIX bash activate script
- zsh activation flows that re-expand PS1 under PROMPT_SUBST
Discovery Timeline
- 2026-10-20 - CVE-2026-113723 published to NVD
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2026-113723
Vulnerability Analysis
The virtualenv activation script injects the environment prompt string directly into PS1. In bash, PS1 is re-expanded on each prompt redraw when promptvars is enabled or when running in POSIX mode. This re-expansion processes dollar signs, backticks, and backslash sequences as live shell syntax rather than literal text. If the prompt string contains constructs such as `cmd` or $(cmd), those commands execute every time the shell draws the prompt.
The pre-patch script attempted to escape backslashes, dollar signs, and backticks through chained ${var//pattern/replacement} substitutions. The escaping was inconsistent across bash compatibility levels and shell modes, leaving edge cases where the attacker-controlled value reached the prompt expansion stage unescaped.
Root Cause
The root cause is unsafe interpolation of untrusted data into a shell prompt variable that undergoes secondary expansion. Rather than reference VIRTUAL_ENV_PROMPT indirectly, the activation script embedded the value directly into PS1, exposing it to bash prompt escape decoding and subsequent parameter expansion.
Attack Vector
Exploitation requires an attacker to control the --prompt argument supplied to virtualenv, for example through a malicious build script, a tampered automation pipeline, or a project configuration template. A victim must then activate the environment with source bin/activate in bash or zsh. No network access is needed, and the resulting command runs with the victim user's privileges.
# Patched activation logic from src/virtualenv/activation/bash/activate.sh
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] &&
{ [ -n "${BASH_VERSION-}" ] || [ -n "${ZSH_VERSION-}" ]; }; then
_OLD_VIRTUAL_PS1="${PS1-}"
# bash expands PS1 after decoding its prompt escapes when promptvars is on
# or in posix mode, so the prompt holds a reference to the variable and its
# value never reaches that expansion; otherwise only the decode runs and
# backslashes need doubling. zsh re-expands backslashes, dollar signs and
# backticks under PROMPT_SUBST, which a user can set after activation, and
# reads % as a prompt escape.
Source: pypa/virtualenv commit 5f48d71
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-113723
Indicators of Compromise
- Presence of shell metacharacters such as `, $(, or ${ inside the VIRTUAL_ENV_PROMPT assignment in any bin/activate script.
- Unexpected child processes spawned by interactive bash or zsh sessions immediately after source activate is run.
- Virtual environments created by automation where the --prompt argument originates from untrusted repository metadata or user input.
Detection Strategies
- Scan filesystems for activate scripts whose VIRTUAL_ENV_PROMPT or PS1 lines contain command substitution or arithmetic expansion syntax.
- Audit CI/CD logs for virtualenv invocations where --prompt receives externally sourced values.
- Compare installed virtualenv package versions against the fixed release 21.14.9 across developer and build hosts.
Monitoring Recommendations
- Monitor process creation events where the parent is an interactive shell and the grandparent is a source of an activate script.
- Alert on writes to files named activate, activate.bash, or activate.zsh outside of expected package installation flows.
- Track pip and virtualenv package upgrade events on build agents to confirm patch rollout.
How to Mitigate CVE-2026-113723
Immediate Actions Required
- Upgrade virtualenv to version 21.14.9 or later on all developer workstations, CI runners, and container base images.
- Inventory existing virtual environments and regenerate any created with --prompt values originating from untrusted sources.
- Review automation that passes repository-controlled strings to virtualenv --prompt and sanitize or hard-code those values.
Patch Information
The fix is included in virtualenv release 21.14.9 and implemented through pull request #3418. The patched script restricts prompt handling to bash and zsh, keeps the prompt literal under older bash compatibility levels, disables promptvars, and avoids nounset errors after VIRTUAL_ENV_PROMPT is unset. Full technical details are documented in GHSA-6w3r-xr62-4xcp.
Workarounds
- Set VIRTUAL_ENV_DISABLE_PROMPT=1 in the shell environment to skip the vulnerable prompt modification entirely.
- Avoid activating virtual environments created by untrusted projects until the host virtualenv is upgraded and the environment regenerated.
- Manually inspect and remove any shell metacharacters from the VIRTUAL_ENV_PROMPT line of existing bin/activate scripts.
# Upgrade virtualenv and verify the fixed version
python -m pip install --upgrade 'virtualenv>=21.14.9'
virtualenv --version
# Temporary mitigation: disable prompt modification for the session
export VIRTUAL_ENV_DISABLE_PROMPT=1
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

