CVE-2022-21668
Pipenv's requirements.txt parsing allows malicious index url in comments
Also known as GHSA-qc9x-gjcv-465w, PYSEC-2022-6
Mitigation
- Upgrade pipenv to 2022.1.8 or later.
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
Vulnerability facts
- Affected
- pipenv >= 2018.10.9, < 2022.1.8
- Fixed in
- 2022.1.8
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, login needed
- CVSS
- 8.0 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 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
- EPSS
- 3.93% chance of exploitation in 30 days (percentile 91, 2026-11-26)
- CWE
- CWE-20, CWE-77, CWE-78, CWE-427, CWE-791
- Modified
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
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
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.
References
Vendor advisories
- https://github.com/pypa/pipenv/security/advisories/GHSA-qc9x-gjcv-465w
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM/
- https://nvd.nist.gov/vuln/detail/CVE-2022-21668
Other
- https://github.com/pypa/pipenv/releases/tag/v2022.1.8
- https://github.com/pypa/advisory-database/tree/main/vulns/pipenv/PYSEC-2022-6.yaml
- https://github.com/pypa/pipenv
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4
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.