CVE-2024-53899 virtualenv allows command injection through activation scripts for a virtual environment

High 8.4 Published Updated

Attackers can execute arbitrary commands via unquoted magic template strings in virtual environment activation scripts.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-53899?

CVE-2024-53899 is a high-severity command injection vulnerability in n/a, published on 24 Nov 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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. NOTE: this is not the same as CVE-2024-9287.

Weakness: CWE-77, CWE-78

Which versions are affected by CVE-2024-53899?

4 open source packages ship an affected version, including virtualenv. It affects 1 product.

PackageAffectedFixed in
virtualenv BitnamiAll versions20.26.6
virtualenv PyPIAll versions20.26.6
virtualenv PyPIAll versions20.26.6
virtualenv PyPIAll versions20.26.6
Linux distribution packages (36)
python-nose-docs AlmaLinux:8All versions1.3.7-31.module_el8.9.0+3700+efebe9fd
python-pymongo-doc AlmaLinux:8All versions3.7.0-1.module_el8.9.0+3700+efebe9fd
python-sqlalchemy-doc AlmaLinux:8All versions1.3.2-3.module_el8.10.0+3769+3838165b
python-virtualenv-doc AlmaLinux:8All versions15.1.0-23.module_el8.10.0+3937+b6a3652f
python3-PyMySQL AlmaLinux:8All versions0.10.1-2.module_el8.9.0+3700+efebe9fd
python3-bson AlmaLinux:8All versions3.7.0-1.module_el8.9.0+3700+efebe9fd
python3-distro AlmaLinux:8All versions1.4.0-2.module_el8.9.0+3700+efebe9fd
python3-docs AlmaLinux:8All versions3.6.7-2.module_el8.9.0+3700+efebe9fd
python3-docutils AlmaLinux:8All versions0.14-12.module_el8.9.0+3700+efebe9fd
python3-nose AlmaLinux:8All versions1.3.7-31.module_el8.9.0+3700+efebe9fd
python3-pygments AlmaLinux:8All versions2.2.0-22.module_el8.9.0+3700+efebe9fd
python3-pymongo AlmaLinux:8All versions3.7.0-1.module_el8.9.0+3700+efebe9fd
python3-pymongo-gridfs AlmaLinux:8All versions3.7.0-1.module_el8.9.0+3700+efebe9fd
python3-scipy AlmaLinux:8All versions1.0.0-21.module_el8.9.0+3700+efebe9fd
python3-sqlalchemy AlmaLinux:8All versions1.3.2-3.module_el8.10.0+3769+3838165b
python3-virtualenv AlmaLinux:8All versions15.1.0-23.module_el8.10.0+3937+b6a3652f
python3-wheel AlmaLinux:8All versions1:0.31.1-3.module_el8.9.0+3700+efebe9fd
python3-wheel-wheel AlmaLinux:8All versions1:0.31.1-3.module_el8.9.0+3700+efebe9fd
python36 AlmaLinux:8All versions3.6.8-39.module_el8.10.0+3769+3838165b
python36-debug AlmaLinux:8All versions3.6.8-39.module_el8.10.0+3769+3838165b
python36-devel AlmaLinux:8All versions3.6.8-39.module_el8.10.0+3769+3838165b
python36-rpm-macros AlmaLinux:8All versions3.6.8-39.module_el8.10.0+3769+3838165b
python-PyMySQL Red Hat:enterprise_linux:8::appstreamAll versions0:0.10.1-2.module+el8.10.0+20784+edafcd43
python-distro Red Hat:enterprise_linux:8::appstreamAll versions0:1.4.0-2.module+el8.10.0+20784+edafcd43
python-docs Red Hat:enterprise_linux:8::appstreamAll versions0:3.6.7-2.module+el8.10.0+20784+edafcd43
python-docutils Red Hat:enterprise_linux:8::appstreamAll versions0:0.14-12.module+el8.10.0+20784+edafcd43
python-nose Red Hat:enterprise_linux:8::appstreamAll versions0:1.3.7-31.module+el8.10.0+20784+edafcd43
python-nose-docs Red Hat:enterprise_linux:8::appstreamAll versions0:1.3.7-31.module+el8.10.0+20784+edafcd43
python-pygments Red Hat:enterprise_linux:8::appstreamAll versions0:2.2.0-22.module+el8.10.0+20784+edafcd43
python-pymongo Red Hat:enterprise_linux:8::appstreamAll versions0:3.7.0-1.module+el8.10.0+20784+edafcd43
python-pymongo-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:3.7.0-1.module+el8.10.0+20784+edafcd43
python-pymongo-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:3.7.0-1.module+el8.10.0+20784+edafcd43
python-pymongo-doc Red Hat:enterprise_linux:8::appstreamAll versions0:3.7.0-1.module+el8.10.0+20784+edafcd43
python-sqlalchemy Red Hat:enterprise_linux:8::appstreamAll versions0:1.3.2-3.module+el8.10.0+20981+3704b446
python-sqlalchemy-doc Red Hat:enterprise_linux:8::appstreamAll versions0:1.3.2-3.module+el8.10.0+20981+3704b446
python-virtualenv Red Hat:enterprise_linux:8::appstreamAll versions0:15.1.0-23.module+el8.10.0+22619+61b70790

Products include Virtualenv Virtualenv.

How do I fix CVE-2024-53899?

Upgrade virtualenv to 20.26.6 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2024-53899 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-53899 exists.

Sources

Also known as ALSA-2024:10953, AZL-53417, AZL-53645, BELL-CVE-2024-53899, BIT-virtualenv-2024-53899, CLSA-2026-1771855453 and 23 more.

Is CVE-2024-53899 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free