Miggo Logo

CVE-2018-13347: Mercurial mishandles integer addition and subtraction

9.8

CVSS Score
3.0

Basic Information

EPSS Score
0.61749%
Published
5/13/2022
Updated
9/25/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
mercurialpip< 4.6.14.6.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The security patch adds mpatch_apply() in mpatch.c. The original vulnerability (CWE-190) occurred when handling fragment positions in binary patches. The added checks for negative 'last' values (f->start < last || f->end > len || last < 0) and post-loop validation directly address integer wrapping/underflow scenarios. As this is the core patch application function that processes untrusted delta patches, it would appear in stack traces during exploitation attempts involving maliciously crafted patches.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

`mp*t**.*` in M*r*uri*l ***or* *.*.* mis**n*l*s int***r ***ition *n* su*tr**tion, *k* OV*-********-****.

Reasoning

T** s**urity p*t** ***s `mp*t**_*pply()` in `mp*t**.*`. T** ori*in*l vuln*r**ility (*W*-***) o**urr** w**n **n*lin* *r**m*nt positions in *in*ry p*t***s. T** ***** ****ks *or n***tiv* 'l*st' v*lu*s (*->st*rt < l*st || *->*n* > l*n || l*st < *) *n* po