Description

A high-severity vulnerability has been discovered in ImageMagick, a widely deployed open-source image processing library used across web applications, content management systems, and enterprise platforms. The flaw, tracked as CVE-2025-66628 with a CVSS score of 7.5, affects the handling of the legacy PSX TIM image format and poses a significant security risk to 32-bit systems. The vulnerability is located in the ReadTIMImage function within the coders/tim.c component, which is responsible for parsing PSX TIM files. When processing an image, ImageMagick reads the 16-bit width and height values from the file header and calculates the required memory using the formula 2 × width × height. This calculation is performed without validating whether the operation results in an integer overflow. On systems where size_t is 32-bit, an attacker can exploit this oversight by supplying a specially crafted TIM file with excessively large dimensions. The multiplication wraps around, producing a much smaller value than expected and resulting in an insufficient heap allocation. Despite this, the application continues processing the image as if a large buffer were available. This mismatch leads to out-of-bounds memory reads, enabling arbitrary memory disclosure. An attacker could potentially extract sensitive information from adjacent memory regions, including credentials, cryptographic keys, or application data, depending on the execution context. The issue affects ImageMagick versions prior to 7.1.2-9. The ImageMagick maintainers have addressed the vulnerability in version 7.1.2-10 by implementing proper overflow checks during memory size calculations. Administrators operating ImageMagick on 32-bit architectures, including legacy servers and embedded or IoT devices, are strongly encouraged to update to the patched release as soon as possible to reduce the risk of memory exposure and data leakage.