CVE-2024-53899: Command Injection Vulnerability in virtualenv Prior to 20.26.6

virtualenv Updated 02 Oct 2025

Summary

24/11/2024
Yes i
High
9.8

CVE-2024-53899: virtualenv before 20.26.6 allows command injection through the activation scripts for a virtual environment. Affects virtualenv versions < 20.26.6. Fixed in 20.26.6. How to fix ↓

Also tracked for

The same CVE-2024-53899 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

virtualenv is a widely used Python tool that allows developers to create isolated environments for their projects. This isolation helps manage dependencies and avoid conflicts between packages. However, prior to version 20.26.6, virtualenv had a critical vulnerability that could allow attackers to execute arbitrary commands through improperly handled activation scripts.

Vulnerability Detail

The vulnerability arises from the way virtualenv handles magic template strings in its activation scripts. These strings are not quoted correctly, which can lead to command injection attacks. An attacker could exploit this flaw by crafting a malicious activation script that, when executed, runs arbitrary commands on the host system. This poses significant risks, including unauthorized access to sensitive data or system control.

How To Fix

Latest published version: 21.14.12 as of 22 Oct 2026

pip install --upgrade "virtualenv==21.14.12"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

20.26.6

This is the first release that contains the fix.

pip install --upgrade "virtualenv==20.26.6"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can avoid using activation scripts or ensure that no untrusted scripts are executed within their virtual environments until the package is updated.

Conclusion

The command injection vulnerability in virtualenv prior to version 20.26.6 poses a significant risk to users. It is crucial to update to the patched version to mitigate potential attacks. Users should also consider utilizing tools like Vulert for ongoing monitoring of vulnerabilities in their projects.

See every vulnerability recorded for virtualenv →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 9.8, indicating a critical level of severity.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

If exploited, this vulnerability could allow attackers to execute arbitrary commands, leading to data breaches or system compromise.

Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software using just your Pipfile.lock.

If you cannot update the package right away, avoid executing untrusted activation scripts and consider using alternative methods to manage your Python environments.

Related vulnerabilities

Recent vulnerabilities recorded for virtualenv.

How To Fix

Latest published version: 21.14.12 as of 22 Oct 2026

pip install --upgrade "virtualenv==21.14.12"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

20.26.6

This is the first release that contains the fix.

pip install --upgrade "virtualenv==20.26.6"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback