CVE-2026-102938: virtualenv prompt injection in pyvenv.cfg

CVE-2026-102938 · Severity: medium · CVSS 4 · Published 2026-09-29

virtualenv is a Python tool that creates isolated environments for running Python projects. Prior to version 21.7.11, an attacker who controls the environment prompt—through command-line arguments, environment variables, or configuration—can inject newlines and additional configuration lines into the pyvenv.cfg file. This could cause the environment to use an attacker-controlled Python interpreter instead of the intended one, potentially executing malicious code.

Technologies: Pypa Virtualenv, virtualenv (PyPI). Vendors: Pypa, PyPI.

Quick answers

Is CVE-2026-102938 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-102938 being exploited in the wild.
How severe is CVE-2026-102938?
Medium severity, with a CVSS score of 4, published 29 September 2026.
Which products and versions are affected?
Pypa Virtualenv before 21.7.11; virtualenv (PyPI) <= 21.7.10, ECOSYSTEM:introduced=0,fixed=21.7.11.
Is there a fix for CVE-2026-102938?
Yes. virtualenv (PyPI): upgrade to 21.7.11 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-102938 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-102938?
Check whether you run Pypa Virtualenv or virtualenv (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • virtualenv (PyPI): upgrade to 21.7.11 or later
    pip install "virtualenv>=21.7.11"

Technical details

PyEnvCfg.write() writes prompt values verbatim to the pyvenv.cfg file without escaping line boundaries, while _read_values() parses it with str.splitlines() and accepts the last value for duplicate keys. An attacker supplying a prompt containing recognized line separators (newline, carriage return, vertical tab, etc.) can inject additional key-value pairs, particularly the "home" key which specifies the base interpreter path. The vulnerability requires the prompt to come from outside the operator's trust boundary, such as CI systems templating branch names or tooling processing user input.

Affected products

  • pypa virtualenv before 21.7.11

Identifiers

  • CVE-2026-102938
  • GHSA-9h9j-4vrj-gf7g
  • PYSEC-2026-4012

Timeline

  • 2026-09-17: patched: Fix merged in commit a30f995 to keep pyvenv.cfg values on a single line
  • 2026-09-29: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.