CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-102938

CVE-2026-102938: Configuration Injection and Local Execution Hijack in virtualenv

Alon Barad
Alon Barad
Software Engineer

Oct 1, 2026·6 min read·32 visits

Executive Summary (TL;DR)

virtualenv prior to 21.7.11 is vulnerable to configuration injection. By injecting unicode line-boundary characters into the prompt configuration parameter, an attacker can override the home configuration key, redirecting downstream python executions to a malicious binary.

An input validation vulnerability in the virtualenv package allows local execution hijacking via configuration injection. When generating the pyvenv.cfg configuration file, user-controlled parameters such as prompt options are written verbatim without sanitizing line-boundary sequences. This allows attackers to inject arbitrary configuration options, causing the tool to read malicious base interpreter paths.

Vulnerability Overview & Attack Surface

The Python virtualenv tool isolates dependencies by generating standalone virtual environments, each containing its own package repository and configuration metadata. The core configuration is maintained in a flat, line-delimited key-value configuration file named pyvenv.cfg located in the root of each virtual environment.

This configuration file dictates parameters such as the environment's base interpreter directory, system package access, and the active environment prompt string. The vulnerability surfaces when virtualenv processes user-controlled parameter values, including --prompt or environment variables, during initialization.

Prior to version 21.7.11, virtualenv did not validate or sanitize line boundaries in these user-defined configuration fields. This oversight creates an attack surface where a local attacker or automated process supplying parameters can inject configuration directives, resulting in unauthorized control over the environment's execution parameters.

Root Cause & Parser Weaknesses

The root cause of CVE-2026-102938 lies in a mismatch between how configuration parameters are serialized to disk and how they are parsed during read operations. When generating the environment, the PyEnvCfg.write() method writes prompt strings and other parameters directly to pyvenv.cfg without validating the absence of line boundaries.

Conversely, when reading these configurations, the parser PyEnvCfg._read_values() reads the raw text and utilizes Python's built-in str.splitlines() method to isolate lines. Python's str.splitlines() function is designed to handle multiple Unicode newline boundaries. It splits strings on ten distinct character sequences, including line feed \n, carriage return \r, vertical tab \v, form feed \f, unit separators, next line \x85, and Unicode paragraph separators.

By injecting any of these ten recognized characters into a prompt configuration field, an attacker can prematurely terminate the current configuration entry and introduce new, independent lines. Because virtualenv parses files sequentially and retains the last encountered value for duplicate keys, an attacker can append a second home directive. This overrides the legitimate base directory path defined earlier in the file.

Code Path and Patch Analysis

Let us examine the differences in the implementation of the configuration serialization between vulnerable and fixed releases. In vulnerable versions of virtualenv, configuration parameters are written sequentially without validation.

# Vulnerable serialization in PyEnvCfg.write()
def write(self):
    with open(self.path, "w", encoding="utf-8") as f:
        for key, value in self.values.items():
            # Values are written directly, allowing embedded newlines to escape
            f.write(f"{key} = {value}\n")

To address this security flaw, the maintainers introduced a strict sanitization helper called _one_line inside src/virtualenv/create/pyenv_cfg.py. This utility matches all ten Unicode line-terminating sequences recognized by the interpreter's splitting logic and replaces them with a single space character, neutralizing potential configuration injections.

# Patched implementation in virtualenv 21.7.11
from typing import Final
 
_LINE_BOUNDARIES: Final[tuple[str, ...]] = (
    "\n",
    "\r",
    "\v",
    "\f",
    "\x1c",
    "\x1d",
    "\x1e",
    "\x85",
    chr(0x2028),  # Unicode line separator
    chr(0x2029),  # Unicode paragraph separator
)
 
def _one_line(text: str) -> str:
    """Replaces line boundaries with a space to prevent configuration injection."""
    for boundary in _LINE_BOUNDARIES:
        text = text.replace(boundary, " ")
    return text
 
# Secure writing inside PyEnvCfg.write()
# Applying the validation function to both keys and values prevents line escapes
line = f"{_one_line(key)} = {_one_line(normalized_value)}"

This defensive approach is robust because it directly mirrors the line-splitting logic of str.splitlines(). By neutralizing the exact set of delimiters parsed as new lines, the patch guarantees that a value cannot be structured to define multiple config attributes.

Exploitation Vector & Execution Flow Hijacking

