CVE-2026-23876
ImageMagick vulnerability analysis and mitigation

Overview

CVE-2026-23876 is a heap buffer overflow vulnerability in ImageMagick's XBM image decoder (ReadXBMImage) that allows an attacker to write controlled data past the allocated heap buffer by processing a maliciously crafted XBM image file. It affects ImageMagick versions prior to 7.1.2-13 (7.x branch) and prior to 6.9.13-38 (6.x branch). The vulnerability was published on January 20, 2026, with patches released the same day. It carries a CVSS v3.1 base score of 9.8 (Critical) per NVD/Feedly aggregated data, though the GitHub Security Advisory scores it at 8.1 (High) with Attack Complexity: High (GitHub Advisory, Red Hat Bugzilla).

Technical details

The root cause is an integer truncation (CWE-190) in coders/xbm.c at lines 349–350, where image->rows (a size_t) is cast to unsigned int when computing the allocation length, causing the buffer to be drastically undersized for large row values. The write loop at lines 369–377, however, iterates using the original non-truncated image->rows value, resulting in a heap-based buffer overflow (CWE-122) where attacker-controlled data is written far beyond the allocated region. For example, setting #define se_height 21474836481 (0x500000001) truncates the allocation to ~1 byte while the loop performs billions of write iterations. The fix (commit 2fae241) changes bytes_per_line and length to size_t types and introduces a HeapOverflowSanityCheckGetSize guard before allocation, with the loop bound changed to use the validated length variable (GitHub Advisory, GitHub Commit).

Impact

Successful exploitation can result in remote code execution, complete system compromise, and full loss of confidentiality, integrity, and availability on the affected host. Because any image read or identify operation can trigger the overflow — including thumbnail generation, format conversion, and metadata extraction — the attack surface is broad, encompassing web applications with image upload functionality, content management systems (e.g., WordPress, Drupal with ImageMagick backends), and CI/CD pipelines processing user-submitted images. No user interaction is required beyond submitting a crafted image, and the attacker controls both the overflow size and the data written, enabling reliable memory corruption (GitHub Advisory).

Exploitability

A proof-of-concept exploit is publicly referenced via the GitHub Security Advisory, though no evidence of active in-the-wild exploitation has been observed as of the time of reporting (GitHub Advisory). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 0.043% (0.000430), indicating a currently low probability of exploitation in the near term. No specific threat actor attribution has been reported. The vulnerability is detectable by multiple commercial scanners including Nessus and Qualys (Feedly).

Exploitation steps

  1. Craft a malicious XBM image: Create an XBM file with an extremely large #define height value (e.g., #define se_height 21474836481) that, when truncated to unsigned int, results in a near-zero allocation size while the actual row count remains enormous.
  2. Embed controlled hex data: Populate the XBM hex data section with attacker-chosen byte values (0x00–0xFF) that will be written into the overflowed heap region, enabling controlled memory corruption.
  3. Deliver the image to the target: Upload the crafted XBM file (or embed it within a BMP as a nested image) to any service that processes images with ImageMagick — such as a web application's image upload endpoint, a CMS media library, or a CI/CD artifact pipeline.
  4. Trigger image processing: Any ImageMagick operation that reads or identifies the image (e.g., magick identify, magick convert, thumbnail generation) will invoke ReadXBMImage and trigger the heap buffer overflow.
  5. Achieve code execution: Leverage the controlled heap overflow to corrupt adjacent heap metadata or function pointers, ultimately redirecting execution flow to attacker-controlled shellcode or a ROP chain for remote code execution (GitHub Advisory).

Indicators of compromise

  • File System: Presence of XBM image files with abnormally large #define width/height values (e.g., values exceeding 2^32) in upload directories or temporary processing folders; unexpected web shells or scripts in the ImageMagick working directory.
  • Logs: Application or web server logs showing uploads of .xbm files or BMP files containing embedded XBM data from untrusted sources; ImageMagick crash logs or core dumps referencing ReadXBMImage in coders/xbm.c; AddressSanitizer output mentioning heap-buffer-overflow at xbm.c:377.
  • Process: Unexpected child processes spawned by the ImageMagick process (e.g., /bin/bash, curl, wget, python) following image processing operations; abnormal memory usage or crashes in magick or convert processes.
  • Network: Outbound connections from the image processing server to unknown external IPs shortly after image upload events; unusual DNS lookups from the server hosting ImageMagick.

Mitigation and workarounds

Upgrade ImageMagick to version 7.1.2-13 or later (7.x branch) or 6.9.13-38 or later (6.x branch), which add overflow checks via HeapOverflowSanityCheckGetSize and correct the integer truncation in coders/xbm.c (GitHub Commit). Red Hat has addressed this in RHSA-2026:3058 for Red Hat Enterprise Linux 7 Extended Lifecycle Support (Red Hat Bugzilla). Debian, Ubuntu, SUSE, and Amazon Linux 2 have also issued advisories and updated packages. If immediate patching is not possible, implement strict file type validation and size limits on image uploads, restrict ImageMagick's XBM codec via a policy file (/etc/ImageMagick-*/policy.xml with <policy domain="coder" rights="none" pattern="XBM" />), and sandbox image processing workloads to limit blast radius.

Community reactions

The vulnerability received coverage from security news outlets including Security Online and The Hacker Wire shortly after disclosure (Security Online). The Belgium Centre for Cybersecurity (CCB) issued a warning about the heap buffer overflow risk (CCB Advisory). CISA included it in its weekly vulnerability bulletin (SB26-026). Social media discussion on Bluesky and Mastodon noted the severity of the issue given ImageMagick's widespread use in web application stacks. A technical write-up was published by Infinit Security detailing the XBM parser flaw (Infinit Security).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

imagemagick: 8:6.9.11.60+dfsg-1.6+deb12u6

Fixed

sid

imagemagick: 8:7.1.2.13+dfsg1-1

Fixed

trixie

imagemagick: 8:7.1.1.43+dfsg1-1+deb13u5

Fixed

Ubuntu

Fixed

bionic (esm-infra)

imagemagick: 8:6.9.7.4+dfsg-16ubuntu6.15+esm9

Fixed

devel

imagemagick

Not Affected

focal (esm-apps)

imagemagick: 8:6.9.10.23+dfsg-2.1ubuntu11.11+esm7

Fixed

jammy

imagemagick

Affected

jammy (esm-apps)

imagemagick: 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.5+esm7

Fixed

noble

imagemagick

Affected

noble (esm-apps)

imagemagick: 8:6.9.12.98+dfsg1-5.2ubuntu0.1~esm6

Fixed

resolute

imagemagick

Not Affected

RHEL / CentOS

Unknown

SourceThis report was generated using AI

Related ImageMagick vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-86421MEDIUM6.3
  • ImageMagick logoImageMagick
  • ImageMagick-c++
NoYesSep 07, 2026
CVE-2026-86425MEDIUM4.8
  • ImageMagick logoImageMagick
  • seal-ImageMagick
NoYesSep 07, 2026
CVE-2026-86423MEDIUM4.8
  • ImageMagick logoImageMagick
  • ImageMagick-c++
NoYesSep 07, 2026
CVE-2026-86424LOW2
  • ImageMagick logoImageMagick
  • imagemagick
NoYesSep 07, 2026
CVE-2026-86422LOW1
  • ImageMagick logoImageMagick
  • cpe:2.3:a:imagemagick:imagemagick
NoYesSep 07, 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