Miggo Logo

CVE-2025-62594: ImageMagick CLAHE : Unsigned underflow and division-by-zero lead to OOB pointer arithmetic and process crash (DoS)

4.7

CVSS Score
3.1

Basic Information

EPSS Score
-
Published
10/27/2025
Updated
10/27/2025
KEV Status
No
Technology
TechnologyC#

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
Magick.NET-Q16-x64nuget<= 14.9.0
Magick.NET-Q8-x64nuget<= 14.9.0
Magick.NET-Q16-HDRI-x64nuget<= 14.9.0
Magick.NET-Q8-OpenMP-x64nuget<= 14.9.0
Magick.NET-Q16-HDRI-OpenMP-x64nuget<= 14.9.0
Magick.NET-Q16-OpenMP-x64nuget<= 14.9.0
Magick.NET-Q8-arm64nuget<= 14.9.0
Magick.NET-Q16-arm64nuget<= 14.9.0
Magick.NET-Q16-OpenMP-arm64nuget<= 14.9.0
Magick.NET-Q8-OpenMP-arm64nuget<= 14.9.0
Magick.NET-Q16-HDRI-OpenMP-arm64nuget<= 14.9.0
Magick.NET-Q16-HDRI-arm64nuget<= 14.9.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability description explicitly names CLAHEImage in MagickCore/enhance.c as the source of the vulnerability. The core issue is that the tile dimensions (tile_info.width and tile_info.height) can be set to zero, either from a direct user-provided value (e.g., -clahe 0x0!) or through calculation based on a very small image (image->columns >> 3 or image->rows >> 3).

The provided patch from the commit 7b47fe369eda90483402fcd3d78fa4167d3bb129 directly modifies the CLAHEImage function to address this root cause. The changes tile_info.width=MagickMax(width,2); and tile_info.height=MagickMax(height,2); are clearly intended to prevent these dimensions from becoming zero or one, thus preventing the subsequent division-by-zero and integer underflow vulnerabilities described. The vulnerability report details how a zero tile height leads to an underflow in pointer arithmetic (p += ... * (tile.height - 1)) and how a zero tile width/height leads to a crash from division/modulus by zero. Both of these unsafe operations occur within or are initiated by the logic in CLAHEImage. Therefore, CLAHEImage is the primary vulnerable function that would appear in a runtime profile when the vulnerability is triggered.

Vulnerable functions

CLAHEImage
MagickCore/enhance.c
The `CLAHEImage` function is vulnerable to integer underflow and division-by-zero. The vulnerability is triggered when the tile width or height is calculated to be zero, which can happen if the input image is very small or if the user provides specific `clahe` arguments. A zero tile dimension leads to two distinct issues within the function and its helper functions: a division-by-zero error during image padding calculation and an integer underflow when calculating a pointer offset, resulting in an out-of-bounds memory access and a denial-of-service.

WAF Protection Rules

WAF Rule

## Summ*ry * sin*l* root **us* in t** *L*** impl*m*nt*tion — til* wi*t*/**i**t ***omin* z*ro — pro*u**s two *istin*t *ut r*l*t** uns*** ****viors. Vuln*r**iliti*s *xists in t** `*L***Im***()` *un*tion o* Im***M**i*k’s `M**i*k*or*/*n**n**.*`. *. Uns

Reasoning

T** vuln*r**ility **s*ription *xpli*itly n*m*s `*L***Im***` in `M**i*k*or*/*n**n**.*` *s t** sour** o* t** vuln*r**ility. T** *or* issu* is t**t t** til* *im*nsions (`til*_in*o.wi*t*` *n* `til*_in*o.**i**t`) **n ** s*t to z*ro, *it**r *rom * *ir**t u