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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.0
- **CVSS:** 8.0 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: Low; User interaction: Required; Scope: Changed (impact reaches other components); Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 3.93% (percentile 91, 2026-11-26)
- **CWE:** CWE-20, CWE-77, CWE-78, CWE-427, CWE-791
- **Aliases:** GHSA-qc9x-gjcv-465w, PYSEC-2022-6
- **Published:** 2022-01-10T20:20:16.000Z
- **Modified:** 2026-06-17T04:26:43.423Z

## Who should check

- Projects that depend on PyPI package pipenv (\>= 2018.10.9, \< 2022.1.8)
- Anyone running pypa pipenv \>= 2018.10.9, \< 2022.1.8

## 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 and fixed versions

- PyPI `pipenv`: affected \>= 2018.10.9, \< 2022.1.8; fixed 2022.1.8 (osv)
- pypa pipenv: \>= 2018.10.9, \< 2022.1.8 (cvelist)

## Mitigation

- Upgrade pipenv to 2022.1.8 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-21668. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-21668.md
Affected: pipenv >= 2018.10.9, < 2022.1.8
Fixed in: 2022.1.8

Steps:
1. Search this machine and project for pipenv (PyPI), pypa pipenv: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-21668 being exploited?

There is no confirmed exploitation: CVE-2022-21668 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 3.93% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-21668?

High: CVSS 8.0 (v3.1, scored by CNA). Remote, login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2022-21668?

pipenv \>= 2018.10.9, \< 2022.1.8.

### Is there a fix for CVE-2022-21668?

Yes. Fixed in 2022.1.8. Upgrade pipenv to 2022.1.8 or later.

### How do I check if I'm affected by CVE-2022-21668?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/pypa/pipenv/security/advisories/GHSA-qc9x-gjcv-465w>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM/>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-21668>
- patch: <https://github.com/pypa/pipenv/commit/439782a8ae36c4762c88e43d5f0d8e563371b46f>
- other: <https://github.com/pypa/pipenv/releases/tag/v2022.1.8>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/pipenv/PYSEC-2022-6.yaml>
- other: <https://github.com/pypa/pipenv>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-21668>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-qc9x-gjcv-465w> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2022-6> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-21668> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-21668>
