CVE-2018-13347: Integer Addition and Subtraction Mishandling in Mercurial

mercurial Updated 02 Oct 2025

Summary

06/07/2018
Yes i
Critical
9.8

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for mercurial.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback