CVE-2018-13347: Integer Addition and Subtraction Mishandling in Mercurial
Summary
CVE-2018-13347: mpatch.c in Mercurial before 4.6.1 mishandles integer addition and subtraction, aka OVE-20180430-0002. Affects mercurial versions < 4.6.1. Fixed in 4.6.1. How to fix ↓
Also tracked for
- mercurial · Debian:11
The same CVE-2018-13347 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Mercurial is a distributed version control system (DVCS) that provides users with the ability to efficiently manage and track changes to their codebase. It is widely used by developers and organizations for source code management. However, prior to version 4.6.1, Mercurial was susceptible to an integer addition and subtraction mishandling vulnerability (CVE-2018-13347).
Vulnerability Detail
The vulnerability in Mercurial arises from improper handling of integer addition and subtraction operations in the 'mpatch.c' file. This vulnerability, also known as OVE-20180430-0002, can be exploited by an attacker to manipulate the values of integers, potentially leading to various security issues. The impact of this vulnerability can range from denial of service (DoS) attacks to arbitrary code execution, depending on how it is exploited.
How To Fix
Latest published version: 7.2.4 as of 22 Oct 2026
pip install --upgrade "mercurial==7.2.4"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
4.6.1
This is the first release that contains the fix.
pip install --upgrade "mercurial==4.6.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating to the latest version is not immediately feasible, users can apply the following workaround to mitigate the vulnerability:
- Avoid processing untrusted or maliciously crafted Mercurial repositories.
- Regularly update and patch the Mercurial installation to minimize the risk of exploitation.
It is important to note that while workarounds can reduce the risk, they do not provide a comprehensive solution. Updating to the latest version is strongly recommended.
Conclusion
In conclusion, the vulnerability (CVE-2018-13347) in Mercurial prior to version 4.6.1 can be exploited to manipulate integer values, potentially leading to security issues. It is crucial to update to the latest version or apply the provided workaround to mitigate the risk. For further assistance or support in vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for mercurial →
FAQ
Mercurial is a distributed version control system (DVCS) used for managing source code and tracking changes.
The vulnerability can lead to various security issues, including denial of service (DoS) attacks and arbitrary code execution.
To fix the vulnerability, update Mercurial to version 4.6.1 or later.
Users can mitigate the vulnerability by avoiding processing untrusted Mercurial repositories and regularly updating their installation.
For more information, you can refer to the official advisory database source: https://github.com/pypa/advisory-database/blob/main/vulns/mercurial/PYSEC-2018-89.yaml
Related vulnerabilities
Recent vulnerabilities recorded for mercurial.