Pipenv's requirements.txt parsing allows malicious index url in comments
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-427.
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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| pypa | pipenv | 2018.10.9 to before 2022.1.8 | 2022.1.8 | Patch available | CNA |
| — | pipenv (PyPI) | 2018.10.9 to before 2022.1.8 | 2022.1.8 | Patch available | GHSA-qc9x-gjcv-465w |
- pipenv Vendorpypa Affected 2018.10.9 to before 2022.1.8 Fixed in 2022.1.8 Patch available CNA
- pipenv (PyPI) Vendor— Affected 2018.10.9 to before 2022.1.8 Fixed in 2022.1.8 Patch available GHSA-qc9x-gjcv-465w
CPE configurations NVD · 4
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:pypa:pipenv:*:*:*:*:*:*:*:* | 2018.10.9 to before 2022.1.8 | Vulnerable | pypa |
| cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:* | 34 | Vulnerable | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* | 35 | Vulnerable | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* | 36 | Vulnerable | Fedoraproject |
- cpe:2.3:a:pypa:pipenv:*:*:*:*:*:*:*:* Versions 2018.10.9 to before 2022.1.8 Vulnerable ·pypa
- cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:* Versions 34 Vulnerable ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* Versions 36 Vulnerable ·Fedoraproject
Remediation
- Fix · CNA pipenv (pypa) Fixed in 2022.1.8
- Fix · GHSA-qc9x-gjcv-465w pipenv (PyPI) Fixed in 2022.1.8 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2022-21668
- 2026-10-03 Alias added: GHSA-qc9x-gjcv-465w
- 2026-10-30 EPSS moved to the 90th–95th percentile
References
Advisory 5
Other 5
- 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/[email protected]/message/56HBA3EOSLEDNCCBJVHE6DO34P56EOUM
- https://lists.fedoraproject.org/archives/list/[email protected]/message/KCROBYHUS6DKQPCXBRPCZ5CDBNQTYAWT
- https://lists.fedoraproject.org/archives/list/[email protected]/message/QHQRIWKDP3SVJABAPEXBIQPKDI6UP7G4
Sources
- CVE-2022-21668 · CVE Program
- CVE-2022-21668 · NVD
- FIRST EPSS
- GHSA-qc9x-gjcv-465w · GitHub Advisory Database · CC BY 4.0
- CVE-2022-21668 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences