LowGHSA-fh55-q5pj-pxgwCVE-2025-55212

ImageMagick affected by divide-by-zero in ThumbnailImage via montage -geometry ":" leads to crash

Published 26 Aug 2025 · Updated 3 Nov 2025

Is your project on an affected Magick.NET-Q16-AnyCPU?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several .NET apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected packages

Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-AnyCPU --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-AnyCPU --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-OpenMP-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-OpenMP-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-HDRI-x86 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-OpenMP-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-OpenMP-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q16-x86 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-AnyCPU --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-OpenMP-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-OpenMP-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-arm64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-x64 --version 14.8.1
Affected
<14.8.1
Fixed in
14.8.1
Update to the fixed version for your release line, for example:dotnet add package Magick.NET-Q8-x86 --version 14.8.1

Details

Summary

Passing a geometry string containing only a colon (":") to montage -geometry leads GetGeometry() to set width/height to 0. Later, ThumbnailImage() divides by these zero dimensions, triggering a crash (SIGFPE/abort), resulting in a denial of service.

Details

Root Cause 1. montage -geometry ":" ... reaches MagickCore/geometry.c:GetGeometry(). 2. StringToDouble/InterpretLocaleValue parses ":" as 0.0; then: https://github.com/ImageMagick/ImageMagick/blob/0ba1b587be17543b664f7ad538e9e51e0da59d17/MagickCore/geometry.c#L355 WidthValue (and/or HeightValue) is set with a zero dimension. 3. In MagickCore/resize.c:ThumbnailImage(), the code computes: https://github.com/ImageMagick/ImageMagick/blob/0ba1b587be17543b664f7ad538e9e51e0da59d17/MagickCore/resize.c#L4625-L4629 causing a division by zero and immediate crash.

The issue is trivially triggerable without external input files (e.g., using xc:white).

Reproduction

Environment

Version: ImageMagick 7.1.2-1 (Beta) Q16-HDRI x86_64 0ba1b587b:20250812 https://imagemagick.org
Features: Cipher DPC HDRI
Delegates (built-in): bzlib fontconfig freetype jbig jng jpeg lcms lzma pangocairo png tiff x xml zlib
Compiler: clang (14.0.0)
OS/Arch: Linux x86_64

Steps

./bin/magick montage -geometry : xc:white null:

Observed result

IOT instruction (core dumped)
# (Environment-dependent: SIGFPE/abort may be observed.)

PoC

No external file required; the pseudo image xc:white suffices:

./bin/magick montage -geometry : xc:white null:

Impact

  • Denial of Service: A divide-by-zero in ThumbnailImage() causes immediate abnormal termination (e.g., SIGFPE/abort), crashing the ImageMagick process.

Suggested fix

Defensively reject zero dimensions early in ThumbnailImage():

if ((columns == 0) || (rows == 0)) {
  (void) ThrowMagickException(exception, GetMagickModule(), OptionError,
    "InvalidGeometry", "thumbnail requires non-zero dimensions: %.20gx%.20g",
    (double) columns, (double) rows);
  return (Image *) NULL;
}

Additionally, consider tightening validation in GetGeometry() so that colon-only (and similar malformed) inputs do not yield WidthValue/HeightValue with zero, or are rejected outright. Variants like "x:" or ":x" may also need explicit handling (maintainer confirmation requested).

Credits

Team Daemon Fuzz Hunters

Bug Hunting Master Program, HSpace/Findthegap <br>

Woojin Park @jin-156 [1203kids@gmail.com](mailto:1203kids@gmail.com)

Hojun Lee @leehohojune [leehojune@korea.ac.kr](mailto:leehojune@korea.ac.kr)

Youngin Won @amethyst0225 [youngin04@korea.ac.kr](mailto:youngin04@korea.ac.kr)

Siyeon Han @hanbunny [kokosyeon@gmail.com](mailto:kokosyeon@gmail.com)

Is GHSA-fh55-q5pj-pxgw in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected Magick.NET-Q16-AnyCPU, and gives you the command that fixes it.

More advisories for Magick.NET-Q16-AnyCPU

  • LowCVE-2026-66011ImageMagick: Memory Leak when providing invalid options to the cli · 2 Sept 2026
  • MediumCVE-2026-53466ImageMagick: Heap Buffer Over-Read in XCF decoder due to integer conversion overflow · 31 Jul 2026
  • MediumCVE-2026-62946ImageMagick: Integer Overflow in JNX decoder causes heap buffer over-write when processing extremly large files on 32-bit builds · 24 Jul 2026
  • MediumCVE-2026-62363ImageMagick: Heap Buffer Over-Write in fx operation · 24 Jul 2026
  • MediumCVE-2026-62343ImageMagick: Heap Buffer Over-Write in morphology operation when an invalid kernel is provided · 24 Jul 2026
  • LowCVE-2026-61464ImageMagick: Heap Buffer Over-Write in X11 import with crafted window title · 24 Jul 2026
All 165 advisories for Magick.NET-Q16-AnyCPU

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.