CVE-2025-66628: ImageMagick is vulnerable to an Integer Overflow in TIM decoder leading to out of bounds read (32-bit only)
Summary The TIM (PSX TIM) image parser in ImageMagick contains a critical integer overflow vulnerability in the ReadTIMImage function (coders/tim.c). The code reads width and height (16-bit values) from the file header and calculates imagesize = 2 width height without checking for overflow. On 32-bit systems (or where sizet is 32-bit), this calculation can overflow if width and height are large (e.g., 65535), wrapping around to a small value. This results in a small heap allocation via AcquireQuantumMemory and later operations relying on the dimensions can trigger an out of bounds read. Vulnerable Code File: coders/tim.c c width=ReadBlobLSBShort(image); height=ReadBlobLSBShort(image); imagesize=2widthheight; // Line 234 - NO OVERFLOW CHECK!
Impact This vulnerability can lead to Arbitrary Memory Disclosure due to an out of bounds read on 32-bit systems.
Other sources
ImageMagick is a software suite to create, edit, compose, or convert bitmap images. In versions 7.1.2-9 and prior, the TIM (PSX TIM) image parser contains a critical integer overflow vulnerability in its ReadTIMImage function (coders/tim.c). The code reads width and height (16-bit values) from the file header and calculates imagesize = 2 width height without checking for overflow. On 32-bit systems (or where sizet is 32-bit), this calculation can overflow if width and height are large (e.g., 65535), wrapping around to a small value. This results in a small heap allocation via AcquireQuantumMemory and later operations relying on the dimensions can trigger an out of bounds read. This issue is fixed in version 7.1.2-10.
— MITRE
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2025-66628?
CVE-2025-66628 is rated as a critical severity vulnerability due to the potential for integer overflow that could lead to arbitrary code execution.
How do I fix CVE-2025-66628?
To fix CVE-2025-66628, upgrade to Magick.NET version 14.10.0 or later.
What software is affected by CVE-2025-66628?
CVE-2025-66628 affects multiple Magick.NET packages, including Magick.NET-Q8-x86, Magick.NET-Q16-AnyCPU, and others up to version 14.10.0.
What component of ImageMagick is impacted by CVE-2025-66628?
The integer overflow in CVE-2025-66628 is specifically located in the ReadTIMImage function of the TIM image parser.
What are the potential consequences of CVE-2025-66628?
Exploitation of CVE-2025-66628 could allow an attacker to execute arbitrary code or cause a denial-of-service condition.