Skip to content
Fencer Vulns
high 8.0

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 products
    not 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

Sources

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.