CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-23952
6.50.04%

Ghost in the Script: Crashing ImageMagick with XML Voodoo (CVE-2026-23952)

Amit Schendel
Amit Schendel
Senior Security Researcher

Feb 16, 2026·5 min read·14 visits

PoC Available

Executive Summary (TL;DR)

ImageMagick's MSL parser crashes if it sees a <comment> tag before an image is loaded. This NULL pointer dereference (CWE-476) causes a DoS. Fixed in Magick.NET 14.10.2.

A NULL pointer dereference vulnerability in ImageMagick's Magick Scripting Language (MSL) parser allows attackers to crash applications by supplying a malformed XML script. Specifically, defining a comment before initializing an image object triggers a segmentation fault, leading to Denial of Service.

The Hook: XML Ghosts in the Shell

ImageMagick is the Swiss Army knife of image processing—it's everywhere, from your favorite social media platform's thumbnail generator to the backend of enterprise content management systems. But buried deep within its vast arsenal of 'coders' (modules that handle specific file formats) lies a relic called MSL (Magick Scripting Language).

MSL is an XML-based scripting language that allows you to define image processing pipelines in a structured text file. Instead of running a complex command-line string, you pass an XML file to the MSL interpreter, and it executes the steps. Ideally, this is a powerful automation tool. Practically, it's a forgotten attack surface that most developers don't realize is enabled by default.

CVE-2026-23952 isn't a complex heap feng-shui masterpiece; it's a classic logic error in how this parser handles the order of operations. It's the digital equivalent of trying to hang a picture frame on a wall you haven't built yet. The result? The application tries to interact with a void, and the operating system kills it with prejudice.

The Flaw: Premature Commenting

The vulnerability resides in coders/msl.c, specifically in the function MSLEndElement. This function is responsible for handling the closing tags of XML elements. When the parser encounters a </comment> tag, it naturally assumes there is an image object currently in memory that this comment belongs to.

Under normal circumstances, an MSL script loads an image first (via <read> or <image>), allocating memory and setting up the internal structures. The parser tracks these images in an array msl_info->image[n]. When a comment is processed, the code attempts to attach metadata to msl_info->image[n].

The logic failure here is profound in its simplicity: The developers assumed that a user would never try to comment on nothing. If an attacker provides an MSL script where the <comment> tag appears before any image loading tag, msl_info->image[n] is still NULL. The code proceeds to dereference this NULL pointer to call DeleteImageProperty, resulting in an immediate crash.

The Code: Verify Before You Trust

Let's look at the smoking gun. In the vulnerable version of coders/msl.c, the handler for the comment tag blindly trusts that the image pointer is valid.

Vulnerable Code:

/* Inside MSLEndElement */
if (LocaleCompare(keyword,"comment") == 0)
{
  /* 
   * CRASH: msl_info->image[n] is NULL here if no image is loaded.
   * The function tries to access memory at 0x0.
   */
  (void) DeleteImageProperty(msl_info->image[n],"comment");
  // ... code to attach new comment ...
}

The fix is the standard "check for NULL" pattern that should have been there from day one. The patch simply wraps the operation in a conditional check.

Fixed Code:

if (LocaleCompare(keyword,"comment") == 0)
{
  /* 
   * FIX: Verify the pointer exists before touching it.
   */
  if (msl_info->image[n] != (Image *) NULL)
    (void) DeleteImageProperty(msl_info->image[n],"comment");
  // ...
}

This creates a safety check: if the image doesn't exist, the parser just ignores the cleanup attempt instead of committing suicide.

The Exploit: 4 Lines of Doom

Exploiting this requires no shellcode, no ROP chains, and no memory leaks. You just need to pass a valid XML file that violates the parser's logical expectations. If you can upload a file that gets processed by the MSL coder (often triggered if the file extension is .msl or if the file content is sniffed as XML in a permissive environment), you win.

