CVE-2026-30937
C# vulnerability analysis and mitigation

Overview

CVE-2026-30937 is a heap buffer overflow vulnerability in ImageMagick's XWD (X Windows) encoder caused by a 32-bit unsigned integer overflow in the bytes_per_line calculation within the WriteXWDImage function. It affects ImageMagick versions prior to 7.1.2-16 (7.x branch) and prior to 6.9.13-41 (6.x branch), as well as Magick.NET NuGet packages prior to version 14.10.4. The vulnerability was published on March 9, 2026, by researcher ylwango613 via the ImageMagick GitHub Security Advisory. It carries a CVSS v3.1 base score of 6.8 (Moderate) per the GitHub Advisory, or 6.1 (Medium) per Red Hat's scoring (GitHub Advisory, Red Hat CVE).

Technical details

The root cause is a 32-bit unsigned integer (CARD32) overflow in the XWD encoder's bytes_per_line calculation (CWE-190: Integer Overflow or Wraparound), which results in an undersized heap buffer allocation (CWE-122: Heap-based Buffer Overflow). When an extremely large image is processed for XWD output, the arithmetic overflow causes the allocated buffer to be smaller than required, and subsequent write operations exceed the buffer boundary — confirmed by AddressSanitizer output showing a WRITE of size 1 beyond the heap allocation. Exploitation requires local access and the ability to submit an extremely large image for processing through the XWD encoder; no special privileges are required per the GitHub advisory's CVSS scoring (GitHub Advisory, Red Hat Bugzilla).

Impact

Successful exploitation can cause a denial of service (DoS) by crashing the ImageMagick process, and may also result in limited data integrity impact through out-of-bounds heap writes. Confidentiality is not affected, as the vulnerability does not expose sensitive data. The scope is limited to the affected process and does not enable lateral movement or privilege escalation based on current analysis (GitHub Advisory, Red Hat CVE).

Exploitation steps

  1. Identify a vulnerable target: Locate a system running ImageMagick versions prior to 7.1.2-16 or 6.9.13-41, or Magick.NET prior to 14.10.4, with local access available.
  2. Craft an extremely large image: Prepare or generate an image file with dimensions large enough that the bytes_per_line calculation (width × bytes_per_pixel) overflows a 32-bit unsigned integer (CARD32), causing the computed value to wrap around to a small number.
  3. Trigger XWD encoding: Invoke ImageMagick's XWD encoder on the crafted image, e.g., using convert <large_image> output.xwd, causing the WriteXWDImage function to allocate an undersized heap buffer based on the overflowed bytes_per_line value.
  4. Trigger out-of-bounds write: As ImageMagick writes image data into the undersized buffer, it writes beyond the allocated heap region, resulting in heap corruption that causes a crash (DoS) or potential data integrity impact (GitHub Advisory, Red Hat Bugzilla).

Indicators of compromise

  • Process: Unexpected crash or termination of the convert, magick, or any ImageMagick-linked process when processing XWD output; AddressSanitizer reports showing heap-buffer-overflow in WriteXWDImage.
  • Logs: Application or system logs recording segmentation faults or abnormal exits from ImageMagick processes; error messages referencing XWD encoder operations with extremely large images.
  • File System: Presence of unusually large input image files (potentially crafted) submitted to image processing pipelines; core dump files generated by crashed ImageMagick processes.

Mitigation and workarounds

Upgrade ImageMagick to version 7.1.2-16 or later (7.x branch) or 6.9.13-41 or later (6.x branch); Magick.NET users should upgrade to version 14.10.4 or later. No configuration-based workaround is documented; the primary remediation is patching. As an interim measure, restrict local access to systems running vulnerable ImageMagick versions and limit which users or processes can submit image files for XWD encoding (GitHub Advisory, Red Hat CVE). Distribution-specific updates have been issued for Debian, SUSE/openSUSE, and Amazon Linux 2.

Additional resources


SourceThis report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-p5rm-jg5c-8c77MEDIUM6.1
  • C# logoC#
  • Microsoft.OpenApi.Kiota
NoYesJul 24, 2026
CVE-2026-62946MEDIUM5.1
  • C# logoC#
  • Magick.NET-Q16-AnyCPU
NoYesJul 24, 2026
CVE-2026-62363MEDIUM5
  • C# logoC#
  • Magick.NET-Q16-HDRI-OpenMP-arm64
NoYesJul 24, 2026
CVE-2026-62343MEDIUM4.7
  • C# logoC#
  • Magick.NET-Q16-OpenMP-arm64
NoYesJul 24, 2026
GHSA-464c-974j-9xm6LOW3.3
  • JavaScript logoJavaScript
  • @aws-cdk/aws-codebuild
NoYesJul 24, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management