Vulnerability · Published Jan 10, 2022 · Assigned by GitHub_M

CVE-2022-21668Pipenv's requirements.txt parsing allows malicious index url in comments

High 8.0

In plain English

A high-severity improper input validation in pipenv from pypa. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 3.9% (higher than 90% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)8.0High
Exploit odds (30 days)3.9%top 9.6% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack tooling1Public PoC

Official description

pipenv is a Python development workflow tool. Starting with version 2018.10.9 and prior to version 2022.1.8, 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, which 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 (remote code execution/RCE). When pip installs from a source distribution, any code in the setup.py is executed by the install process. This issue is patched in version 2022.1.8. The GitHub Security Advisory contains more information about this vulnerability.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
PyPIpipenv2022.1.8GHSA-qc9x-gjcv-465w
PyPIpipenv2022.1.8PYSEC-2022-6
Ubuntu:22.04:LTSpipenvno fix listedUBUNTU-CVE-2022-21668
Ubuntu:24.04:LTSpipenvno fix listedUBUNTU-CVE-2022-21668
Ubuntu:25.10pipenvno fix listedUBUNTU-CVE-2022-21668
Ubuntu:26.04:LTSpipenvno fix listedUBUNTU-CVE-2022-21668
Ubuntu:26.10pipenvno fix listedUBUNTU-CVE-2022-21668

Affected products (as reported)

VendorProductVersions
pypa pipenv >= 2018.10.9, < 2022.1.8

Weakness: CWE-20, CWE-77, CWE-78, CWE-427, CWE-791 · Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H

References