CVE-2026-113721: virtualenv: Generated files can follow existing destination links
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, ViaTemplateActivator.generate() removes an existing output only when Path.exists() is true, allowing a dangling symlink to survive and redirect generated activation content, while PyEnvCfg.write() opens pyvenv.cfg without first replacing an existing symbolic or hard link. Another local account that prepares final entries inside the destination can therefore cause environment creation to create or overwrite files outside the requested tree with constrained virtualenv-generated content and the invoking user's permissions. The destination parent must remain controlled by the environment owner during creation; concurrent parent-directory replacement is a separate concern. This issue is fixed in version 21.14.9.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
virtualenvto a version that resolves this vulnerability.Fixed in 21.14.9
Event History
Frequently Asked Questions
Who is realistically exposed to this issue?
Users who create virtual environments in destinations where another local account can pre-create or alter final path entries are exposed. The attacker must be able to place symbolic or hard links inside the target environment destination before generation occurs.
What does an attacker need to do to exploit it?
A local attacker prepares a dangling symlink for generated activation files, or an existing symbolic or hard link for pyvenv.cfg, within the destination. When the victim creates the environment, virtualenv may write constrained generated content to a file outside the requested environment tree using the victim's permissions.
Are all destination-directory races covered by this issue?
No. The destination parent must remain controlled by the environment owner during creation for this issue; concurrent replacement of the parent directory is identified as a separate concern.
What version fixes the issue?
Upgrade virtualenv to version 21.14.9 or later. Versions prior to 21.14.9 are affected.