Skip to content

Commit c877628

Browse files
1 parent 080a072 commit c877628

File tree

1 file changed

+392
-0
lines changed

1 file changed

+392
-0
lines changed
Lines changed: 392 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,392 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-q3hc-j9x5-mp9m",
4+
"modified": "2025-12-03T16:25:15Z",
5+
"published": "2025-12-03T16:25:15Z",
6+
"aliases": [
7+
"CVE-2025-65955"
8+
],
9+
"summary": "ImageMagick has a use-after-free/double-free risk in Options::fontFamily when clearing family",
10+
"details": "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.\n\n**Vulnerability Details**\n- 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.\n- `DestroyDrawInfo` and other setters (`Options::font`, `Image::font`) assume `_drawInfo->font` remains valid, so destruction or subsequent updates trigger crashes or heap corruption.\n\n```cpp\nif (family_.length() == 0)\n {\n _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);\n DestroyString(RemoveImageOption(imageInfo(),\"family\"));\n }\n```\n\n- **CWE-416 (Use After Free):** `_drawInfo->font` is left dangling yet still reachable through the Options object.\n- **CWE-415 (Double Free):** DrawInfo teardown frees `_drawInfo->font` again, provoking allocator aborts.\n\n**Affected Versions**\n- Introduced by commit `6409f34d637a34a1c643632aa849371ec8b3b5a8` (“Added fontFamily to the Image class of Magick++”, 2015-08-01, blame line 313).\n- 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.\n\n**Command Line Triggerability**\nThis 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.\n\n**Proposed Fix**\n```diff\ndiff --git a/Magick++/lib/Options.cpp b/Magick++/lib/Options.cpp\n@@ void Magick::Options::fontFamily(const std::string &family_)\n- _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);\n+ _drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->family);\n```\nThis frees only the actual family string, leaving `_drawInfo->font` untouched. Optionally nulling `_drawInfo->font` when clearing `font()` itself maintains allocator hygiene.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "NuGet",
21+
"name": "Magick.NET-Q16-AnyCPU"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"last_affected": "14.9.1"
32+
}
33+
]
34+
}
35+
]
36+
},
37+
{
38+
"package": {
39+
"ecosystem": "NuGet",
40+
"name": "Magick.NET-Q16-HDRI-AnyCPU"
41+
},
42+
"ranges": [
43+
{
44+
"type": "ECOSYSTEM",
45+
"events": [
46+
{
47+
"introduced": "0"
48+
},
49+
{
50+
"last_affected": "14.9.1"
51+
}
52+
]
53+
}
54+
]
55+
},
56+
{
57+
"package": {
58+
"ecosystem": "NuGet",
59+
"name": "Magick.NET-Q16-HDRI-OpenMP-arm64"
60+
},
61+
"ranges": [
62+
{
63+
"type": "ECOSYSTEM",
64+
"events": [
65+
{
66+
"introduced": "0"
67+
},
68+
{
69+
"last_affected": "14.9.1"
70+
}
71+
]
72+
}
73+
]
74+
},
75+
{
76+
"package": {
77+
"ecosystem": "NuGet",
78+
"name": "Magick.NET-Q16-HDRI-OpenMP-x64"
79+
},
80+
"ranges": [
81+
{
82+
"type": "ECOSYSTEM",
83+
"events": [
84+
{
85+
"introduced": "0"
86+
},
87+
{
88+
"last_affected": "14.9.1"
89+
}
90+
]
91+
}
92+
]
93+
},
94+
{
95+
"package": {
96+
"ecosystem": "NuGet",
97+
"name": "Magick.NET-Q16-HDRI-arm64"
98+
},
99+
"ranges": [
100+
{
101+
"type": "ECOSYSTEM",
102+
"events": [
103+
{
104+
"introduced": "0"
105+
},
106+
{
107+
"last_affected": "14.9.1"
108+
}
109+
]
110+
}
111+
]
112+
},
113+
{
114+
"package": {
115+
"ecosystem": "NuGet",
116+
"name": "Magick.NET-Q16-HDRI-x64"
117+
},
118+
"ranges": [
119+
{
120+
"type": "ECOSYSTEM",
121+
"events": [
122+
{
123+
"introduced": "0"
124+
},
125+
{
126+
"last_affected": "14.9.1"
127+
}
128+
]
129+
}
130+
]
131+
},
132+
{
133+
"package": {
134+
"ecosystem": "NuGet",
135+
"name": "Magick.NET-Q16-HDRI-x86"
136+
},
137+
"ranges": [
138+
{
139+
"type": "ECOSYSTEM",
140+
"events": [
141+
{
142+
"introduced": "0"
143+
},
144+
{
145+
"last_affected": "14.9.1"
146+
}
147+
]
148+
}
149+
]
150+
},
151+
{
152+
"package": {
153+
"ecosystem": "NuGet",
154+
"name": "Magick.NET-Q16-OpenMP-arm64"
155+
},
156+
"ranges": [
157+
{
158+
"type": "ECOSYSTEM",
159+
"events": [
160+
{
161+
"introduced": "0"
162+
},
163+
{
164+
"last_affected": "14.9.1"
165+
}
166+
]
167+
}
168+
]
169+
},
170+
{
171+
"package": {
172+
"ecosystem": "NuGet",
173+
"name": "Magick.NET-Q16-OpenMP-x64"
174+
},
175+
"ranges": [
176+
{
177+
"type": "ECOSYSTEM",
178+
"events": [
179+
{
180+
"introduced": "0"
181+
},
182+
{
183+
"last_affected": "14.9.1"
184+
}
185+
]
186+
}
187+
]
188+
},
189+
{
190+
"package": {
191+
"ecosystem": "NuGet",
192+
"name": "Magick.NET-Q16-arm64"
193+
},
194+
"ranges": [
195+
{
196+
"type": "ECOSYSTEM",
197+
"events": [
198+
{
199+
"introduced": "0"
200+
},
201+
{
202+
"last_affected": "14.9.1"
203+
}
204+
]
205+
}
206+
]
207+
},
208+
{
209+
"package": {
210+
"ecosystem": "NuGet",
211+
"name": "Magick.NET-Q16-x64"
212+
},
213+
"ranges": [
214+
{
215+
"type": "ECOSYSTEM",
216+
"events": [
217+
{
218+
"introduced": "0"
219+
},
220+
{
221+
"last_affected": "14.9.1"
222+
}
223+
]
224+
}
225+
]
226+
},
227+
{
228+
"package": {
229+
"ecosystem": "NuGet",
230+
"name": "Magick.NET-Q16-x86"
231+
},
232+
"ranges": [
233+
{
234+
"type": "ECOSYSTEM",
235+
"events": [
236+
{
237+
"introduced": "0"
238+
},
239+
{
240+
"last_affected": "14.9.1"
241+
}
242+
]
243+
}
244+
]
245+
},
246+
{
247+
"package": {
248+
"ecosystem": "NuGet",
249+
"name": "Magick.NET-Q8-AnyCPU"
250+
},
251+
"ranges": [
252+
{
253+
"type": "ECOSYSTEM",
254+
"events": [
255+
{
256+
"introduced": "0"
257+
},
258+
{
259+
"last_affected": "14.9.1"
260+
}
261+
]
262+
}
263+
]
264+
},
265+
{
266+
"package": {
267+
"ecosystem": "NuGet",
268+
"name": "Magick.NET-Q8-OpenMP-arm64"
269+
},
270+
"ranges": [
271+
{
272+
"type": "ECOSYSTEM",
273+
"events": [
274+
{
275+
"introduced": "0"
276+
},
277+
{
278+
"last_affected": "14.9.1"
279+
}
280+
]
281+
}
282+
]
283+
},
284+
{
285+
"package": {
286+
"ecosystem": "NuGet",
287+
"name": "Magick.NET-Q8-OpenMP-x64"
288+
},
289+
"ranges": [
290+
{
291+
"type": "ECOSYSTEM",
292+
"events": [
293+
{
294+
"introduced": "0"
295+
},
296+
{
297+
"last_affected": "14.9.1"
298+
}
299+
]
300+
}
301+
]
302+
},
303+
{
304+
"package": {
305+
"ecosystem": "NuGet",
306+
"name": "Magick.NET-Q8-arm64"
307+
},
308+
"ranges": [
309+
{
310+
"type": "ECOSYSTEM",
311+
"events": [
312+
{
313+
"introduced": "0"
314+
},
315+
{
316+
"last_affected": "14.9.1"
317+
}
318+
]
319+
}
320+
]
321+
},
322+
{
323+
"package": {
324+
"ecosystem": "NuGet",
325+
"name": "Magick.NET-Q8-x64"
326+
},
327+
"ranges": [
328+
{
329+
"type": "ECOSYSTEM",
330+
"events": [
331+
{
332+
"introduced": "0"
333+
},
334+
{
335+
"last_affected": "14.9.1"
336+
}
337+
]
338+
}
339+
]
340+
},
341+
{
342+
"package": {
343+
"ecosystem": "NuGet",
344+
"name": "Magick.NET-Q8-x86"
345+
},
346+
"ranges": [
347+
{
348+
"type": "ECOSYSTEM",
349+
"events": [
350+
{
351+
"introduced": "0"
352+
},
353+
{
354+
"last_affected": "14.9.1"
355+
}
356+
]
357+
}
358+
]
359+
}
360+
],
361+
"references": [
362+
{
363+
"type": "WEB",
364+
"url": "https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-q3hc-j9x5-mp9m"
365+
},
366+
{
367+
"type": "ADVISORY",
368+
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-65955"
369+
},
370+
{
371+
"type": "WEB",
372+
"url": "https://github.com/ImageMagick/ImageMagick/commit/6409f34d637a34a1c643632aa849371ec8b3b5a8"
373+
},
374+
{
375+
"type": "WEB",
376+
"url": "https://github.com/ImageMagick/ImageMagick/commit/6f81eb15f822ad86e8255be75efad6f9762c32f8"
377+
},
378+
{
379+
"type": "PACKAGE",
380+
"url": "https://github.com/ImageMagick/ImageMagick"
381+
}
382+
],
383+
"database_specific": {
384+
"cwe_ids": [
385+
"CWE-415"
386+
],
387+
"severity": "MODERATE",
388+
"github_reviewed": true,
389+
"github_reviewed_at": "2025-12-03T16:25:15Z",
390+
"nvd_published_at": "2025-12-02T23:15:45Z"
391+
}
392+
}

0 commit comments

Comments
 (0)