Bug 2580349 - CVE-2026-113718 uv: virtualenv: arbitrary code execution via improper quoting in xonsh activation scripts [fedora-all]
Summary: CVE-2026-113718 uv: virtualenv: arbitrary code execution via improper quoting...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: uv
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Ben Beasley
QA Contact:
URL:
Whiteboard: {"flaws": ["5bddf138-18ae-46cf-ba8e-8...
Depends On:
Blocks: CVE-2026-113718
TreeView+ depends on / blocked
 
Reported: 2026-11-21 11:11 UTC by Avinash Hanwate
Modified: 2026-11-23 21:10 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-11-23 21:10:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Avinash Hanwate 2026-11-21 11:11:33 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:10:54 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.


Note You need to log in before you can comment on or make changes to this bug.