The exploitation flow depends on an attacker's ability to influence the configuration parameters of a virtual environment during its initialization phase. This vector is relevant in automated contexts, such as multi-tenant hosting platforms or CI/CD pipelines where repository names or branches are used to populate the environment's prompt string.

To initiate the attack, the adversary passes a crafted argument to the --prompt CLI flag, containing an inline carriage return or line separator followed by a spoofed home key. When the file is written, the raw byte sequence formats the configuration file such that the parser interprets it as two separate attributes.

home = /usr/bin
include-system-site-packages = false
version = 3.10.12
prompt = isolated_env
home = /tmp/attacker_controlled_binaries
prompt = final_stub

When a downstream agent executes the Python virtual environment, the loader parses pyvenv.cfg. The second home entry is read last, overriding the legitimate path. The loader then redirects directory searches for core library dependencies and interpreter execution to /tmp/attacker_controlled_binaries, executing a payload.

Impact Assessment & Threat Context

The impact of CVE-2026-102938 is focused on environment integrity and local privilege execution control. An attacker who successfully hijacks the virtual environment's configuration can execute arbitrary binaries whenever the environment is activated or called by automated build steps.

This vector is relevant in cloud build servers and continuous integration systems. In these environments, automated tasks often generate virtual environments programmatically using input derived from unverified external Git commit metadata, tags, or pull request payloads. This enables remote injection vectors leading to execution context hijacking.

According to the CVSS v4.0 evaluation, the vulnerability carries a score of 5.8 with local attack vector characteristics. The rating reflects low confidentiality impact, but high integrity impact due to the redirection of the virtual environment's underlying Python execution framework.

Remediation & Detection Strategies

Remediating CVE-2026-102938 requires updating the virtualenv library across all build hosts, local environments, and orchestration servers. The maintainers have addressed the issue in version 21.7.11 and all subsequent releases.

For systems where an immediate upgrade is unfeasible, developers should enforce strict input filtering of configuration strings in wrapper scripts. Scripts invoking virtualenv must sanitize input variables to strip the ten recognized Unicode line boundaries before passing parameters to the command line.

Security teams can identify compromised environments by scanning systems for anomalous configuration layouts. A validation tool can read pyvenv.cfg files and verify that critical parameters like home are not defined multiple times within the configuration file, signaling an ongoing injection attempt.

Official Patches

pypaPull Request to implement line boundary sanitization for pyvenv.cfg values

Fix Analysis (1)

Technical Appendix

CVSS Score
5.8/ 10
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N
EPSS Probability
0.04%
Top 100% most exploited

Affected Systems

Python environments utilizing virtualenv configurationsCI/CD build pipelines and automated testing hosts executing virtualenv creation scripts

Affected Versions Detail

Product
Affected Versions
Fixed Version
virtualenv
pypa
< 21.7.1121.7.11
AttributeDetail
CWE IDCWE-93
Attack VectorLocal
CVSS v4.0 Score5.8
EPSS Score0.00043
ImpactHigh Integrity, Low Confidentiality, Low Availability
Exploit Statusnone
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1574Hijack Execution Flow
Persistence / Privilege Escalation / Defense Evasion
T1059.006Command and Scripting Interpreter: Python
Execution
T1546Event Triggered Execution
Execution / Persistence
CWE-93
Improper Neutralization of CRLF Sequences ('CRLF Injection')

The application copies an input string containing CRLF or other line-delimiter characters into a line-oriented output stream or file without sanitization, allowing the alteration of the logical structure.

Vulnerability Timeline

Vulnerability reported to virtualenv maintainers
2026-09-16
Maintainers commit fix and publish version 21.7.11
2026-09-17
GitHub Advisory and CVE details publicly disclosed
2026-09-29

References & Sources

  • [1]GHSA-9h9j-4vrj-gf7g Advisory
  • [2]NVD CVE-2026-102938 Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•26 minutes ago•CVE-2026-62297
7.5

CVE-2026-62297: Uncontrolled Memory Allocation and Denial of Service in ag-psd

An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 1 hour ago•CVE-2026-126297
7.5

CVE-2026-126297: Algorithmic Complexity Denial of Service in NLTK ConllCorpusReader

CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).

Amit Schendel
Amit Schendel
3 views•12 min read
•about 2 hours ago•CVE-2026-126298
7.5

CVE-2026-126298: Quadratic Algorithmic Complexity Denial of Service in NLTK Tree.chomsky_normal_form

CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.

Alon Barad
Alon Barad
6 views•12 min read
•about 3 hours ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
5 views•10 min read
•about 4 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 5 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read