You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bash activator leaves the --prompt value unescaped in PS1 when promptvars is off, so prompt expansion later executes it #23376
The bash activator puts the caller-supplied prompt value into PS1 unescaped whenever promptvars is off at activation time, and assumes prompt expansion can never run afterwards. promptvars and posix mode are runtime shell state, not a property of the activation moment: re-enabling prompt expansion in the same shell (shopt -s promptvars, set -o posix) or starting an interactive child bash that inherits the exported PS1 makes bash expand the stored value and run the command substitution in it. An attacker who controls the prompt value gets command execution as the user who sources bin/activate.
Since uv uses activation scripts derived from virtualenv, I tried the proof of concept from GHSA-cx6f-vjhg-g3cc and was able to reproduce it, indicating that uv is affected by the same issue:
It’s my understanding from previous issues like #23059 and #23058 that that this would not be considered a vulnerability under uv’s attacker and threat models, because uv does not expect a hostile user to control the environment or parameters with which a virtual environment is created. I am therefore reporting this as a regular public bug.
Hi, I would like to work on this. My plan is to escape the prompt value when it is written into the bash activator's PS1 assignment (mirroring the upstream virtualenv fix for GHSA-cx6f-vjhg-g3cc), so that re-enabling promptvars or inheriting the exported PS1 in a child shell cannot trigger command substitution. I will open a PR with the fix and a regression test; please let me know if you would prefer a different approach.
Activity
LiHuan02 commentedon Nov 25, 2026
Hi, I would like to work on this. My plan is to escape the prompt value when it is written into the bash activator's
PS1assignment (mirroring the upstream virtualenv fix for GHSA-cx6f-vjhg-g3cc), so that re-enablingpromptvarsor inheriting the exportedPS1in a child shell cannot trigger command substitution. I will open a PR with the fix and a regression test; please let me know if you would prefer a different approach.fix(venv): escape prompt value in bash activation script