{"id":"CVE-2025-66628","aliases":["CVE-2025-66628","GHSA-6hjr-v6g4-3fm8"],"related":[],"kind":"vulnerability","state":"published","title":"ImageMagick is vulnerable to an Integer Overflow in TIM decoder leading to out of bounds read (32-bit only)","summary":"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 image_size = 2 * width * height without checking for overflow. On 32-bit systems (or where size_t 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 image_size = 2 * width * height without checking for overflow. On 32-bit systems (or where size_t 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.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe 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 `image_size = 2 * width * height` without checking for overflow.\nOn 32-bit systems (or where `size_t` 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.\n### Vulnerable Code\nFile: `coders/tim.c`\n```c\nwidth=ReadBlobLSBShort(image);\nheight=ReadBlobLSBShort(image);\nimage_size=2*width*height;       // Line 234 - NO OVERFLOW CHECK!\n```\n\n### Impact\nThis vulnerability can lead to Arbitrary Memory Disclosure due to an out of bounds read on 32-bit systems.","format":"markdown","source":"ghsa"},{"lang":"es","text":"ImageMagick es una suite de software para crear, editar, componer o convertir imágenes de mapa de bits. En las versiones 7.1.2-9 y anteriores, el analizador de imágenes TIM (PSX TIM) contiene una vulnerabilidad crítica de desbordamiento de entero en su función ReadTIMImage (coders/tim.c). El código lee el ancho y el alto (valores de 16 bits) del encabezado del archivo y calcula image_size = 2 * width * height sin verificar si hay desbordamiento. En sistemas de 32 bits (o donde size_t es de 32 bits), este cálculo puede desbordarse si el ancho y el alto son grandes (por ejemplo, 65535), envolviéndose a un valor pequeño. Esto resulta en una pequeña asignación de memoria en el heap a través de AcquireQuantumMemory y operaciones posteriores que dependen de las dimensiones pueden desencadenar una lectura fuera de límites. Este problema se corrige en la versión 7.1.2-10.","source":"nvd"}],"published":"2025-12-10T15:47:42.000Z","modified":"2026-09-25T23:10:00.463Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"version":"< 7.1.2-10","status":"affected"}],"vendor":"ImageMagick","product":"ImageMagick","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q16-AnyCPU","purl":"pkg:nuget/Magick.NET-Q16-AnyCPU","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q16-HDRI-AnyCPU","purl":"pkg:nuget/Magick.NET-Q16-HDRI-AnyCPU","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q16-HDRI-x86","purl":"pkg:nuget/Magick.NET-Q16-HDRI-x86","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q16-x86","purl":"pkg:nuget/Magick.NET-Q16-x86","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q8-AnyCPU","purl":"pkg:nuget/Magick.NET-Q8-AnyCPU","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"14.10.0"}],"ecosystem":"NuGet","package":"Magick.NET-Q8-x86","purl":"pkg:nuget/Magick.NET-Q8-x86","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"7.1.2-10"}],"vendor":"imagemagick","product":"imagemagick","cpe":"cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hjr-v6g4-3fm8","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/dlemstra/Magick.NET/commit/2dfa08e15cfd11016a79615994787b14f9048b1c","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ImageMagick/ImageMagick","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-12-11T15:38:44.136Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-66628","url":"https://www.cve.org/CVERecord?id=CVE-2025-66628","licence":"CVE Terms of Use","modified":"2025-12-11T15:38:56.050Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6hjr-v6g4-3fm8","url":"https://github.com/advisories/GHSA-6hjr-v6g4-3fm8","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:33.685Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-66628","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-66628","licence":"Public domain","modified":"2026-09-25T23:10:00.463Z"}],"updatedAt":"2026-11-25T22:59:09.209Z","epss":{"score":0.00551,"percentile":0.4749,"date":"2026-12-01T12:00:22.000Z"}}