CVE-2025-66628: Magick.NET Q16 AnyCPU ImageMagick Is Vulnerable To An Vulnerability

HIGH
Advisory Identifier: GHSA-6hjr-v6g4-3fm8
CVSS 7.5
CWE-125
Published
Advisory Summary

CVE-2025-66628 is a HIGH (CVSS 7.5) imagemagick is vulnerable to an vulnerability (CWE-125: Out-of-bounds Read) affecting Magick.NET Q16 AnyCPU libraries in the NuGet ecosystem. The issue involves imagemagick is vulnerable to an integer overflow in tim decoder leading to out of bounds read (32-bit only). Remediation is available by upgrading affected packages to version 14.10.0.

CVE-2025-66628 at a Glance

CVE Identifier CVE-2025-66628
GHSA Identifier GHSA-6hjr-v6g4-3fm8
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-125: Out-of-bounds Read
Affected Product Magick.NET Q16 AnyCPU
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-66628

To remediate this vulnerability, upgrade all affected Magick.NET Q16 AnyCPU dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Magick.NET-Q16-AnyCPU fixed: 14.10.0
Upgrade Magick.NET-Q16-AnyCPU to 14.10.0
Magick.NET-Q16-HDRI-AnyCPU fixed: 14.10.0
Upgrade Magick.NET-Q16-HDRI-AnyCPU to 14.10.0
Magick.NET-Q16-HDRI-x86 fixed: 14.10.0
Upgrade Magick.NET-Q16-HDRI-x86 to 14.10.0
Magick.NET-Q16-x86 fixed: 14.10.0
Upgrade Magick.NET-Q16-x86 to 14.10.0
Magick.NET-Q8-AnyCPU fixed: 14.10.0
Upgrade Magick.NET-Q8-AnyCPU to 14.10.0
Magick.NET-Q8-x86 fixed: 14.10.0
Upgrade Magick.NET-Q8-x86 to 14.10.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for Magick.NET-Q16-AnyCPU

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-66628, inspect your project dependencies for Magick.NET Q16 AnyCPU:

inspect dependencies for Magick.NET-Q16-AnyCPU

Analyze the terminal output to locate any version of Magick.NET Q16 AnyCPU in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 14.10.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Magick.NET Q16 AnyCPU, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 `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. ### Vulnerable Code File: `coders/tim.c` ```c width=ReadBlobLSBShort(image); height=ReadBlobLSBShort(image); image_size=2*width*height; // 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.

CVE-2025-66628 Affected Magick.NET Q16 AnyCPU Versions

6 component(s)
Fixed Versions:
14.10.0
Product / Package Ecosystem Affected Versions Fixed Version
Magick.NET-Q16-AnyCPU
NuGet
< 14.10.0
14.10.0
Magick.NET-Q16-HDRI-AnyCPU
NuGet
< 14.10.0
14.10.0
Magick.NET-Q16-HDRI-x86
NuGet
< 14.10.0
14.10.0
Magick.NET-Q16-x86
NuGet
< 14.10.0
14.10.0
Magick.NET-Q8-AnyCPU
NuGet
< 14.10.0
14.10.0
Magick.NET-Q8-x86
NuGet
< 14.10.0
14.10.0

References

Frequently Asked Questions

What is CVE-2025-66628?
CVE-2025-66628 is a security vulnerability in Magick.NET Q16 AnyCPU involving ImageMagick is vulnerable to an integer Overflow in TIM decoder leading to out of bounds read (32-bit only) under CWE-125: Out-of-bounds Read.
Which Magick.NET Q16 AnyCPU versions are affected?
Affected versions include releases prior to 14.10.0 across affected packages: Magick.NET-Q16-AnyCPU, Magick.NET-Q16-HDRI-AnyCPU, Magick.NET-Q16-HDRI-x86, Magick.NET-Q16-x86, Magick.NET-Q8-AnyCPU, Magick.NET-Q8-x86.
What version fixes CVE-2025-66628?
Upgrading to 14.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Magick.NET-Q16-AnyCPU affected?
Yes, Magick.NET-Q16-AnyCPU is affected in releases prior to 14.10.0. Upgrade your dependency to 14.10.0 or later.
Is Magick.NET-Q16-HDRI-AnyCPU affected?
Yes, Magick.NET-Q16-HDRI-AnyCPU is affected in releases prior to 14.10.0. Upgrade your dependency to 14.10.0 or later.
What is the CVSS score of CVE-2025-66628?
CVE-2025-66628 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-66628?
CVE-2025-66628 is classified under CWE-125: Out-of-bounds Read (The product reads data past the end, or before the beginning, of the intended buffer.).
How can I check NuGet dependencies for CVE-2025-66628?
Run the dependency tree command: 'inspect dependencies for Magick.NET-Q16-AnyCPU'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6hjr-v6g4-3fm8",
  "modified" : "2025-12-10T15:47:42Z",
  "published" : "2025-12-10T15:47:42Z",
  "aliases" : [ "CVE-2025-66628" ],
  "summary" : "ImageMagick is vulnerable to an integer Overflow in TIM decoder leading to out of bounds read (32-bit only)",
  "details" : "### 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q16-AnyCPU"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q16-HDRI-AnyCPU"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q16-HDRI-x86"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q16-x86"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q8-AnyCPU"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Magick.NET-Q8-x86"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "14.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hjr-v6g4-3fm8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dlemstra/Magick.NET/commit/2dfa08e15cfd11016a79615994787b14f9048b1c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ImageMagick/ImageMagick"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-125" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-10T15:47:42Z",
    "nvd_published_at" : null
  }
}