CVE-2026-113715
Path injection via line‑break characters in pyvenv.cfg alters home/include‑system‑site‑packages settings.
- CVSS 2.0
- CWE-93
- Input Validation and Sanitization
- Local
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the stdlib venv creator reads generated pyvenv.cfg with str.splitlines() and merges parsed keys over virtualenv's selected configuration. An untrusted caller who influences the destination pathname can include a line-boundary character such as U+2028 to inject keys including home and include-system-site-packages, causing path data to change configuration structure before final output. Setting include-system-site-packages to true weakens environment isolation, while an altered home can change which standard-library files the interpreter loads if the attacker also controls that location. The builtin creator does not use this readback path. This issue is fixed in version 21.14.9.
- CWE
- CWE-93
- CVSS base score
- 2.0
- Published
- 2026-10-20
- OWASP
- A05 Security Misconfiguration
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- virtualenv
- Fixed by upgrading
- Yes
Solution
Upgrade virtualenv to version 21.14.9 or newer.
Vulnerable code sample
import pathlib
def load_venv_cfg(cfg_path: pathlib.Path) -> dict:
"""
Parse a pyvenv.cfg file generated by the stdlib venv creator.
Returns a mapping of configuration keys to values.
"""
cfg = {}
# VULNERABLE: using splitlines() allows line‑boundary chars to inject extra keys
for line in cfg_path.read_text(encoding="utf-8").splitlines():
if not line or line.startswith('#'):
continue
key, _, value = line.partition('=')
cfg[key.strip()] = value.strip()
return cfgPatched code sample
import pathlib
def load_venv_cfg(cfg_path: pathlib.Path) -> dict:
"""
Parse a pyvenv.cfg file generated by the stdlib venv creator.
Returns a mapping of configuration keys to values.
"""
cfg = {}
# FIX: use split('\\n') to avoid treating line‑boundary characters as line breaks
for line in cfg_path.read_text(encoding="utf-8").split('\n'):
if not line or line.startswith('#'):
continue
key, _, value = line.partition('=')
cfg[key.strip()] = value.strip()
return cfgPublished 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(create): reject ambiguous venv paths (#3426) (pypa/virtualenv)
src/virtualenv/create/via_global_ref/venv.py,src/virtualenv/create/via_global_ref/venv.py · Venv.set_pyenv_cfg
Cite this entry
@misc{vaitp:cve2026113715,
title = {{Path injection via line‑break characters in pyvenv.cfg alters home/include‑system‑site‑packages settings.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-113715},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-113715/}}
}
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 ::
