ImageMagick XBM Decoder Heap Buffer Overflow (CVE-2026-23876)
Vulnerability Disclosure · 2 sources · Updated 5mo ago · First seen Jan 21, 2026

A high-severity heap buffer overflow in ImageMagick’s XBM image decoder (coders/xbm.c, ReadXBMImage) can be triggered by processing a specially crafted XBM file, including through common image upload/processing workflows. The flaw stems from integer truncation where image->rows (a 64-bit size_t) is cast to a 32-bit unsigned int for allocation, but subsequent write operations iterate using the original (non-truncated) image->rows value, creating a mismatch that can lead to memory corruption or crashes when attacker-supplied dimensions are large.
Reporting indicates the overflow is particularly dangerous because attackers can influence both the overflow size (via image dimensions such as rows/columns) and the data written (via hex values embedded in the XBM content), enabling attacker-controlled bytes to be written past the heap buffer. The issue affects ImageMagick versions prior to 7.1.2-13 and 6.9.13-38 and is fixed in 7.1.2-13 and 6.9.13-38; the CVE record lists a high-impact CVSS vector AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H and maps the weakness to CWE-190 and CWE-122, with upstream references including the vendor advisory and patch commit.


