CVE-2026-102938
Description
A flaw was found in virtualenv. An attacker capable of influencing environment configuration or prompt settings can inject unauthorized configuration entries into the environment configuration file by providing values containing line boundaries. This flaw allows the attacker to override core settings such as the base interpreter path, potentially leading to arbitrary code execution or environment tampering when the virtual environment is executed.
Statement
A flaw was found in virtualenv, a tool for creating isolated Python virtual environments that is bundled in a number of Red Hat offerings, including Red Hat Enterprise Linux, Red Hat OpenShift AI, and other layered products and containers, as well as in Fedora and EPEL community builds. Red Hat rates this flaw as having Moderate impact. virtualenv writes prompt values verbatim into the line-oriented pyvenv.cfg file, while its reader parses the file with str.splitlines() and accepts the last value for duplicate keys. An attacker who can influence prompt input -- the --prompt command-line option, the VIRTUALENV_PROMPT environment variable, or a configuration-derived value such as a CI job templating an untrusted branch name -- can inject line boundaries and additional configuration keys, including home, into the generated pyvenv.cfg. Because tooling reads home to locate the base interpreter, a consumer that trusts the file can be redirected to an attacker-selected interpreter, potentially resulting in arbitrary code execution or environment tampering when the virtual environment is used. Exploitation requires the prompt value to come from outside the operator's trust boundary: where the operator supplies the prompt directly, they already control the command line, and the effect is corruption of their own environment rather than privilege gain. This is why Red Hat assesses the impact as Moderate, while the upstream project published the advisory with low severity. Fixes for affected Red Hat products and streams are being pursued by the responsible component and product teams under delegated resolution; some community and out-of-support-scope streams will not receive an update.
Mitigation
Strip line boundaries (such as newline, carriage return, and other Unicode line-separator characters) from any value before using it as --prompt or VIRTUALENV_PROMPT, and do not pass externally influenced data -- for example user-supplied strings or CI-derived values such as branch names -- as the virtualenv prompt. Ensure the VIRTUALENV_PROMPT environment variable and any configuration file that sets the prompt are sourced only from trusted input. The upstream project fixed this issue in virtualenv 21.7.11 by collapsing line boundaries when writing pyvenv.cfg, so updating to a version that contains this fix resolves the issue. For Red Hat products that bundle virtualenv, apply updates through the respective product channels.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 7 | N/A | N/A |
| Attack Vector | Local | N/A | N/A |
| Attack Complexity | High | N/A | N/A |
| Privileges Required | None | N/A | N/A |
| User Interaction | Required | N/A | N/A |
| Scope | Unchanged | N/A | N/A |
| Confidentiality | High | N/A | N/A |
| Integrity Impact | High | N/A | N/A |
| Availability Impact | High | N/A | N/A |
Vector
Red Hat: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Integrity
Technical Impact: Modify Application Data
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.