Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-109262 Overview
CVE-2026-109262 is a memory leak vulnerability in ImageMagick's SVG encoder (WriteSVGImage). The flaw affects ImageMagick versions prior to 6.9.13-57 and 7.x versions prior to 7.1.2-32. The encoder fails to release allocated memory when processing crafted images, allowing attackers to trigger resource exhaustion. Repeated processing of malicious inputs can degrade service availability on hosts running ImageMagick as part of image-processing pipelines. The weakness is categorized as [CWE-401] Missing Release of Memory after Effective Lifetime.
Critical Impact
Remote attackers can supply crafted image files to the SVG encoder, triggering a memory leak that leads to denial of service through resource exhaustion.
Affected Products
- ImageMagick versions before 6.9.13-57
- ImageMagick 7.x versions before 7.1.2-32
- Applications and services embedding vulnerable ImageMagick builds for SVG output
Discovery Timeline
- 2026-10-12 - CVE-2026-109262 published to NVD
- 2026-10-15 - Last updated in NVD database
Technical Details for CVE-2026-109262
Vulnerability Analysis
The vulnerability resides in coders/svg.c within the WriteSVGImage function. When ImageMagick writes an SVG from an input image containing unbalanced graphic context push/pop operations, the encoder throws a writer exception without first releasing previously allocated memory. The token buffer and the primitive_info structure remain allocated for the lifetime of the process. An attacker who can submit crafted inputs to any application that invokes the SVG encoder can repeatedly trigger this condition. Each invocation leaks a small amount of memory, and sustained exploitation leads to resource exhaustion.
Root Cause
The root cause is a missing cleanup path on the error return. The pre-patch code called ThrowWriterException directly when it detected an unbalanced graphic context (n < 0), bypassing DestroyString(token) and RelinquishMagickMemory(primitive_info). This matches the classic [CWE-401] pattern where an error-handling branch skips deallocation routines that the normal control flow performs.
Attack Vector
The attack vector is network-reachable when ImageMagick is exposed through web applications, upload handlers, thumbnail generators, or document conversion services. The attacker supplies a crafted image that, when converted to SVG, contains graphic context sequences that produce the unbalanced state. No authentication or user interaction is required against the vulnerable encoding routine.
{
n--;
if (n < 0)
- ThrowWriterException(DrawError,
- "UnbalancedGraphicContextPushPop");
+ {
+ token=DestroyString(token);
+ if (primitive_info != (PrimitiveInfo *) NULL)
+ primitive_info=(PrimitiveInfo *) RelinquishMagickMemory(primitive_info);
+ ThrowWriterException(DrawError,
+ "UnbalancedGraphicContextPushPop");
+ }
(void) WriteBlobString(image,"</g>\n");
}
if (LocaleCompare("pattern",token) == 0)
Source: ImageMagick GitHub Commit. The patch wraps the exception in a block that first calls DestroyString on token and RelinquishMagickMemory on primitive_info before raising the writer exception.
Detection Methods for CVE-2026-109262
Indicators of Compromise
- Repeated DrawError entries in ImageMagick or application logs referencing UnbalancedGraphicContextPushPop.
- Progressive growth in resident memory of processes executing convert, magick, or embedded ImageMagick libraries.
- Spikes in SVG output requests originating from a limited set of client IPs or sessions.
Detection Strategies
- Inventory hosts and container images for ImageMagick versions earlier than 6.9.13-57 or 7.x earlier than 7.1.2-32.
- Instrument image-processing workers with memory watchdogs that flag monotonic RSS growth across repeated SVG conversions.
- Review web application logs for unusual rates of uploads targeting endpoints that convert to SVG.
Monitoring Recommendations
- Alert when image-processing worker processes exceed historical memory baselines or trigger OOM kills.
- Correlate UnbalancedGraphicContextPushPop error strings with the source IP of the originating request.
- Track outbound SVG conversion job volume per tenant to identify abusive patterns.
How to Mitigate CVE-2026-109262
Immediate Actions Required
- Upgrade ImageMagick to 6.9.13-57 or 7.1.2-32 or later across all production and build systems.
- Rebuild and redeploy container images that bundle ImageMagick as a dependency.
- Restrict the file formats and output encoders exposed to untrusted callers via policy.xml.
Patch Information
Fixes are available in the upstream repositories. See the ImageMagick 7.x commit and the ImageMagick 6 commit. Additional context is published in the GitHub Security Advisory GHSA-w288-jj5x-hhvp and the VulnCheck Advisory.
Workarounds
- Disable the SVG writer in policy.xml if SVG output is not required by the application.
- Enforce per-process memory limits using cgroups, ulimit, or container memory caps so leaked memory triggers restarts rather than host exhaustion.
- Rate-limit image conversion endpoints and reject oversized or malformed inputs before they reach ImageMagick.
# Restrict SVG encoding in ImageMagick policy.xml
<policymap>
<policy domain="coder" rights="none" pattern="SVG" />
<policy domain="resource" name="memory" value="256MiB" />
<policy domain="resource" name="map" value="512MiB" />
</policymap>
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

