Miggo Logo

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

8.1

CVSS Score
3.1

Basic Information

EPSS Score
0.80775%
Published
1/12/2022
Updated
10/11/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
pipenvpip>= 2018.10.9, < 2022.1.82022.1.8

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from pipenv's requirements.txt parser processing command-line options in comments. The parse_indexes() function in utils.py is explicitly called out in the advisory as the vulnerable component. It uses argparse to parse lines without first stripping comments, violating the requirements.txt spec. The function's use of argparse.ArgumentParser with default settings allows abbreviated options (e.g., --t for --trusted-host), and fails to validate that options appear on their own lines. The commit diff shows this function was modified in the fix (via test_utils.py changes demonstrating comment handling), confirming its role in the vulnerability.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

## Issu* Summ*ry *u* to * *l*w in pip*nv's p*rsin* o* r*quir*m*nts *il*s, *n *tt**k*r **n ins*rt * sp**i*lly *r**t** strin* insi** * *omm*nt *nyw**r* wit*in * r*quir*m*nts.txt *il*, w*i** will **us* vi*tims w*o us* pip*nv to inst*ll t** r*quir*m*nts

Reasoning

T** vuln*r**ility st*ms *rom pip*nv's r*quir*m*nts.txt p*rs*r pro**ssin* *omm*n*-lin* options in *omm*nts. T** p*rs*_in**x*s() *un*tion in utils.py is *xpli*itly **ll** out in t** **visory *s t** vuln*r**l* *ompon*nt. It us*s *r*p*rs* to p*rs* lin*s