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

CVE-2026-113715: virtualenv Path Traversal Vulnerability

CVE-2026-113715 is a path traversal vulnerability in virtualenv that allows attackers to inject configuration keys and weaken environment isolation. This post covers the technical details, affected versions, and mitigation strategies.

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-113715 Overview

CVE-2026-113715 affects virtualenv, the Python Packaging Authority (PyPA) tool for creating isolated Python environments. Versions prior to 21.14.9 contain a key injection flaw in the stdlib venv creator. The creator reads the generated pyvenv.cfg using str.splitlines() and merges parsed keys over virtualenv's selected configuration. An untrusted caller who influences the destination pathname can inject a Unicode line-boundary character such as U+2028 to add keys including home and include-system-site-packages. The result is a weakened isolation boundary and potential standard-library redirection.

Critical Impact

An attacker-controlled destination path can inject configuration keys that disable virtual environment isolation or redirect the interpreter to attacker-controlled standard-library files.

Affected Products

  • PyPA virtualenv versions prior to 21.14.9
  • Stdlib venv creator code path within virtualenv
  • Downstream automation and CI/CD systems invoking virtualenv with externally influenced destination paths

Discovery Timeline

  • 2026-10-20 - CVE-2026-113715 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-113715

Vulnerability Analysis

The vulnerability is a CRLF-style injection ([CWE-93]) adapted to Python's broader line-boundary semantics. The stdlib venv creator writes a pyvenv.cfg file, then reads it back using Python's str.splitlines() method. Unlike str.split('\n'), splitlines() treats several Unicode code points as line terminators, including U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR). When virtualenv embeds a destination path containing one of these characters inside pyvenv.cfg, the readback parses the path fragment as a new key-value entry. These injected keys are then merged over virtualenv's intentionally selected configuration, so the attacker-controlled values take precedence in the final written file. The builtin creator does not use this readback path and is unaffected.

Root Cause

The root cause is the mismatch between the writer and reader semantics for line boundaries. The writer treats the destination as opaque text, while the reader uses str.splitlines(), which recognizes additional Unicode separators. Trust is also misplaced because the readback value overrides the authoritative in-process configuration.

Attack Vector

Exploitation requires local attacker influence over the destination pathname passed to the stdlib venv creator. Successful injection of include-system-site-packages=true removes isolation between the virtual environment and the system Python installation. Injecting an home value can redirect the interpreter to standard-library files at a location the attacker also controls.

python
 from __future__ import annotations
 
 import logging
-from copy import copy
-from typing import TYPE_CHECKING
+from argparse import ArgumentTypeError
+from typing import TYPE_CHECKING, Final
 
 from python_discovery import PythonInfo
 
 from virtualenv.create.via_global_ref.store import handle_store_python
 from virtualenv.util.error import ProcessCallFailedError
 from virtualenv.util.path import ensure_dir
 from virtualenv.util.subprocess import run_cmd
+from virtualenv.util.text import collapse_line_boundaries
 
 from .api import ViaGlobalRefApi, ViaGlobalRefMeta
 from .builtin.cpython.common import is_mac_os_framework

Source: pypa/virtualenv commit b0008a5. The patch introduces collapse_line_boundaries and raises ArgumentTypeError on ambiguous paths before pyvenv.cfg is written.

Detection Methods for CVE-2026-113715

Indicators of Compromise

  • pyvenv.cfg files containing an include-system-site-packages = true line that is inconsistent with the invoking automation's intended configuration.
  • pyvenv.cfg files whose home value points to a path outside expected Python installation directories.
  • Destination path arguments to virtualenv or python -m venv wrappers that include the Unicode code points U+2028 or U+2029.

Detection Strategies

  • Scan source code and job definitions in CI/CD systems for calls that pass untrusted strings as the destination argument to virtualenv.
  • Audit filesystem contents of created virtual environments for pyvenv.cfg files whose values do not match the expected creation parameters.
  • Flag any filename or directory name creation request containing non-ASCII line separators prior to invocation of environment creation tools.

Monitoring Recommendations

  • Record process arguments for virtualenv and python -m venv invocations across build agents and developer workstations.
  • Alert when newly created virtual environments show include-system-site-packages = true outside approved baselines.
  • Track the installed virtualenv package version across managed hosts and flag versions earlier than 21.14.9.

How to Mitigate CVE-2026-113715

Immediate Actions Required

  • Upgrade virtualenv to version 21.14.9 or later on all build systems, developer workstations, and container base images.
  • Review automation that constructs virtual environment destination paths from external inputs and validate those inputs against an allowlist.
  • Recreate any virtual environments whose pyvenv.cfg shows unexpected home or include-system-site-packages values.

Patch Information

The fix is published in virtualenv release 21.14.9 and tracked in GitHub Security Advisory GHSA-qmx5-4p3x-wvqf. The code change in pull request #3426 rejects destinations containing line boundaries in the stdlib venv creator and writes the final configuration directly from the selected interpreter and virtualenv options rather than merging stdlib's intermediate output.

Workarounds

  • Select a non-stdlib creator such as the builtin creator, which does not use the vulnerable readback path.
  • Sanitize destination paths by stripping or rejecting characters where str.splitlines() and str.split('\n') disagree before invoking environment creation.
  • Restrict the ability of untrusted principals to supply virtual environment destination paths in shared automation.
bash
# Upgrade virtualenv to the fixed release
python -m pip install --upgrade 'virtualenv>=21.14.9'

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

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.