PyPA virtualenv: Zsh command injection in activate script (CVE-2026-113726)
The virtualenv activation script for zsh is vulnerable to command injection via the environment prompt when PROMPT_SUBST is enabled, allowing arbitrary code execution upon prompt rendering.
CVE search metadata
CVE search record: CVE-2026-113726. Severity: high. CVSS: 7.8. EPSS: 0.23%. KEV: no. Product: virtualenv (<= 21.14.3), virtualenv (20.26.6-21.14.1). Brief: PyPA virtualenv: Zsh command injection in activate script (CVE-2026-113726). Brief link: https://feed.craftedsignal.io/briefs/2026-10-21-virtualenv-command-injection/
CVE search record: CVE-2026-113776. KEV: no. Product: virtualenv (<= 21.14.3), virtualenv (20.26.6-21.14.1). Brief: PyPA virtualenv: Zsh command injection in activate script (CVE-2026-113726). Brief link: https://feed.craftedsignal.io/briefs/2026-10-21-virtualenv-command-injection/
Triage facts
Revision 1- Applicability
- virtualenv (<= 21.14.3), virtualenv (20.26.6-21.14.1)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 4 public sources
- Freshness
- Revision 1Oct 21, 17:06 UTC
- Vulnerabilities
- 2 CVEs
- Source quality
- A1Likely
What's new
- 1. added coverage for virtualenv (20.26.6-21.14.1) Oct 21, 17:06 via ghsa
The virtualenv activate script fails to properly sanitize the environment name when setting the PS1 prompt variable for zsh. In environments where the PROMPT_SUBST option is enabled (a default in frameworks like oh-my-zsh), the shell performs parameter and command substitution on the prompt string. An attacker who can influence the environment name or prompt string - such as through directory naming or CI/CD job metadata - can inject shell metacharacters (e.g., $(...), backticks) to execute arbitrary commands every time the prompt is rendered. This vulnerability affects virtualenv versions through 21.14.3.
Impact
Successful exploitation allows arbitrary command execution with the privileges of the user running the zsh session. This can be triggered by sourcing a malicious virtualenv activation script, which may be delivered via cloned repositories, unpacked archives, or CI/CD pipelines that dynamically name virtual environments based on external inputs.
Recommendation
- Update virtualenv to version 21.14.4 or later.
- For environments where immediate patching is not possible, set the environment variable
VIRTUAL_ENV_DISABLE_PROMPT=1before sourcing anyactivatescript. - Disable
PROMPT_SUBSTin zsh configurations if not strictly required for shell functionality. - Audit existing virtual environment directories for suspicious characters in their naming convention, particularly those sourced within automated build environments or CI/CD runners.
Immediate actions
Upgrade virtualenv to 21.14.4 on all development and CI/CD systems.
Mitigations
Set VIRTUAL_ENV_DISABLE_PROMPT=1 in zsh profiles or CI/CD configuration files.
CVE-2026-113726