CVE-2023-5752: CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection') in Pip maintainers pip
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.
AI Analysis
Technical Summary
CVE-2023-5752 is a medium severity command injection vulnerability affecting pip, the Python package installer, specifically versions prior to 23.3. The vulnerability arises when pip installs a package from a Mercurial (hg) version control system URL using the syntax 'pip install hg+...'. In this process, the Mercurial revision parameter can be manipulated to inject arbitrary configuration options into the underlying 'hg clone' command via the '--config' flag. This improper neutralization of special elements (CWE-77) allows an attacker to control Mercurial's configuration during the clone operation, potentially redirecting the repository source or altering repository behavior. The vulnerability requires the attacker to have the ability to specify the Mercurial revision parameter, which typically implies some level of control over the package installation command or the package source specification. The CVSS 3.1 score of 5.5 reflects that the attack vector is local (AV:L), requires low privileges (PR:L), no user interaction (UI:N), and impacts integrity (I:H) but not confidentiality or availability. There are no known exploits in the wild at the time of publication. This vulnerability does not affect users who do not install packages from Mercurial repositories, limiting its scope. The root cause is insufficient sanitization of the revision parameter, allowing command injection into the Mercurial clone process. The vulnerability was publicly disclosed on October 24, 2023, by the Python Software Foundation (PSF).
Potential Impact
For European organizations, the primary impact of CVE-2023-5752 lies in the potential integrity compromise of software supply chains that rely on pip installations from Mercurial repositories. An attacker exploiting this vulnerability could manipulate the source code or configuration of installed packages by injecting malicious repository configurations, leading to the installation of tampered or malicious code. This can result in compromised applications, backdoors, or further lateral movement within the network. While the vulnerability does not directly affect confidentiality or availability, the integrity breach can have cascading effects, including data breaches or system compromise. Organizations with automated build systems, continuous integration pipelines, or development environments that use Mercurial-based package sources are at higher risk. Since Mercurial is less commonly used than Git, the affected population is smaller but still significant in sectors where Mercurial remains in use. The medium severity rating indicates a moderate risk, but the potential for supply chain attacks elevates the importance of timely remediation. European entities involved in software development, especially those in regulated industries or critical infrastructure, must consider this vulnerability seriously to maintain software integrity and trust.
Mitigation Recommendations
1. Upgrade pip to version 23.3 or later immediately, as this version contains the fix for CVE-2023-5752. 2. Avoid installing Python packages from Mercurial VCS URLs unless absolutely necessary; prefer more secure and widely used sources like PyPI or Git repositories. 3. Audit and sanitize all inputs related to package installation commands, especially those involving Mercurial revisions, to prevent injection of malicious configuration options. 4. Implement strict controls and monitoring on build and deployment pipelines to detect unusual or unauthorized package sources or configurations. 5. Use virtual environments and containerization to isolate package installations and limit the impact of potential compromises. 6. Educate developers and DevOps teams about the risks of using Mercurial URLs in pip installations and encourage best practices for secure package management. 7. Employ software composition analysis tools to detect and alert on vulnerable pip versions or unsafe package sources. 8. Review and restrict permissions for users who can execute pip install commands with Mercurial URLs to reduce the attack surface.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden
CVE-2023-5752: CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection') in Pip maintainers pip
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.
AI-Powered Analysis
Technical Analysis
CVE-2023-5752 is a medium severity command injection vulnerability affecting pip, the Python package installer, specifically versions prior to 23.3. The vulnerability arises when pip installs a package from a Mercurial (hg) version control system URL using the syntax 'pip install hg+...'. In this process, the Mercurial revision parameter can be manipulated to inject arbitrary configuration options into the underlying 'hg clone' command via the '--config' flag. This improper neutralization of special elements (CWE-77) allows an attacker to control Mercurial's configuration during the clone operation, potentially redirecting the repository source or altering repository behavior. The vulnerability requires the attacker to have the ability to specify the Mercurial revision parameter, which typically implies some level of control over the package installation command or the package source specification. The CVSS 3.1 score of 5.5 reflects that the attack vector is local (AV:L), requires low privileges (PR:L), no user interaction (UI:N), and impacts integrity (I:H) but not confidentiality or availability. There are no known exploits in the wild at the time of publication. This vulnerability does not affect users who do not install packages from Mercurial repositories, limiting its scope. The root cause is insufficient sanitization of the revision parameter, allowing command injection into the Mercurial clone process. The vulnerability was publicly disclosed on October 24, 2023, by the Python Software Foundation (PSF).
Potential Impact
For European organizations, the primary impact of CVE-2023-5752 lies in the potential integrity compromise of software supply chains that rely on pip installations from Mercurial repositories. An attacker exploiting this vulnerability could manipulate the source code or configuration of installed packages by injecting malicious repository configurations, leading to the installation of tampered or malicious code. This can result in compromised applications, backdoors, or further lateral movement within the network. While the vulnerability does not directly affect confidentiality or availability, the integrity breach can have cascading effects, including data breaches or system compromise. Organizations with automated build systems, continuous integration pipelines, or development environments that use Mercurial-based package sources are at higher risk. Since Mercurial is less commonly used than Git, the affected population is smaller but still significant in sectors where Mercurial remains in use. The medium severity rating indicates a moderate risk, but the potential for supply chain attacks elevates the importance of timely remediation. European entities involved in software development, especially those in regulated industries or critical infrastructure, must consider this vulnerability seriously to maintain software integrity and trust.
Mitigation Recommendations
1. Upgrade pip to version 23.3 or later immediately, as this version contains the fix for CVE-2023-5752. 2. Avoid installing Python packages from Mercurial VCS URLs unless absolutely necessary; prefer more secure and widely used sources like PyPI or Git repositories. 3. Audit and sanitize all inputs related to package installation commands, especially those involving Mercurial revisions, to prevent injection of malicious configuration options. 4. Implement strict controls and monitoring on build and deployment pipelines to detect unusual or unauthorized package sources or configurations. 5. Use virtual environments and containerization to isolate package installations and limit the impact of potential compromises. 6. Educate developers and DevOps teams about the risks of using Mercurial URLs in pip installations and encourage best practices for secure package management. 7. Employ software composition analysis tools to detect and alert on vulnerable pip versions or unsafe package sources. 8. Review and restrict permissions for users who can execute pip install commands with Mercurial URLs to reduce the attack surface.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- PSF
- Date Reserved
- 2023-10-24T15:04:01.631Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6908ed741c2a0078ae51024e
Added to database: 11/3/2025, 5:59:16 PM
Last enriched: 11/3/2025, 6:03:58 PM
Last updated: 11/6/2025, 6:04:20 AM
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-12560: CWE-918 Server-Side Request Forgery (SSRF) in pr-gateway Blog2Social: Social Media Auto Post & Scheduler
MediumSonicWall Confirms State-Sponsored Hackers Behind September Cloud Backup Breach
MediumCVE-2025-12563: CWE-862 Missing Authorization in pr-gateway Blog2Social: Social Media Auto Post & Scheduler
MediumCVE-2025-11271: CWE-807 Reliance on Untrusted Inputs in a Security Decision in smub Easy Digital Downloads – eCommerce Payments and Subscriptions made easy
MediumCVE-2025-61994: Cross-site scripting (XSS) in GROWI, Inc. GROWI
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.