CVE-2026-113721: virtualenv symlink and hard link following in file generation

CVE-2026-113721 · Severity: medium · CVSS 4.5 · Published 2026-10-20

virtualenv is a Python tool that creates isolated environments for dependency management. Before version 21.14.9, it fails to safely replace files with the same names when generating configuration and activation scripts, allowing a local attacker with access to the destination directory to plant symlinks or hard links that redirect the generated content to arbitrary files on the system, potentially overwriting files with the attacker's permissions.

Technologies: Pypa Virtualenv, virtualenv (PyPI). Vendors: Pypa, PyPI.

Quick answers

Is CVE-2026-113721 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-113721 being exploited in the wild.
How severe is CVE-2026-113721?
Medium severity, with a CVSS score of 4.5, published 20 October 2026.
Which products and versions are affected?
Pypa Virtualenv before 21.14.9; virtualenv (PyPI) < 21.14.9, ECOSYSTEM:introduced=0,fixed=21.14.9.
Is there a fix for CVE-2026-113721?
Yes. virtualenv (PyPI): upgrade to 21.14.9 or later. Until then: Restrict write access to the parent directory of the virtualenv destination during environment creation, and ensure the destination parent remains controlled by the environment owner throughout the operation. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-113721 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-113721?
Check whether you run Pypa Virtualenv or virtualenv (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • virtualenv (PyPI): upgrade to 21.14.9 or later
    pip install "virtualenv>=21.14.9"

Restrict write access to the parent directory of the virtualenv destination during environment creation, and ensure the destination parent remains controlled by the environment owner throughout the operation.

Technical details

The vulnerability stems from unsafe file operations in ViaTemplateActivator._generate() and PyEnvCfg.write() that follow symlinks and hard links instead of atomically replacing them. A local attacker can plant a symlink to an arbitrary file before environment creation begins; when virtualenv generates pyvenv.cfg, activation scripts, or import hooks, it opens the symlink without O_EXCL, following it to write content outside the intended environment directory. Exploitation requires the attacker to control or monitor the destination parent directory and write access to the same filesystem.

Affected products

  • pypa virtualenv before 21.14.9

Identifiers

  • CVE-2026-113721
  • GHSA-558c-9hv2-4prj

Timeline

  • 2026-10-20: disclosed
  • 2026-10-17: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.