Bug 2580350

Summary: CVE-2026-113718 uv: virtualenv: arbitrary code execution via improper quoting in xonsh activation scripts [epel-all]
Product: [Fedora] Fedora EPEL Reporter: Avinash Hanwate <ahanwate>
Component: uvAssignee: Ben Beasley <code>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: epel10CC: code, mhroncok, python-packagers-sig, rust-sig
Target Milestone: ---Keywords: Security, SecurityTracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: {"flaws": ["5bddf138-18ae-46cf-ba8e-813470449e72"]}
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-11-23 21:11:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2556411    

Description Avinash Hanwate 2026-11-21 11:11:38 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

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.

Comment 1 Ben Beasley 2026-11-23 21:11:42 UTC
https://www.cve.org/CVERecord?id=CVE-2026-113718

https://github.com/pypa/virtualenv/security/advisories/GHSA-394h-qwmc-48pf

I tried the reproduction steps in the GitHub advisory, replacing

> subprocess.run(["virtualenv", "--quiet", "--no-periodic-update", "--prompt", hostile_prompt, env_dir], check=True)

with

> subprocess.run(["uv", "venv", "--quiet", "--no-periodic-update", "--prompt", hostile_prompt, env_dir], check=True)

and got:

> activate_this.py read as UTF-8: os.environ["VIRTUAL_ENV_PROMPT"] = "中';__import__("os").system("touch /tmp/activate-this-gbk/MARKER")#" or os.path.basename(base)  # noqa: SIM222
> Traceback (most recent call last):
>   File "/home/user/virtualenv/./repro", line 30, in <module>
>     print(f"activate_this.py read as GBK:   {prompt_line.decode('gbk')}")
>                                              ~~~~~~~~~~~~~~~~~~^^^^^^^
> UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 38: illegal multibyte sequence
> decoding with 'gbk' codec failed

If I comment out

> print(f"activate_this.py read as GBK:   {prompt_line.decode('gbk')}")

then I get as far as

> activate_this.py read as UTF-8: os.environ["VIRTUAL_ENV_PROMPT"] = "中';__import__("os").system("touch /tmp/activate-this-gbk/MARKER")#" or os.path.basename(base)  # noqa: SIM222
> Traceback (most recent call last):
>   File "/tmp/repro.d/activate_with_exec_open.py", line 9, in <module>
>     exec(open(this_file).read(), {"__file__": this_file})
>     ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "<string>", line 49
>     os.environ["VIRTUAL_ENV_PROMPT"] = "中';__import__("os").system("touch /tmp/activate-this-gbk/MARKER")#" or os.path.basename(base)  # noqa: SIM222
>                                                         ^^
> SyntaxError: invalid syntax. Is this intended to be part of the string?

This suggests that either uv is not affected, or perhaps I have just botched my reproduction attempt.