# CVE-2026-113718: virtualenv xonsh activation script injection via multibyte encoding

Source: https://junglewise.ai/threats/cve-2026-113718-virtualenv-is-a-tool-for-creating-isolated-virtual-python  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-10-20. Updated: 2026-10-20  
License: CC BY 4.0 with a link back

CVE-2026-113718 · Severity: high · CVSS 4 · Published 2026-10-20

virtualenv is a tool that creates isolated Python environments with activation scripts. When xonsh sources the UTF-8 encoded activation script under a legacy multibyte encoding like GBK or Big5, backslash escape sequences can be misinterpreted, allowing an attacker to inject and execute arbitrary code through a specially crafted prompt argument. This affects users who source the generated activate.xsh script while XONSH_ENCODING is set to a vulnerable multibyte codec.

Technologies: [Pypa Virtualenv](https://junglewise.ai/threats/technologies/pypa-virtualenv), [virtualenv (PyPI)](https://junglewise.ai/threats/technologies/virtualenv). Vendors: [Pypa](https://junglewise.ai/threats/vendors/pypa), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-113718 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-113718 being exploited in the wild.

**How severe is CVE-2026-113718?** High severity, with a CVSS score of 4, published 20 October 2026.

**Which products and versions are affected?** Pypa Virtualenv prior to 21.14.9; virtualenv (PyPI) < 21.14.9, ECOSYSTEM:introduced=0,fixed=21.14.9.

**Is there a fix for CVE-2026-113718?** Yes. virtualenv (PyPI): upgrade to 21.14.9 or later. Until then: Update to virtualenv 21.14.9 or later. Alternatively, avoid sourcing activation scripts when XONSH_ENCODING is set to GBK, Big5, or other legacy multibyte codecs, or use activation scripts generated by other activators (bash, zsh, etc.). Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-113718 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-113718?** 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.14.9 or later

  ```sh
  pip install "virtualenv>=21.14.9"
  ```


Update to virtualenv 21.14.9 or later. Alternatively, avoid sourcing activation scripts when XONSH_ENCODING is set to GBK, Big5, or other legacy multibyte codecs, or use activation scripts generated by other activators (bash, zsh, etc.).

## Technical details

The vulnerability exists in the POSIX xonsh activation script generator, which uses repr() to write the prompt and destination path as string literals into a UTF-8 file. When xonsh parses this file with $XONSH_ENCODING set to GBK or Big5, UTF-8 trail bytes can pair with the backslash character, causing the backslash to be consumed and allowing the string literal to close prematurely. An attacker can supply a malicious prompt containing quotes and semicolons to inject executable statements that run when the script is sourced. The fix changes the quote() function to use ascii() instead, ensuring all non-ASCII characters are escaped as \x, \u, or \U sequences, preventing any byte from being misinterpreted under multibyte codecs.

## Affected products

- pypa virtualenv prior to 21.14.9

## Identifiers

- CVE-2026-113718
- GHSA-394h-qwmc-48pf

## Timeline

- 2026-10-20: disclosed
- 2026-10-17: patched

## References

- [https://github.com/pypa/virtualenv/commit/e5fc2e6e189a877ff559af288919e3525d13e5e0](https://github.com/pypa/virtualenv/commit/e5fc2e6e189a877ff559af288919e3525d13e5e0)
- [https://github.com/pypa/virtualenv/pull/3432](https://github.com/pypa/virtualenv/pull/3432)

## Related threats

- [virtualenv bash activate command injection via unescaped prompt](https://junglewise.ai/threats/cve-2026-115586-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv command injection in activation script template substitution](https://junglewise.ai/threats/cve-2026-113776-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv command injection in Fish shell activation script](https://junglewise.ai/threats/cve-2026-113732-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [pypa virtualenv command injection in bash activate script](https://junglewise.ai/threats/cve-2026-113726-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
- [virtualenv bash activate script command injection in PS1](https://junglewise.ai/threats/cve-2026-113725-virtualenv-is-a-tool-for-creating-isolated-virtual-python)
