Description
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.13.0, the bash activate script that zsh also sources leaves the environment name unescaped; from 21.13.0 until 21.14.4, it escapes backslashes, dollar signs, and backticks only when BASH_VERSION is set, so zsh receives the raw value. The script assigns that value to PS1. In zsh with PROMPT_SUBST, an attacker-influenced environment directory, --prompt, or VIRTUALENV_PROMPT value containing command, parameter, or arithmetic expansion syntax can therefore execute commands in the user's shell each time the prompt is drawn. A percent sign is separately interpreted as a zsh prompt escape but does not by itself execute commands. Plain zsh with PROMPT_SUBST disabled and bash are not affected by this mechanism. This issue is fixed in version 21.14.4.
Published: 2026-10-20
Score: 7.8 High
EPSS: < 1% Very Low
KEV: No
Impact: Command Execution (Local)
Action: Immediate Patch
AI Analysis

Impact

virtualenv’s activate script assigns the environment name to the shell prompt variable PS1 without sanitizing special characters. When a user runs the activated environment in zsh with the PROMPT_SUBST option enabled, the prompt is re-evaluated each time it is drawn, allowing an attacker who can influence the environment directory name or set the VIRTUALENV_PROMPT variable to inject shell metacharacters that are expanded and executed as commands. This flaw therefore provides local command execution within the user's shell context and could be leveraged for privilege escalation if the user’s shell is running with elevated privileges. The weakness aligns with CWE‑116 (Improper Encoding) and CWE‑78 (OS Command Injection).

Affected Systems

The issue affects PyPA’s virtualenv tool versions prior to 21.14.4, including the range 21.13.0 through 21.14.3, documented in the release notes and commit history. Users can verify their installed version and upgrade to 21.14.4 or later, where the vulnerability is fixed.

Risk and Exploitability

The vulnerability carries a CVSS score of 7.8, indicating a high severity. The EPSS score is below 1%, suggesting a relatively low likelihood of exploitation at present. It is not listed in the CISA Known Exploited Vulnerabilities catalog. The most likely attack vector is a local adversary who can control the name of an activated virtual environment or the VIRTUALENV_PROMPT variable on a system running zsh with PROMPT_SUBST enabled; each prompt redraw will execute any injected command.

Generated by OpenCVE AI on October 21, 2026 at 16:36 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade virtualenv to version 21.14.4 or later.
  • If an upgrade is not immediately possible, ensure that the shell is not running zsh with PROMPT_SUBST enabled, or switch to bash for virtualenv sessions.
  • Validate or sanitize all virtual environment directory names and VIRTUALENV_PROMPT values so they contain no shell metacharacters, and restrict the creation of virtualenv directories to trusted users.

Generated by OpenCVE AI on October 21, 2026 at 16:36 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-5vjq-rrrf-7h2q virtualenv activate runs commands from the environment name in zsh with PROMPT_SUBST
History

Wed, 28 Oct 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Thu, 22 Oct 2026 13:15:00 +0000

Type Values Removed Values Added
First Time appeared Pypa
Pypa virtualenv
Vendors & Products Pypa
Pypa virtualenv

Wed, 21 Oct 2026 12:30:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Tue, 20 Oct 2026 22:15:00 +0000

Type Values Removed Values Added
Description virtualenv is a tool for creating isolated virtual python environments. Prior to 21.13.0, the bash activate script that zsh also sources leaves the environment name unescaped; from 21.13.0 until 21.14.4, it escapes backslashes, dollar signs, and backticks only when BASH_VERSION is set, so zsh receives the raw value. The script assigns that value to PS1. In zsh with PROMPT_SUBST, an attacker-influenced environment directory, --prompt, or VIRTUALENV_PROMPT value containing command, parameter, or arithmetic expansion syntax can therefore execute commands in the user's shell each time the prompt is drawn. A percent sign is separately interpreted as a zsh prompt escape but does not by itself execute commands. Plain zsh with PROMPT_SUBST disabled and bash are not affected by this mechanism. This issue is fixed in version 21.14.4.
Title virtualenv activate runs commands from the environment name in zsh with PROMPT_SUBST
Weaknesses CWE-116
CWE-78
References
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-27T21:31:29.377Z

Reserved: 2026-10-20T16:03:14.863Z

Link: CVE-2026-113726

cve-icon Vulnrichment

Updated: 2026-10-27T21:31:25.626Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-10-20T22:19:29.423

Modified: 2026-10-27T22:17:23.223

Link: CVE-2026-113726

cve-icon Redhat

Severity : Important

Publid Date: 2026-10-20T22:05:24Z

Links: CVE-2026-113726 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-22T13:00:06Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-78

    Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')