Command Injection Affecting virtualenv package, versions [,20.26.6)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-PYTHON-VIRTUALENV-8136228
  • published 1 Oct 2024
  • disclosed 1 Oct 2024
  • credit y5c4l3

Introduced: 1 Oct 2024

CVE NOT AVAILABLE CWE-78 Open this link in a new tab

How to fix?

Upgrade virtualenv to version 20.26.6 or higher.

Overview

Affected versions of this package are vulnerable to Command Injection due to improperly quoted string placeholders in activation scripts through the ViaTemplateActivator class. The vulnerable functions include various shell activation scripts where placeholders like __VIRTUAL_ENV__ are used.

Note:

  1. This vulnerability is specific to environments where shell scripts are used for virtual environment activation.

  2. Exploiting this vulnerability depends on the ability of the attacker to control the input to these placeholders, therefore it's unlikely to be exploited.

PoC

envname="';uname -a;':"
mkdir "$envname"
cd "$envname"
virtualenv .
. ./bin/activate

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
5.4 medium
  • Attack Vector (AV)
    Local
  • Attack Complexity (AC)
    High
  • Attack Requirements (AT)
    Present
  • Privileges Required (PR)
    High
  • User Interaction (UI)
    Active
  • Confidentiality (VC)
    High
  • Integrity (VI)
    High
  • Availability (VA)
    High
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None