Here is the full Proof-of-Concept (PoC):

<?xml version="1.0" encoding="UTF-8"?>
<image>
  <!-- 
       The parser enters <image>, but hasn't allocated the internal 
       image structure yet because we haven't defined dimensions or read a file.
       Then it hits <comment>.
  -->
  <comment>Goodbye, Server.</comment>
</image>

When ImageMagick processes this:

  1. It parses <image>. The stack depth increases, but msl_info->image[0] remains NULL because no specific image data (read or new) has been invoked.
  2. It parses <comment>Goodbye...</comment>.
  3. Upon hitting </comment>, it executes DeleteImageProperty(NULL, "comment").
  4. Segmentation Fault.

The Impact: The Infinite Restart Loop

While a Denial of Service (DoS) might sound less sexy than Remote Code Execution (RCE), in modern cloud architectures, it can be devastating. Image processing is typically handled by asynchronous workers pulling jobs from a queue (e.g., Sidekiq, Celery, SQS).

Imagine an attacker uploads this malicious MSL file as a profile picture or an attachment. The worker picks up the job, attempts to process it, and crashes (segfault). The supervisor process (like Kubernetes or systemd) sees the crash and restarts the worker. The worker comes back online, checks the queue, picks up the same job, and crashes again.

This creates a "poison pill" scenario. A single 100-byte file can permanently jam an image processing pipeline, consuming compute resources in a restart loop and effectively taking down the service until the bad job is manually purged. If the system scales automatically based on CPU load (which spikes during crash/restart), you might even trigger an expensive auto-scaling event for nothing.

The Fix: Policy Over Patching

The immediate technical fix is to upgrade to Magick.NET 14.10.2 or the corresponding ImageMagick 7.x core release. This patches the coders/msl.c logic.

However, the strategic fix for security teams is to disable coders you don't use. ImageMagick supports hundreds of formats, many of which (like MSL, MVG, and XPS) are powerful scripting languages masquerading as image formats. These are historically prone to vulnerabilities.

Modify your policy.xml file to explicitly disable MSL if you aren't using it. This kills the entire attack class, not just this specific bug.

<!-- /etc/ImageMagick-7/policy.xml -->
<policymap>
  <!-- ... other policies ... -->
  
  <!-- DISABLE MSL SCRIPTING -->
  <policy domain="coder" rights="none" pattern="MSL" />
</policymap>

This is the digital equivalent of welding the window shut because you never open it anyway.

Official Patches

ImageMagickGitHub Security Advisory
Magick.NETMagick.NET 14.10.2 Release Notes

Technical Appendix

CVSS Score
6.5/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
EPSS Probability
0.04%
Top 87% most exploited

Affected Systems

ImageMagick 7.x (Core)Magick.NET <= 14.10.1Red Hat Enterprise Linux (via ImageMagick packages)openSUSE (via ImageMagick packages)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Magick.NET
dlemstra
<= 14.10.114.10.2
ImageMagick
ImageMagick Studio LLC
< 7.1.1-26 (Approximate)7.1.1-26
AttributeDetail
CWE IDCWE-476 (NULL Pointer Dereference)
CVSS v3.16.5 (Medium)
Attack VectorNetwork (AV:N)
Privileges RequiredLow (PR:L)
ImpactAvailability (A:H)
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1499Endpoint Denial of Service
Impact
T1190Exploit Public-Facing Application
Initial Access
CWE-476
NULL Pointer Dereference

A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.

Known Exploits & Detection

Internal AnalysisXML payload defining <comment> before <image> causes crash.

Vulnerability Timeline

Vulnerability Disclosed & CVE Assigned
2026-01-22
Magick.NET 14.10.2 Released (Patch)
2026-01-22
Vendor Advisories Published
2026-01-23

References & Sources

  • [1]GHSA-5vx3-wx4q-6cj8 Advisory
  • [2]ImageMagick Security Policy Guidance

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.