CVE-2023-5752 Mercurial configuration injectable in repo revision when installing via pip
Attackers can inject arbitrary Mercurial configuration options during pip installation from VCS URLs, potentially leading to code execution.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-5752?
CVE-2023-5752 is a medium-severity command injection vulnerability in pip, published on 24 Oct 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
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 from Mercurial.
Weakness: CWE-77
Which versions are affected by CVE-2023-5752?
3 open source packages ship an affected version, including pip. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
pip PyPI | All versions | 23.3 |
pip PyPI | All versions | 23.3 |
pip PyPI | All versions | 23.3 |
Linux distribution packages (10)
python-pip SUSE:Linux Enterprise Module for Python 3 15 SP4 | All versions | 22.3.1-150400.17.12.1 |
python-pip SUSE:Linux Enterprise Module for Python 3 15 SP5 | All versions | 22.3.1-150400.17.12.1 |
python312-pip SUSE:Linux Enterprise Module for Python 3 15 SP6 | All versions | 23.2.1-150600.3.3.1 |
python-pip SUSE:Linux Enterprise Server 12 SP5 | All versions | 10.0.1-13.14.1 |
python36-pip SUSE:Linux Enterprise Server 12 SP5 | All versions | 20.2.4-8.15.1 |
python-pip SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 10.0.1-13.14.1 |
python36-pip SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 20.2.4-8.15.1 |
python-pip openSUSE:Leap 15.4 | All versions | 22.3.1-150400.17.12.1 |
python-pip openSUSE:Leap 15.5 | All versions | 22.3.1-150400.17.12.1 |
python312-pip openSUSE:Leap 15.6 | All versions | 23.2.1-150600.3.3.1 |
Products include Pypa Pip.
How do I fix CVE-2023-5752?
Upgrade pip to 23.3 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2023-5752 being exploited?
There is no known exploitation of CVE-2023-5752 in the wild and no public exploit code.
Other vulnerabilities in pip
Sources
Also known as AZL-39958, AZL-60006, DEBIAN-CVE-2023-5752, ECHO-1342-c991-4c68, GHSA-mq26-g339-26xf, MGASA-2025-0055 and 8 more.