// For flags

CVE-2022-21668

Pipenv's requirements.txt parsing allows malicious index url in comments

Severity Score

8.6
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

2
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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.

pipenv es una herramienta de flujo de trabajo de desarrollo de Python. A partir de la versión 2018.10.9 y versiones anteriores a 2022.1.8, un defecto en el análisis de archivos de requisitos de pipenv permite a un atacante insertar una cadena especialmente diseñada dentro de un comentario en cualquier lugar dentro de un archivo requirements.txt, lo que causará que las víctimas que usan pipenv para instalar el archivo de requisitos descarguen dependencias de un servidor de índice de paquetes controlado por el atacante. Al insertar código malicioso en los paquetes servidos desde su servidor de índice malicioso, el atacante puede desencadenar una ejecución de código remota (RCE) arbitraria en los sistemas de las víctimas. Si un atacante es capaz de ocultar una opción maliciosa "--index-url" en un archivo de requisitos que una víctima instala con pipenv, el atacante puede insertar código malicioso arbitrario en paquetes servidos desde su servidor de índice malicioso que será ejecutado en el host de la víctima durante la instalación (ejecución de código remota/RCE). Cuando pip instala desde una distribución de origen, cualquier código en el archivo setup.py es ejecutado por el proceso de instalación. Este problema está parcheado en versión 2022.1.8. El aviso de seguridad de GitHub contiene más información sobre esta vulnerabilidad

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Network
Attack Complexity
High
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Network
Attack Complexity
Medium
Authentication
None
Confidentiality
Complete
Integrity
Complete
Availability
Complete
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2021-11-16 CVE Reserved
  • 2022-01-10 CVE Published
  • 2022-03-27 First Exploit
  • 2024-08-03 CVE Updated
  • 2024-09-25 EPSS Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
CWE
  • CWE-20: Improper Input Validation
  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
  • CWE-190: Integer Overflow or Wraparound
  • CWE-427: Uncontrolled Search Path Element
  • CWE-791: Incomplete Filtering of Special Elements
  • CWE-1284: Improper Validation of Specified Quantity in Input
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Pypa
Search vendor "Pypa"
Pipenv
Search vendor "Pypa" for product "Pipenv"
>= 2018.10.9 < 2022.1.8
Search vendor "Pypa" for product "Pipenv" and version " >= 2018.10.9 < 2022.1.8"
-
Affected
Fedoraproject
Search vendor "Fedoraproject"
Fedora
Search vendor "Fedoraproject" for product "Fedora"
34
Search vendor "Fedoraproject" for product "Fedora" and version "34"
-
Affected
Fedoraproject
Search vendor "Fedoraproject"
Fedora
Search vendor "Fedoraproject" for product "Fedora"
35
Search vendor "Fedoraproject" for product "Fedora" and version "35"
-
Affected
Fedoraproject
Search vendor "Fedoraproject"
Fedora
Search vendor "Fedoraproject" for product "Fedora"
36
Search vendor "Fedoraproject" for product "Fedora" and version "36"
-
Affected