Symlink Attack Affecting virtualenv package, versions [21.14.8,21.14.9)


Severity

Recommended
0.0
low
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.14% (4th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-VIRTUALENV-21282481
  • published21 Oct 2026
  • disclosed20 Oct 2026
  • creditAnthropic's OSS Scanner

Introduced: 20 Oct 2026

NewCVE-2026-113721  (opens in a new tab)
CWE-59  (opens in a new tab)

How to fix?

Upgrade virtualenv to version 21.14.9 or higher.

Overview

Affected versions of this package are vulnerable to Symlink Attack via ViaTemplateActivator._generate() in src/virtualenv/activation/via_template.py, which checks whether a destination file exists with Path.exists() before unlinking it and writing new content. A local attacker who can race the check-then-unlink-then-write sequence can substitute a symlink or file between the unlink and the subsequent write, causing virtualenv to write attacker-influenced content to an arbitrary path with the privileges of the virtualenv-creating process. The same pattern is present in several other file-writing paths (creator.py, pyenv_cfg.py, and related modules) that were consolidated into a new atomic write_file helper by the fix.

Note: This is only exploitable when an existing output file is present at the destination path, triggering the Path.exists() / unlink() branch in ViaTemplateActivator._generate().

CVSS Base Scores

version 4.0
version 3.1