Skip to main content
Vulnerability Database/CVE-2026-113719

CVE-2026-113719: virtualenv Path Traversal Vulnerability

CVE-2026-113719 is a path traversal flaw in virtualenv that allows unauthorized file deletion outside environments during creation. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113719 Overview

CVE-2026-113719 is a path traversal vulnerability [CWE-22] in virtualenv, the Python tool used to create isolated virtual environments. In versions prior to 21.14.9, the PipInstall._uninstall_previous_version() function accepts existing seed-package metadata without validation. The _uninstall_dist() helper then joins entries from top_level.txt and RECORD to site-packages without checking that resolved paths remain inside the environment. An attacker who can influence this metadata can cause virtualenv to delete files outside the target environment during creation, using the invoking user's permissions.

Critical Impact

Arbitrary file deletion outside the virtual environment root during virtualenv creation, limited to paths the invoking user can delete.

Affected Products

  • pypa/virtualenv versions prior to 21.14.9
  • Python environments reusing app-data seed caches containing attacker-influenced metadata
  • Automated CI/CD pipelines that create virtual environments on shared or multi-tenant hosts

Discovery Timeline

  • 2026-10-20 - CVE-2026-113719 published to the National Vulnerability Database (NVD)
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-113719

Vulnerability Analysis

The flaw resides in the app-data seeding path of virtualenv. When a destination directory already contains distribution metadata from a prior seed, PipInstall._uninstall_previous_version() trusts that metadata and invokes _uninstall_dist() to remove the previous package. The removal routine reads entries from top_level.txt and RECORD and joins them to the site-packages path. No containment check verifies that the resulting path resolves inside the virtual environment.

Because the deletion occurs before any later use of the environment, the attack executes during the creation step. Fresh environments without existing package metadata and environments created with --clear do not enter this cleanup path and are not affected.

Root Cause

The root cause is missing path containment validation in src/virtualenv/seed/embed/via_app_data/pip_install/base.py. Metadata entries containing relative traversal sequences (for example ../../etc), absolute file paths, or symbolic links pointing to parent directories are concatenated with site-packages and passed directly to filesystem deletion routines. This is a classic path traversal pattern [CWE-22] applied to a cleanup operation.

Attack Vector

Exploitation requires local access and write influence over the app-data seed cache or over package metadata that virtualenv later reuses. An attacker who stages a crafted top_level.txt or RECORD file in a reusable seed directory can wait for another user, service account, or CI job to invoke virtualenv. When creation occurs, the cleanup pass deletes files on paths the attacker named, using the invoking user's deletion rights.

text
// Patch note from docs/changelog/3428.bugfix.rst
+Limit seed-package cleanup to entries inside the environment. Ignore metadata entries that name the environment itself,
+a directory holding the metadata (a blank ``top_level.txt`` line names ``site-packages``), or resolve outside the
+environment, with a warning. Launcher entries inside the environment remain supported.

Source: GitHub Commit e3cea6f

Detection Methods for CVE-2026-113719

Indicators of Compromise

  • Unexpected file or directory deletions on hosts shortly after a virtualenv or python -m venv invocation using the pypa virtualenv backend.
  • Presence of top_level.txt or RECORD files in the app-data seed cache (typically under ~/.local/share/virtualenv/wheel/) containing absolute paths, .. sequences, or symlinked parents.
  • Audit log entries showing deletions outside the virtual environment root originating from the Python interpreter running virtualenv.

Detection Strategies

  • Monitor for unlink, rmdir, and recursive-delete syscalls spawned by Python processes during environment creation, flagging targets outside the environment path.
  • Inventory installed virtualenv versions across build hosts and developer workstations; alert on any version below 21.14.9.
  • Review shared or world-writable app-data seed directories for metadata files not owned by the invoking user.

Monitoring Recommendations

  • Enable filesystem auditing (auditd on Linux, FSEvents or EDR telemetry on macOS) scoped to home directories and system paths referenced by multi-user build agents.
  • Track package manager install events for virtualenv upgrades and ensure CI base images rebuild after upgrading.
  • Correlate virtualenv process execution with subsequent delete operations outside the declared project workspace.

How to Mitigate CVE-2026-113719

Immediate Actions Required

  • Upgrade virtualenv to version 21.14.9 or later across all developer workstations, build agents, and container base images.
  • Audit shared app-data seed directories and remove any metadata files of unknown provenance.
  • Rebuild CI/CD images that pin an older virtualenv version to pull the fixed release.

Patch Information

The fix is included in virtualenv release 21.14.9, delivered through Pull Request #3428 and commit e3cea6f. The patch limits seed-package cleanup to entries inside the environment, ignores metadata entries that resolve outside the environment, and emits a warning when such entries are encountered. See GHSA-hhxq-47xx-j5xx for the full security advisory.

Workarounds

  • Pass --clear when invoking virtualenv to force a clean recreation; this path bypasses the vulnerable cleanup logic.
  • Create virtual environments only in fresh directories that contain no prior package metadata.
  • Restrict permissions on the app-data seed cache so that only the owning user can write metadata files.
bash
# Upgrade virtualenv to the fixed release
python -m pip install --upgrade 'virtualenv>=21.14.9'

# Verify the installed version
python -m virtualenv --version

# Temporary workaround: force a clean environment creation
python -m virtualenv --clear /path/to/new/env

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.