Arbitrary Command Injection Affecting pipenv package, versions [2018.10.9, 2022.1.8)


Severity

0.0
high
0
10

    Threat Intelligence

    EPSS
    0.25% (66th percentile)

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-PIPENV-2330883
  • published 9 Jan 2022
  • disclosed 6 Jan 2022
  • credit Chris Passarello

How to fix?

Upgrade pipenv to version 2022.1.8 or higher.

Overview

pipenv is a Python Development Workflow for Humans.

Affected versions of this package are vulnerable to Arbitrary Command Injection. Due to a flaw in pipenv's parsing of requirements files, an attacker can insert a specially crafted string inside a comment anywhere within a requirements.txt file, which will cause victims who use pipenv to install the requirements file (e.g. with pipenv install -r requirements.txt) to download dependencies from a package index server controlled by the attacker. By embedding malicious code in packages served from their malicious index server, the attacker can trigger arbitrary remote code execution (RCE) on the victims' systems.

According to the requirements file format specification, any lines which begin with a # character, and/or any text in a line following a whitespace and a # character, should be interpreted as a comment which will be ignored during processing of the requirements file.

However, due to a flaw in pipenv's parsing of requirements files, an attacker can insert a specially crafted string inside a comment anywhere within a requirements.txt file, which will cause victims who use pipenv to install the requirements file

Note: The primary hurdle to successful exploitation of this vulnerability depends on an attacker's ability to surreptitiously insert a specially crafted string into a requirements.txt file which will be installed by a victim. This is not a highly likely scenario, however it can be made easier to obfuscate due to it being hidden within comments.

CVSS Scores

version 3.1
Expand this section

Snyk

8 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    Required
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

8.6 high