CVE-2022-21668 json
Pipenv's requirements.txt parsing allows malicious index url in comments
published 2022-01-10 4 y ago modified 2026-06-17 4 mo ago also GHSA-qc9x-gjcv-465w , PYSEC-2022-6 , EUVD-2022-0202
- cvss
- 8.0
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 3.9%
- EPSS 3.9% chance of exploitation in 30 days, percentile 90%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi pipenv 2022.1.8
- pypa pipenv 2022.1.8
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2022-21668 updated cvss 8.0
pipenv: code execution via crafted requirements.txt file
-
Red Hat All currently supported Red Hat productsnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
3.93% chance of exploitation in the next 30 days, higher than 90% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/pypa/pipenv/security/advisories/GHSA-qc9x-gjcv-465w referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 8.0 | CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H |
| NVD | 3.1 | 8.6 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
| NVD | 2.0 | 9.3 | AV:N/AC:M/Au:N/C:C/I:C/A:C |
| GitHub | 3.1 | 8.0 | CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | pipenv | >=2018.10.9, <2022.1.8 |
2022.1.8 |
Affected products
- pypa pipenv
Classification
- Weakness
-
- CWE-20 Improper Input Validation
- CWE-77 Improper Neutralization of Special Elements used in a Command
- CWE-78 Improper Neutralization of Special Elements used in an OS Command
- CWE-427 Uncontrolled Search Path Element
- CWE-791 Incomplete Filtering of Special Elements
- CWE-190 Integer Overflow or Wraparound
- CWE-1284 Improper Validation of Specified Quantity in Input
References
-
github.com
/pypa/pipenv/commit/439782a8ae36c4762c88e43d5f0d8e563371b46f
web, patch, third-party-advisory
-
github.com
/pypa/pipenv/security/advisories/GHSA-qc9x-gjcv-465w
web, exploit, third-party-advisory, advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4/
vendor-advisory, mailing-list
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT/
vendor-advisory, mailing-list
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM/
vendor-advisory, mailing-list
-
github.com
/pypa/pipenv/releases/tag/v2022.1.8
web, release-notes, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-21668
advisory
-
github.com
/pypa/advisory-database/tree/main/vulns/pipenv/PYSEC-2022-6.yaml
web
-
github.com
/pypa/pipenv
package
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4
web
Sources
- CVE List CVE-2022-21668
- GitHub Advisory GHSA-qc9x-gjcv-465w
- NVD CVE-2022-21668
- OSV PYSEC-2022-6
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.