CVE-2026-23876 Overview
ImageMagick is open-source software for editing and manipulating digital images. A heap buffer overflow vulnerability exists in the XBM image decoder function ReadXBMImage. The flaw allows attackers to write controlled data past an allocated heap buffer when processing a crafted XBM file. Any operation that reads or identifies an image can trigger the overflow. This makes the vulnerability exploitable through common image upload and processing pipelines used by web applications, content management systems, and document conversion services. Versions 7.1.2-13 and 6.9.13-38 resolve the issue.
Critical Impact
Remote attackers can achieve heap corruption and potential code execution by uploading a malicious XBM file to any service that processes images with vulnerable ImageMagick versions.
Affected Products
- ImageMagick versions prior to 7.1.2-13
- ImageMagick versions prior to 6.9.13-38
- Applications and services embedding vulnerable ImageMagick libraries for image identification or processing
Discovery Timeline
- 2026-01-20 - CVE-2026-23876 published to the National Vulnerability Database (NVD)
- 2026-01-29 - Last updated in NVD database
Technical Details for CVE-2026-23876
Vulnerability Analysis
The vulnerability is a heap buffer overflow [CWE-122] in the ReadXBMImage function, which parses X BitMap (XBM) image files. When ImageMagick decodes a maliciously crafted XBM file, the decoder writes attacker-controlled bytes beyond the bounds of the heap buffer allocated for pixel data. Heap corruption of this type can be leveraged to overwrite adjacent allocator metadata or function pointers, leading to remote code execution under the privileges of the image-processing service.
XBM is a plain-text C-source-like bitmap format. Parsers typically read dimensions from header tokens and allocate a buffer sized from those dimensions before reading hex byte arrays into it. Mismatches between declared and actual data, or arithmetic errors when computing buffer size, are the recurring root cause of overflows in such decoders.
Root Cause
The root cause is improper bounds enforcement during the read loop in ReadXBMImage. The decoder trusts size-related values derived from the input file when writing decoded data into the heap allocation. Consult the GitHub Security Advisory GHSA-r49w-jqq3-3gx8 and the upstream fix commit for the precise code-level details.
Attack Vector
Exploitation requires no authentication and no user interaction beyond submitting an image. An attacker uploads a crafted XBM file to any endpoint that calls convert, identify, mogrify, or library bindings such as Imagick, MagickWand, or RMagick. Server-side thumbnailing, avatar processing, OCR pre-processing, and PDF-to-image pipelines are all viable delivery surfaces. The vulnerability has an EPSS score of 0.088% (25th percentile) as of 2026-05-14.
The vulnerability manifests in the XBM decoder's write loop. No verified public proof-of-concept code is available at the time of writing. Refer to the upstream advisory for technical reproduction details.
Detection Methods for CVE-2026-23876
Indicators of Compromise
- Crashes or abnormal terminations of convert, identify, magick, or host application processes when handling XBM input
- Unexpected child processes spawned by image-processing workers, particularly shells or network utilities
- Inbound HTTP requests delivering files with .xbm extensions or image/x-xbitmap content type to upload endpoints
- Heap corruption signatures in core dumps referencing ReadXBMImage in the call stack
Detection Strategies
- Inventory installed ImageMagick versions across servers and container images and flag any below 7.1.2-13 or 6.9.13-38
- Inspect web application logs for uploads of XBM files, an uncommon format in production traffic
- Enable AddressSanitizer or similar instrumentation in pre-production builds to surface heap overflows during fuzz testing
- Correlate image-worker crashes with preceding upload events through centralized logging
Monitoring Recommendations
- Alert on segmentation faults or SIGABRT events originating from ImageMagick binaries
- Monitor process trees for unexpected children of image-processing services, such as sh, bash, curl, or wget
- Track outbound network connections from image-processing hosts that previously had no egress baseline
- Audit policy.xml to confirm restrictive coder policies are enforced and not silently overridden
How to Mitigate CVE-2026-23876
Immediate Actions Required
- Upgrade ImageMagick to 7.1.2-13 or 6.9.13-38 or later across all systems and container images
- Rebuild and redeploy applications that statically link or bundle ImageMagick libraries
- Restrict the XBM coder in ImageMagick policy.xml until patching is complete
- Validate uploaded image MIME types and reject unexpected formats at the application layer
Patch Information
The upstream fix is committed in ImageMagick commit 2fae241 and released in versions 7.1.2-13 and 6.9.13-38. Linux distributions are publishing backported packages. Verify your package manager reports a fixed version before declaring remediation complete.
Workarounds
- Disable the XBM coder via policy.xml to block decoding entirely until patches are applied
- Sandbox image-processing workers using seccomp, AppArmor, or container isolation to limit blast radius
- Run image processing in short-lived, unprivileged containers without outbound network access
- Enforce strict allow-lists of accepted image formats at the application gateway
# Disable the XBM coder in ImageMagick policy.xml
# Add the following inside the <policymap> element:
# <policy domain="coder" rights="none" pattern="XBM" />
sudo sed -i 's|</policymap>| <policy domain="coder" rights="none" pattern="XBM" />\n</policymap>|' /etc/ImageMagick-7/policy.xml
# Verify the policy is active
identify -list policy | grep -i xbm
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

