PT-2022-15021 · Pipenv · Pipenv

Chris Passarello

·

Published

2022-01-10

·

Updated

2024-02-07

·

CVE-2022-21668

CVSS v2.0

9.3

High

VectorAV:N/AC:M/Au:N/C:C/I:C/A:C
Name of the Vulnerable Software and Affected Versions pipenv versions 2018.10.9 through 2022.1.8
Description A flaw in pipenv's parsing of requirements files allows an attacker to insert a specially crafted string inside a comment anywhere within a requirements.txt file. This will cause victims who use pipenv to install the requirements file 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. If an attacker is able to hide a malicious --index-url option in a requirements file that a victim installs with pipenv, the attacker can embed arbitrary malicious code in packages served from their malicious index server that will be executed on the victim's host during installation. The impact of successful exploitation is severe, and the overall likelihood of exploitation is low to moderate.
Recommendations For versions 2018.10.9 through 2022.1.8, update to version 2022.1.8 to resolve the issue. As a temporary workaround, consider disabling the use of comments in requirements files or restricting access to the --index-url option until a patch is available. Avoid using the --index-url option in the affected API endpoint until the issue is resolved. Restrict access to the setup.py file to minimize the risk of exploitation. Consider implementing additional security measures, such as validating the integrity of packages and dependencies, to prevent malicious code execution.

Exploit

Fix

Integer Overflow

Command Injection

OS Command Injection

RCE

Uncontrolled Search Path Element

Related Identifiers

CVE-2022-21668
GHSA-QC9X-GJCV-465W
PYSEC-2022-6

Affected Products

Pipenv