When installing a package from a Mercurial VCS URL (ie "pip install hg+...") with pip prior to v23.3, the specified Mercurial revision could be used to inject arbitrary configuration options to the "hg clone" call (ie "--config"). Controlling the Mercurial configuration can modify how and which repository is installed.
This vulnerability does not affect users who aren't installing Mercurial VCS URLs.
This is a MEDIUM severity vulnerability.
Affected versions:
pip before v23.3 are affected by this vulnerability.
Remediation:
- Upgrade to at least pip v23.3
- Don't clone Mercurial repositories or allow uncontrolled input to the target Mercurial URL and revision.
References: