# 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.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N`)
- **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:** Yes
- **Published:** 24 Oct 2023
- **Updated:** 3 Nov 2025
- **Also known as:** AZL-39958, AZL-60006, DEBIAN-CVE-2023-5752, ECHO-1342-c991-4c68, GHSA-mq26-g339-26xf, MGASA-2025-0055, MINI-4xrg-28vr-6946, PYSEC-2023-228, ROOT-APP-PYPI-CVE-2023-5752, SUSE-SU-2023:4987-1, SUSE-SU-2023:4988-1, SUSE-SU-2024:0892-1, SUSE-SU-2024:3156-1, openSUSE-SU-2024:13454-1

## 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 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2023-5752?

3 open source packages ship an affected version, including pip. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pip` | PyPI | All versions | 23.3 |
| `pip` | PyPI | All versions | 23.3 |
| `pip` | PyPI | All versions | 23.3 |
| `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: Pypa Pip.

## How do I fix CVE-2023-5752?

Upgrade pip to 23.3 or later.

## 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

- [CVE-2018-20225](https://insights.sbomify.com/CVE-2018-20225/): Supply chain in n/a (high 7.8)
- [CVE-2013-1629](https://insights.sbomify.com/CVE-2013-1629/): Improper Input Validation in pip (medium 6.8)
- [CVE-2026-13346](https://insights.sbomify.com/CVE-2026-13346/): pip absolute path traversal during download from malicious package indexes (medium 5.6)
- [CVE-2026-8643](https://insights.sbomify.com/CVE-2026-8643/): pip can extract console_scripts and gui_scripts outside installation directory (medium 4.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-5752 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2023-5752 in the wild and no public exploit code.

Affected packages and fixed versions:
- pip (PyPI): affected all versions; fixed in 23.3
- pip (PyPI): affected all versions; fixed in 23.3
- pip (PyPI): affected all versions; fixed in 23.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-5752/ (Markdown: https://insights.sbomify.com/CVE-2023-5752/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-5752
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-5752
- OSV: https://osv.dev/vulnerability/CVE-2023-5752

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-5752/
Summaries are generated and may contain mistakes; the official description above is the record.
