Skip to content

GHSA-q3hc-j9x5-mp9m CVE-2025-65955

Withdrawn Advisory: ImageMagick has a use-after-free/double-free risk in Options::fontFamily when clearing family

Medium Withdrawn Dec 11, 2025 NuGet
Severity
4.9 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.16%
Chance of exploitation in the next 30 days. Higher than 5.05% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-415 Double Free
Fix
None yet
No fixed version published

Description

Withdrawn Advisory

This advisory has been withdrawn because it does not affect the ImageMagick project's NuGet packages.

Original Description

We believe that we have discovered a potential security vulnerability in ImageMagick’s Magick++ layer that manifests when Options::fontFamily is invoked with an empty string.

Vulnerability Details

  • Clearing a font family calls RelinquishMagickMemory on _drawInfo->font, freeing the font string but leaving _drawInfo->font pointing to freed memory while _drawInfo->family is set to that (now-invalid) pointer. Any later cleanup or reuse of _drawInfo->font re-frees or dereferences dangling memory.
  • DestroyDrawInfo and other setters (Options::font, Image::font) assume _drawInfo->font remains valid, so destruction or subsequent updates trigger crashes or heap corruption.
if (family_.length() == 0)
  {
    _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);
    DestroyString(RemoveImageOption(imageInfo(),"family"));
  }
  • CWE-416 (Use After Free): _drawInfo->font is left dangling yet still reachable through the Options object.
  • CWE-415 (Double Free): DrawInfo teardown frees _drawInfo->font again, provoking allocator aborts.

Affected Versions

  • Introduced by commit 6409f34d637a34a1c643632aa849371ec8b3b5a8 (“Added fontFamily to the Image class of Magick++”, 2015-08-01, blame line 313).
  • Present in all releases that include that commit, at least ImageMagick 7.0.1-0 and later (likely late 6.9 builds with Magick++ font family support as well). Older releases without fontFamily are unaffected.

Command Line Triggerability This vulnerability cannot be triggered from the command line interface. The bug is specific to the Magick++ C++ API, specifically the Options::fontFamily() method. The command-line utilities (such as convert, magick, etc.) do not expose this particular code path, as they operate through different internal mechanisms that do not directly call Options::fontFamily() with an empty string in a way that would trigger the use-after-free condition.

Proposed Fix

diff --git a/Magick++/lib/Options.cpp b/Magick++/lib/Options.cpp
@@ void Magick::Options::fontFamily(const std::string &family_)
-      _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);
+      _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->family);

This frees only the actual family string, leaving _drawInfo->font untouched. Optionally nulling _drawInfo->font when clearing font() itself maintains allocator hygiene.

Affected versions

NuGet

PackageVulnerableFixed in
Magick.NET-Q16-AnyCPU
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-AnyCPU
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-OpenMP-arm64
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-OpenMP-x64
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-arm64
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-x64
<= 14.9.1
No fix yet
Magick.NET-Q16-HDRI-x86
<= 14.9.1
No fix yet
Magick.NET-Q16-OpenMP-arm64
<= 14.9.1
No fix yet
Magick.NET-Q16-OpenMP-x64
<= 14.9.1
No fix yet
Magick.NET-Q16-arm64
<= 14.9.1
No fix yet
Magick.NET-Q16-x64
<= 14.9.1
No fix yet
Magick.NET-Q16-x86
<= 14.9.1
No fix yet
Magick.NET-Q8-AnyCPU
<= 14.9.1
No fix yet
Magick.NET-Q8-OpenMP-arm64
<= 14.9.1
No fix yet
Magick.NET-Q8-OpenMP-x64
<= 14.9.1
No fix yet
Magick.NET-Q8-arm64
<= 14.9.1
No fix yet
Magick.NET-Q8-x64
<= 14.9.1
No fix yet
Magick.NET-Q8-x86
<= 14.9.1
No fix yet

How to fix

No fixed version has been published yet. Until one is, remove or replace the package, or turn off or isolate the affected feature. This page updates when a fix ships.

Severity breakdown

CVSS 3.1 4.9

CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L

Attack vector
Local
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

Weakness

CWE-415: Double Free

The product calls free() twice on the same memory address.

How to prevent it
  • Architecture and Design: Choose a language that provides automatic memory management.
  • Implementation: Ensure that each allocation is freed only once. After freeing a chunk, set the pointer to NULL to ensure the pointer cannot be freed again. In complicated error conditions, be sure that clean-up routines respect the state of allocation properly. If the language is object oriented, ensure that object destructors delete each chunk of memory only once.
  • Implementation: Use a static analysis tool to find double free instances.

References

Timeline

  1. Published
  2. Withdrawn
  3. Last updated by the source
  4. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-j7hp-h8jx-5ppr
libwebp: OOB write in BuildHuffmanTable
High Known exploited Also affects magick.net-q16-anycpu
GHSA-cvhv-g4rq-3hmw
ImageMagick: Memory Leak when providing invalid options to the cli
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-h22j-f9xw-xjjm
ImageMagick: Integer Overflow in JNX decoder causes heap buffer over-write when processing extremly large files on 32-bit builds
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-422r-8c97-xcg4
ImageMagick: Heap Buffer Over-Write in fx operation
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-f5m7-cqgw-8hm7
ImageMagick: Heap Buffer Over-Write in morphology operation when an invalid kernel is provided
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-hc76-7mpc-qjqh
ImageMagick: Code injection in HTML encoder due to incomplete fix of CVE-2026-25797
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-56m6-8q75-f2rw
ImageMagick: Policy Bypass due to an incomplete fix of CVE-2026-49219
Medium Also affects Magick.NET-Q16-AnyCPU
GHSA-h5r4-w88w-7ccr
ImageMagick: Memory Leak in TIFF encoder when invalid tiff:tile-geometry is specified
Low Also affects Magick.NET-Q16-AnyCPU
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor