Oct 24, 2026·5 min read·11 visits
Legacy multibyte encodings swallow escaping backslashes in virtualenv xonsh activation scripts, leading to shell literal breakout and code injection.
A code injection vulnerability in pypa/virtualenv prior to version 21.14.9 allows arbitrary command execution in xonsh shells using legacy multibyte encodings when sourcing activate.xsh.
pypa/virtualenv is a foundational component of the Python ecosystem used to generate isolated virtual environments. When initializing an environment, virtualenv writes shell-specific activation scripts such as activate.xsh for xonsh shells. These scripts embed metadata including environment destination paths and custom prompt titles supplied during creation.
Prior to version 21.14.9, virtualenv formatted prompt names and path literals using Python's repr() function inside XonshActivator.quote(). This implementation allowed non-ASCII UTF-8 characters to be formatted directly into generated activation scripts.
When xonsh parses the resulting script on systems configured with legacy multibyte character encodings (such as GBK, CP932, or Big5 via $XONSH_ENCODING), character decoding misalignment occurs. An attacker who controls virtual environment prompts or installation target directory names can inject arbitrary xonsh or Python code that executes when the target user sources activate.xsh.
The vulnerability resides in string literal quoting within XonshActivator.quote(). The xonsh shell treats activate.xsh activation files as executable Python source code. To escape dynamic values embedded in template files, XonshActivator.quote() relied on repr(string).
When repr() processes non-ASCII strings in Python 3, it outputs printable non-ASCII characters directly as raw UTF-8 bytes while escaping single quotes and special control bytes using a backslash (\, byte 0x5C). If xonsh executes on a system where $XONSH_ENCODING specifies a multibyte encoding, it decodes activate.xsh using that multibyte decoder rather than UTF-8.
In multibyte character encodings like GBK, certain non-ASCII UTF-8 character byte sequences contain trailing bytes equal to 0x5C. The legacy decoder combines the preceding character byte with the 0x5C backslash byte, processing both as a single double-byte character. Consequently, the backslash is swallowed during decoding and fails to escape the subsequent quote (0x27). The string literal terminates prematurely, causing remaining input bytes to be evaluated as arbitrary statements.
In src/virtualenv/activation/xonsh/__init__.py, the original static method quote() delegated string quoting directly to repr():
# Unpatched implementation
@staticmethod
def quote(string: str) -> str:
"""Quote as a Python literal — xonsh parses the activation script as Python."""
return repr(string)To resolve this vulnerability, commit e5fc2e6e189a877ff559af288919e3525d13e5e0 replaced repr(string) with ascii(string):
# Patched implementation
@staticmethod
def quote(string: str) -> str:
"""Keep literals independent of the encoding xonsh uses to read the script."""
return ascii(string)By utilizing ascii(), all non-ASCII characters are explicitly converted into 7-bit ASCII escape sequences (such as \uXXXX or \xXX). Because the generated output consists exclusively of 7-bit ASCII bytes (0x00–0x7F), no character byte can be paired as a multibyte lead byte in encodings like GBK or Big5. This eliminates backslash-swallowing and secures literal boundaries across all target decoders.
Exploitation requires supplying a crafted non-ASCII string as either the virtual environment target path or the --prompt parameter during environment creation.
When virtualenv builds the environment, XonshActivator.quote() writes the input string containing non-ASCII characters into activate.xsh. The input sequence is chosen such that its raw UTF-8 byte sequence ends in a byte that pairs with 0x5C when interpreted under GBK.
When the victim sources activate.xsh inside a xonsh session configured with a legacy $XONSH_ENCODING, the multibyte decoder consumes the backslash as part of a double-byte character. The quote character remains unescaped, breaking out of the path or prompt literal. Subsequent bytes are interpreted directly as executable xonsh commands with the permissions of the user.
Successful exploitation of CVE-2026-113718 grants arbitrary code execution in the shell context of the user sourcing the activate.xsh script. The vulnerability carries a CVSS v4.0 base score of 7.1 (High) with vector string CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N.
Exploitation depends on specific preconditions, including local script execution and active multibyte legacy encodings in $XONSH_ENCODING. However, the direct confidentiality, integrity, and availability impacts are high if triggered within vulnerable user sessions.
No active exploitation has been recorded in CISA KEV, and the EPSS score is 0.00142 (3.23 percentile). Nonetheless, development environments utilizing xonsh in non-UTF-8 locales remain exposed until updated.
To remediate CVE-2026-113718, upgrade virtualenv to version 21.14.9 or higher:
pip install --upgrade virtualenvUpgrading the package does not retroactively modify existing activate.xsh files on disk. Previously generated virtual environments must be re-created or regenerated using patched virtualenv releases.
To audit disk storage for vulnerable files, check activate.xsh scripts for unescaped, non-ASCII UTF-8 bytes in variable definitions. Patched scripts represent non-ASCII input exclusively via ASCII escape sequences (e.g., \uXXXX).
CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
virtualenv pypa | < 21.14.9 | 21.14.9 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-94 |
| Attack Vector | Local |
| CVSS v4.0 Score | 7.1 (High) |
| EPSS Score | 0.00142 (3.23 percentile) |
| Vulnerability Impact | Code Injection / Command Execution |
| Exploit Availability | No Public Exploit |
| CISA KEV Status | Not Listed |
The software constructs all or part of a code segment using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
An incorrect authorization vulnerability (CWE-863) exists in the ASP.NET Core SignalR HTTP Connection Dispatcher (`Microsoft.AspNetCore.Http.Connections`). The connection negotiation process failed to bind the authenticated caller identity to the generated connection state, and subsequent transport or message dispatch handlers failed to verify caller consistency. Consequently, an authenticated low-privilege attacker who obtains a valid connection identifier or token can inject messages into or hijack another user's SignalR session, achieving an elevation of privilege across security boundaries.
CVE-2026-109478 is a network-accessible Denial of Service (DoS) vulnerability in ASP.NET Core caused by inefficient algorithmic complexity (CWE-407) when parsing comma-separated HTTP request headers. Prior to the patch, the internal helper method ParsingHelpers.GetHeaderSplit repeatedly called StringValues.Concat inside a loop iterating over each comma-separated token. Because StringValues allocates a new array of size k + 1 and copies all existing elements upon each concatenation, processing N tokens incurs O(N^2) time and space complexity. An unauthenticated remote attacker can send HTTP requests with headers containing thousands of short, comma-separated values to exhaust CPU cycles and induce severe Garbage Collection (GC) pauses, rendering the web application unresponsive.
CVE-2026-114147 is a high-severity Denial of Service (DoS) vulnerability affecting ASP.NET Core and specifically the Microsoft.AspNetCore.SignalR.StackExchangeRedis scale-out provider across .NET 8.0, 9.0, 10.0, and 11.0 preview releases. The vulnerability originates from a string comparison mismatch between internal per-connection group collections and the centralized Redis channel subscription registry, compounded by a race condition during connection teardown. Remote unauthenticated attackers can exploit this flaw to leave orphaned connection contexts and active Redis pub/sub listeners pinned in memory, leading to unbounded memory exhaustion and application process termination.
CVE-2026-114156 is an improper resolution of path equivalence vulnerability (CWE-41) in Microsoft ASP.NET Core affecting .NET 11.0 preview releases and Microsoft Visual Studio 2026. The vulnerability stems from a discrepancy between how path prefix validation helpers (such as PathString.StartsWithSegments) and downstream routing mechanisms handle alternate path separators and percent-encoded characters. An unauthenticated remote attacker can exploit this mismatch over the network to bypass path-based authorization middleware and access restricted endpoints.
CVE-2026-114157 is a high-severity local privilege escalation and security feature bypass vulnerability affecting ASP.NET Core on Microsoft Windows. The flaw resides in the Kestrel web server's Named Pipes transport layer (Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes) and stems from a race condition (CWE-362) during broken pipe error recovery. When an active connection throws an IOException during handshake acceptance, the connection listener previously disposed of the broken NamedPipeServerStream instance before acquiring a replacement stream from its internal pool. This sequence created a momentary window where zero server instances of the named pipe existed in the Windows Named Pipe File System (NPFS). A local, low-privileged attacker can exploit this timing window to create a named pipe with the identical name and a permissive Discretionary Access Control List (DACL), hijacking subsequent inter-process communications and escalating privileges across security boundaries.
CVE-2026-124194 is a forced authentication and spoofing vulnerability in Microsoft Office Outlook caused by a missing user interface warning before dereferencing remote network paths (CWE-356). By embedding an attacker-controlled Universal Naming Convention (UNC) path within MAPI message properties such as PidLidReminderFileParameter, an unauthenticated remote attacker can force a victim's system to initiate an outbound SMB or WebDAV connection upon opening or previewing a crafted message. This automatic authentication handshake leaks the user's NetNTLMv2 hash, enabling offline password cracking or real-time NTLM relay attacks. The vulnerability was exploited in the wild as a zero-day prior to its remediation in Microsoft's November 2026 Patch Tuesday updates and is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.