CVE-2026-113713
Virtualenv may expose stale app‑data links, allowing unauthorized cache path control.
- CVSS 4.4
- CWE-377
- Configuration Issues
- Local
virtualenv is a tool for creating isolated virtual python environments. From 21.14.8 until 21.14.10, the app-data seeder can leave an environment linked to temporary package files that virtualenv deletes when creation finishes. The environment-variable and configuration-file forms of symlink_app_data can enable this state even though the command-line flag is disabled for temporary app-data. The resulting environment depends on a cache pathname that its owner no longer controls. This issue is fixed in version 21.14.10.
- CWE
- CWE-377
- CVSS base score
- 4.4
- Published
- 2026-10-20
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Configuration Issues
- Subcategory
- Local File Inclusion (LFI)
- Accessibility scope
- Local
- Impact
- Information Disclosure
- Affected component
- virtualenv
- Fixed by upgrading
- Yes
Solution
Upgrade virtualenv to version 21.14.10 or later.
Vulnerable code sample
import os
import pathlib
import shutil
import subprocess
def create_virtualenv(env_path: str, config_path: str | None = None) -> None:
"""
Creates a virtualenv at ``env_path``. If ``config_path`` points to a
virtualenv configuration file that contains ``symlink_app_data = true``,
the app‑data directory will be symlinked to the location specified by the
environment variable ``VIRTUALENV_SYMLINK_APP_DATA``.
"""
# VULNERABLE: environment‑controlled symlink target enables LFI
symlink_target = os.getenv('VIRTUALENV_SYMLINK_APP_DATA')
if symlink_target:
target_path = pathlib.Path(symlink_target).resolve()
else:
target_path = None
# Create the base environment
subprocess.check_call([shutil.which('python'), '-m', 'virtualenv', env_path])
# Apply configuration if provided
if config_path:
with open(config_path, 'r', encoding='utf-8') as cfg:
for line in cfg:
if line.strip().startswith('symlink_app_data'):
enabled = line.split('=')[1].strip().lower() == 'true'
if enabled and target_path:
app_data = pathlib.Path(env_path) / 'app-data'
if app_data.exists():
app_data.unlink()
app_data.symlink_to(target_path, target_is_directory=True)Patched code sample
import os
import pathlib
import shutil
import subprocess
def create_virtualenv(env_path: str, config_path: str | None = None) -> None:
"""
Creates a virtualenv at ``env_path``. If ``config_path`` points to a
virtualenv configuration file that contains ``symlink_app_data = true``,
the app‑data directory will be symlinked only when the caller explicitly
passes a safe path via the ``symlink_target`` argument.
"""
# FIX: ignore untrusted environment variable and require explicit safe argument
symlink_target = None # environment variable no longer used
# Create the base environment
subprocess.check_call([shutil.which('python'), '-m', 'virtualenv', env_path])
# Apply configuration if provided
if config_path:
with open(config_path, 'r', encoding='utf-8') as cfg:
for line in cfg:
if line.strip().startswith('symlink_app_data'):
enabled = line.split('=')[1].strip().lower() == 'true'
if enabled and symlink_target:
app_data = pathlib.Path(env_path) / 'app-data'
if app_data.exists():
app_data.unlink()
app_data.symlink_to(pathlib.Path(symlink_target), target_is_directory=True)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): copy from temporary app-data (#3437) (pypa/virtualenv)
src/virtualenv/seed/embed/via_app_data/via_app_data.py · FromAppData.__init__
Cite this entry
@misc{vaitp:cve2026113713,
title = {{Virtualenv may expose stale app‑data links, allowing unauthorized cache path control.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-113713},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-113713/}}
}
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 ::
