CVE-2022-21668
Python vulnerability analysis and mitigation

Overview

CVE-2022-21668 affects pipenv, a Python development workflow tool, from version 2018.10.9 to version 2021.11.23. The vulnerability was discovered in January 2022 and patched in version 2022.1.8. The flaw exists in pipenv's parsing of requirements files, which allows an attacker to insert specially crafted strings inside comments within a requirements.txt file (GitHub Advisory).

Technical details

The vulnerability stems from a flaw in the parse_indexes() function of the pipenv.utils module, which incorrectly processes --index-url, --extra-index-url, and --trusted-host options. The function fails to ignore these options when they appear in comments and doesn't validate that these options appear on their own lines as required by the requirements file specification. The vulnerability has a CVSS v3.1 base score of 8.6 HIGH (AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H) according to NVD, while GitHub rates it at 8.0 HIGH (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H) (NVD, GitHub Advisory).

Impact

If successfully exploited, an attacker can cause victims using pipenv to download dependencies from a malicious package index server controlled by the attacker. When pip installs from a source distribution, any code in the setup.py is executed by the install process, enabling arbitrary remote code execution (RCE) on the victim's system. Attackers could potentially steal credentials, mine cryptocurrency, install malware, or gain persistent access to the victim's system (GitHub Advisory).

Exploitability

The exploitation likelihood is considered low to moderate. The primary challenge for attackers is surreptitiously inserting a specially crafted string into a requirements.txt file that will be installed by victims. The vulnerability is particularly concerning because attackers can hide malicious code in comments, which are typically assumed to be ignored. The attack can be further obfuscated using abbreviated option names supported by argparse, making malicious insertions harder to detect (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been patched in pipenv version 2022.1.8. Users should upgrade to this version or later to mitigate the risk. The fix includes changes to properly handle requirements file parsing and validation of index options (GitHub Release, GitHub Patch).

Community reactions

The vulnerability was addressed promptly by the pipenv maintainers and received attention from various Linux distributions. Fedora released security updates for versions 34, 35, and 36 to address the vulnerability (Fedora 34, Fedora 35, Fedora 36).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-48039CRITICAL9.1
  • Python logoPython
  • meta-ads-mcp
NoYesAug 07, 2026
CVE-2026-48169HIGH8.8
  • Python logoPython
  • praisonai-platform
NoYesAug 07, 2026
GHSA-wvpp-8hx9-p66jHIGH8.8
  • Python logoPython
  • gitpython
NoYesAug 07, 2026
CVE-2026-71870MEDIUM4.8
  • Python logoPython
  • pypdf
NoYesAug 07, 2026
CVE-2026-71852MEDIUM4.8
  • Python logoPython
  • pypdf
NoYesAug 07, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management