Description
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.
Published: 2026-10-20
Score: 4.5 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Local Privilege Escalation
Action: Patch Now
AI Analysis

Impact

A local account can prepare a symbolic or hard link in the destination directory before virtualenv creates the environment. The virtualenv routine _generate() removes an existing output file only when Path.exists() is true, and PyEnvCfg.write() opens pyvenv.cfg without replacing a pre‑existing link. Consequently, a dangling link is left and the generated activation files are written to the target path the link points to, outside the intended environment tree. This flaw allows an attacker to cause virtualenv to create or overwrite files wherever the link points, potentially modifying system files or dropping malicious code, effectively elevating the attacker’s privilege within the host system. The weakness is an improper path handling that can be classified as CWE‑59.

Affected Systems

All installations of the pypa virtualenv package older than version 21.14.9, regardless of operating system, are affected because the flaw resides in the core environment creation logic.

Risk and Exploitability

The CVSS score of 4.5 indicates a moderate severity. The exploit requires the attacker to be able to create or modify a symbolic or hard link in the destination directory, which is a local privilege scenario. EPSS information is not available, and the vulnerability is not listed in the CISA KEV catalog, suggesting current exploitation activity is limited. However, because the bug permits unauthorized file writes outside the expected environment tree, the potential damage—from tampering with environment configuration to inserting malicious code—can be significant if an attacker can access the directory used for environment creation. The vulnerability is fixed in virtualenv 21.14.9; therefore the risk diminishes once the package is updated.

Generated by OpenCVE AI on October 20, 2026 at 22:47 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade virtualenv to version 21.14.9 or newer.
  • Ensure the environment’s parent directory is owned by the user creating the environment and is not writable by other local accounts.
  • If immediate update is not possible, restrict write permissions on the target directory and avoid using symlinks in that location during virtual environment creation.

Generated by OpenCVE AI on October 20, 2026 at 22:47 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-558c-9hv2-4prj virtualenv: Generated files can follow existing destination links
History

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

Type Values Removed Values Added
Metrics ssvc

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


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

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

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

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Moderate


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

Type Values Removed Values Added
Description 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.
Title virtualenv: Generated files can follow existing destination links
Weaknesses CWE-59
References
Metrics cvssV3_1

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


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-28T16:41:59.056Z

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

Link: CVE-2026-113721

cve-icon Vulnrichment

Updated: 2026-10-28T16:41:53.012Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-10-20T20:17:18.653

Modified: 2026-10-28T17:17:42.903

Link: CVE-2026-113721

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-10-20T19:46:28Z

Links: CVE-2026-113721 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-22T13:30:05Z

Weaknesses
  • CWE-59

    Improper Link Resolution Before File Access ('Link Following')