Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please comment on CVE-2024-53899 and virtualenv activation scripts #9424

Open
musicinmybrain opened this issue Nov 25, 2024 · 1 comment
Open
Assignees
Labels

Comments

@musicinmybrain
Copy link
Contributor

Yesterday, CVE-2024-53899 was published, with the following description:

virtualenv before 20.26.6 allows command injection through the activation scripts for a virtual environment. Magic template strings are not quoted correctly when replacing.

This corresponds to pypa/virtualenv#2768 and is supposed to be fixed by pypa/virtualenv#2771.

Because uv vendors virtualenv activation scripts in crates/uv-virtualenv/src/activator/, I wondered if uv was also affected. Imitating the original reproducer in pypa/virtualenv#2768, and working with a uv checkout on the 0.5.4 tag:

$ cargo build
$ envname="';uname -a;':"
$ mkdir "$envname"
$ cd "$envname"
$ ../target/debug/uv venv .
$ . ./bin/activate
(';uname -a;':) ben@musicbox:~/src/forks/uv/';uname -a;':$

This is good; the uname -a command was not executed, so this test did not reproduce the problem.

Checking older versions, it looks like this was fixed between uv 0.5.2 and 0.5.3, probably in #8984 (although I did not bother bisecting). To reiterate this very clearly, I was not able to trivially reproduce CVE-2024-53899 in uv 0.5.3 and later, but I was able to reproduce it (output from uname -a appeared in my console) in uv 0.5.2 and earlier.

Could you please comment on whether you believe the underlying issue is entirely mitigated in uv, or whether further work needs to be done? Thank you!

@charliermarsh
Copy link
Member

Thanks for filing! We'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants