CVE-2022-21668
Pipenv's requirements.txt parsing allows malicious index url in comments
Severity Score
Exploit Likelihood
Affected Versions
Public Exploits
2Exploited in Wild
-Decision
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
CVSS Scores
SSVC
- Decision:-
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
References (7)
URL | Tag | Source |
---|---|---|
https://github.com/pypa/pipenv/releases/tag/v2022.1.8 | Release Notes |
URL | Date | SRC |
---|---|---|
https://github.com/sreeram281997/CVE-2022-21668-Pipenv-RCE-vulnerability | 2022-03-27 | |
https://github.com/pypa/pipenv/security/advisories/GHSA-qc9x-gjcv-465w | 2024-08-03 |
URL | Date | SRC |
---|---|---|
https://github.com/pypa/pipenv/commit/439782a8ae36c4762c88e43d5f0d8e563371b46f | 2024-02-07 |
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
|