{"vuln_id":"CVE-2026-113718","aliases":["GHSA-394h-qwmc-48pf"],"description":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASCII prompt or destination data into UTF-8 activate.xsh, while xonsh can read that script using $XONSH_ENCODING. Under a legacy multibyte codec such as GBK or Big5, a UTF-8 trail byte can consume the backslash before an adjacent quote, allowing the literal to close and attacker-influenced statements to execute when the user sources the generated script. This issue is fixed in version 21.14.9.","published_at":"2026-10-20T20:17:18.197000Z","modified_at":"2026-11-18T12:11:02.144706Z","first_seen_at":"2026-11-21T19:15:47.058523Z","severity":"high","severity_source":"nvd","cvss_score":7.1,"cvss_vector":"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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cwe":["CWE-94"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00235,"epss_percentile":0.1448,"nvd_status":"Analyzed","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-113718"},"matched_alias":null,"items":[{"id":10747,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-394h-qwmc-48pf: virtualenv: Xonsh activation literals depend on the script decoding codec","summary":"virtualenv: Xonsh activation literals depend on the script decoding codec\n\n## Summary\n\nCaller-supplied prompt text can become executable syntax in the xonsh activation script. An attacker must influence the\nvalue passed to virtualenv, and a user must subsequently activate the environment.\n\n## Affected area\n\nXonsh reads a UTF-8 activation script using a legacy multibyte encoding such as GBK. Printable non-ASCII bytes can\nchange how the reader recognizes an adjacent quote. The report concerns POSIX activation. It does not establish exposure\nthrough unrelated activators.\n\n## Attacker-controlled input\n\nThe attacker controls prompt or destination data passed as a virtualenv argument. The user later sources the generated\nactivation script.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[xonsh quote()](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/activation/xonsh/__init__.py),\n[UTF-8 template writer](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/activation/via_template.py).\n\n## Mechanism\n\nThe generator writes `activate.xsh` as UTF-8. Its `quote()` used `repr()`, which leaves printable non-ASCII characters\nin the file and backslash-escapes an embedded quote. Xonsh's `source` reads the file using `$XONSH_ENCODING`. With GBK\nor Big5, the UTF-8 bytes of `中` end in `0xad`, which pairs with the following `0x5c` backslash as one decoded character.\nThe backslash no longer escapes the quote. A prompt containing both quote kinds can then close its Python string literal\nand supply statements that run during activation. With UTF-8 source decoding, the same value stays inside the literal.\n\n## Reproduction and evidence\n\nThe original scanner finding, `ANT-2026-PAUVP7YL`, demonstrated this byte-level failure in `activate_this.py`: a hostile\nprompt loaded through `exec(open(file).read(), ...)` under GBK created a marker, while UTF-8 and `runpy.run_path`\ncontrols did not. The xonsh path in this advisory was identified in the subsequent maintainer-provided review.\n[PR #3432](https://github.com/pypa/virtualenv/pull/3432) shows the xonsh source-decoding chain and changes `quote()` to\n`ascii()`, which writes non-ASCII characters as escapes. Its regression test encodes the generated literal as ASCII,\ndecodes it as GBK, and checks that `ast.literal_eval` returns the original prompt.\n\nThe attack needs control of the prompt or destination value, an affected xonsh source encoding, and later sourcing of\nthe generated file. The original `activate_this.py` reproducer does not itself prove xonsh execution; that result is\nattributed to the separate review. Existing `activate.xsh` files must be regenerated after the fix.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n    participant A as Prompt supplier\n    participant V as virtualenv quote()\n    participant F as activate.xsh bytes\n    participant X as xonsh source\n    A->>V: 中 plus escaped quote and statements\n    V->>F: repr writes UTF-8 中 followed by backslash\n    alt XONSH_ENCODING is UTF-8\n        \n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.9\n\nReferences:\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-394h-qwmc-48pf\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-113718\nhttps://github.com/pypa/virtualenv/pull/3432\nhttps://github.com/pypa/virtualenv/commit/e5fc2e6e189a877ff559af288919e3525d13e5e0\nhttps://github.com/pypa/virtualenv\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9","url":"https://osv.dev/vulnerability/GHSA-394h-qwmc-48pf","published_at":"2026-10-23T22:24:43Z","updated_at":"2026-11-18T12:11:02.144706Z","fetched_at":"2026-11-21T19:15:55.946148Z","severity":"high","cvss_score":7.8,"epss":0.00235,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113718","vuln_ids":["CVE-2026-113718","BIT-VIRTUALENV-2026-113718","GHSA-394H-QWMC-48PF","PYSEC-2026-4377"],"tags":["osv","pypi","fix-available"],"cluster_id":4099,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10747","html":"https://vulnwatch.ve1ve2.com/item/10747"}},{"id":11341,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-113718: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASC…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASCII prompt or destination data into UTF-8 activate.xsh, while xonsh can read that script using $XONSH_ENCODING. Under a legacy multibyte codec such as GBK or Big5, a UTF-8 trail byte can consume the backslash before an adjacent quote, allowing the literal to close and attacker-influenced statements to execute when the user sources the generated script. This issue is fixed in version 21.14.9.\n\nAffected: Debian:12:python-virtualenv, Debian:13:python-virtualenv, Debian:14:python-virtualenv\n\nNo fixed version published yet\n\nReferences:\nhttps://security-tracker.debian.org/tracker/CVE-2026-113718","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-113718","published_at":"2026-10-20T20:17:18.197000Z","updated_at":"2026-11-18T12:01:30.521281Z","fetched_at":"2026-11-21T19:23:21.853715Z","severity":"high","cvss_score":7.8,"epss":0.00235,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:python-virtualenv","vuln_id":"CVE-2026-113718","vuln_ids":["CVE-2026-113718","DEBIAN-CVE-2026-113718","GHSA-394H-QWMC-48PF"],"tags":["osv","debian","no-fix-yet"],"cluster_id":4098,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11341","html":"https://vulnwatch.ve1ve2.com/item/11341"}},{"id":10748,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-4377: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASC…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASCII prompt or destination data into UTF-8 activate.xsh, while xonsh can read that script using $XONSH_ENCODING. Under a legacy multibyte codec such as GBK or Big5, a UTF-8 trail byte can consume the backslash before an adjacent quote, allowing the literal to close and attacker-influenced statements to execute when the user sources the generated script. This issue is fixed in version 21.14.9.\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.9\n\nReferences:\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9\nhttps://github.com/pypa/virtualenv/commit/e5fc2e6e189a877ff559af288919e3525d13e5e0\nhttps://github.com/pypa/virtualenv/pull/3432\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-394h-qwmc-48pf","url":"https://osv.dev/vulnerability/PYSEC-2026-4377","published_at":"2026-10-20T20:17:18.197000Z","updated_at":"2026-11-18T12:11:02.144706Z","fetched_at":"2026-11-21T19:15:55.946148Z","severity":"high","cvss_score":7.8,"epss":0.00235,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113718","vuln_ids":["CVE-2026-113718","BIT-VIRTUALENV-2026-113718","GHSA-394H-QWMC-48PF","PYSEC-2026-4377"],"tags":["osv","pypi","fix-available"],"cluster_id":4098,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10748","html":"https://vulnwatch.ve1ve2.com/item/10748"}},{"id":3762,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-113718: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASC…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, POSIX xonsh activation quote() uses repr() to write printable non-ASCII prompt or destination data into UTF-8 activate.xsh, while xonsh can read that script using $XONSH_ENCODING. Under a legacy multibyte codec such as GBK or Big5, a UTF-8 trail byte can consume the backslash before an adjacent quote, allowing the literal to close and attacker-influenced statements to execute when the user sources the generated script. This issue is fixed in version 21.14.9.\n\nReferences:\nhttps://github.com/pypa/virtualenv/commit/e5fc2e6e189a877ff559af288919e3525d13e5e0\nhttps://github.com/pypa/virtualenv/pull/3432\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-394h-qwmc-48pf\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-394h-qwmc-48pf","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113718","published_at":"2026-10-20T20:17:18.197000Z","updated_at":"2026-11-17T20:28:58.977000Z","fetched_at":"2026-11-21T19:15:31.479287Z","severity":"high","cvss_score":7.8,"epss":0.00235,"is_kev":false,"has_exploit":true,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-113718","vuln_ids":["CVE-2026-113718","GHSA-394H-QWMC-48PF"],"tags":["CWE-94"],"cluster_id":4098,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/3762","html":"https://vulnwatch.ve1ve2.com/item/3762"}}]}