VAITP Dataset

← Back to the dataset

CVE-2026-113719

Path traversal deletion in virtualenv's uninstall step allows overwriting outside env.

  • CVSS 4.5
  • CWE-22
  • Input Validation and Sanitization
  • Remote

virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, PipInstall._uninstall_previous_version() accepts existing seed-package metadata and _uninstall_dist() joins entries from top_level.txt and RECORD to site-packages without checking containment. When a reused destination contains distribution metadata influenced by another account, relative traversal, absolute entries, or linked parents can cause app-data reseeding to delete files outside the environment or the environment root with the invoking user's permissions, provided that user has deletion rights over the named paths. The deletion occurs during environment creation before any later use of the environment. Fresh environments without existing package metadata and creation with –clear do not enter this cleanup path. This issue is fixed in version 21.14.9.

CVSS base score
4.5
Published
2026-10-20
OWASP
A04 Insecure Design
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
virtualenv
Fixed by upgrading
Yes

Solution

Upgrade virtualenv to version 21.14.9 or later.

Vulnerable code sample

import os

class PipInstall:
    def __init__(self, env_root):
        self.env_root = env_root

    def _uninstall_dist(self, top_level_entries, record_entries):
        # VULNERABLE: deletes paths without ensuring they stay within env_root
        for entry in set(top_level_entries + record_entries):
            target = os.path.join(self.env_root, entry)
            if os.path.isfile(target):
                os.remove(target)

    def _uninstall_previous_version(self, metadata_dir):
        top_level_path = os.path.join(metadata_dir, 'top_level.txt')
        record_path = os.path.join(metadata_dir, 'RECORD')
        with open(top_level_path, 'r') as f:
            top_level = [line.strip() for line in f if line.strip()]
        with open(record_path, 'r') as f:
            record = [line.split(',')[0] for line in f if line.strip()]
        self._uninstall_dist(top_level, record)

Patched code sample

import os

class PipInstall:
    def __init__(self, env_root):
        self.env_root = os.path.abspath(env_root)

    def _uninstall_dist(self, top_level_entries, record_entries):
        # FIX: ensure deletions stay within the environment root
        for entry in set(top_level_entries + record_entries):
            target = os.path.abspath(os.path.join(self.env_root, entry))
            if target.startswith(self.env_root + os.sep) and os.path.isfile(target):
                os.remove(target)

    def _uninstall_previous_version(self, metadata_dir):
        top_level_path = os.path.join(metadata_dir, 'top_level.txt')
        record_path = os.path.join(metadata_dir, 'RECORD')
        with open(top_level_path, 'r') as f:
            top_level = [line.strip() for line in f if line.strip()]
        with open(record_path, 'r') as f:
            record = [line.split(',')[0] for line in f if line.strip()]
        self._uninstall_dist(top_level, record)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • 🐛 fix(seed): contain metadata cleanup (#3428) (pypa/virtualenv)
    src/virtualenv/seed/embed/via_app_data/pip_install/base.py, src/virtualenv/seed/embed/via_app_data/pip_install/base.py · PipInstall._uninstall_dist, src/virtualenv/seed/embed/via_app_data/pip_install/base.py · PipInstall._uninstall_previous_version

Cite this entry

@misc{vaitp:cve2026113719,
  title        = {{Path traversal deletion in virtualenv's uninstall step allows overwriting outside env.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-113719},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-113719/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.