ImageMagick (WriteBMPImage): 32-bit integer overflow when writing BMP scanline stride → heap buffer overflow
Description
ImageMagick is free and open-source software used for editing and manipulating digital images. Prior to versions 6.9.13-28 and 7.1.2-2 for ImageMagick's 32-bit build, a 32-bit integer overflow in the BMP encoder’s scanline-stride computation collapses bytes_per_line (stride) to a tiny value while the per-row writer still emits 3 × width bytes for 24-bpp images. The row base pointer advances using the (overflowed) stride, so the first row immediately writes past its slot and into adjacent heap memory with attacker-controlled bytes. This is a classic, powerful primitive for heap corruption in common auto-convert pipelines. This issue has been patched in versions 6.9.13-28 and 7.1.2-2.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
32-bit integer overflow in ImageMagick BMP encoder's stride computation causes heap buffer overflow, enabling remote code execution in auto-convert pipelines.
Vulnerability
A 32-bit integer overflow occurs in the BMP encoder's scanline-stride computation (bytes_per_line) when writing BMP files. For a large image width on a 32-bit build, the stride calculation wraps to a small value, but the per-row writer still emits 3 × width bytes for 24-bpp images. This causes the first row to write past its allocated heap buffer, resulting in a heap buffer overflow with attacker-controlled bytes [1][2].
Exploitation
An attacker can exploit this by crafting an image with specific dimensions that trigger the overflow when ImageMagick converts it to BMP. No authentication is required if a service automatically processes user-uploaded images through ImageMagick. Common attack surfaces include web applications that resize or convert images to BMP format [1].
Impact
Successful exploitation grants the attacker a powerful heap corruption primitive, potentially leading to arbitrary code execution. The CVSS score is 9.8 (Critical), indicating high impact on confidentiality, integrity, and availability [2].
Mitigation
The vulnerability is patched in ImageMagick versions 6.9.13-28 and 7.1.2-2. Users on 32-bit builds should update immediately. The fix adds overflow checks in the stride computation and memory allocation (see commit [4]). No workaround is available for affected versions.
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
Magick.NET-Q16-AnyCPUNuGet | < 14.8.1 | 14.8.1 |
Magick.NET-Q16-HDRI-AnyCPUNuGet | < 14.8.1 | 14.8.1 |
Magick.NET-Q16-HDRI-x86NuGet | < 14.8.1 | 14.8.1 |
Magick.NET-Q16-x86NuGet | < 14.8.1 | 14.8.1 |
Magick.NET-Q8-AnyCPUNuGet | < 14.8.1 | 14.8.1 |
Magick.NET-Q8-x86NuGet | < 14.8.1 | 14.8.1 |
Affected products
2< 6.9.13-28 (32-bit build) or < 7.1.2-2 (32-bit build)+ 1 more
- (no CPE)range: < 6.9.13-28 (32-bit build) or < 7.1.2-2 (32-bit build)
- (no CPE)range: < 7.1.2-2
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6- github.com/advisories/GHSA-mxvv-97wh-cfmmghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-57803ghsaADVISORY
- github.com/ImageMagick/ImageMagick/commit/2c55221f4d38193adcb51056c14cf238fbcc35d7ghsax_refsource_MISCWEB
- github.com/ImageMagick/ImageMagick/security/advisories/GHSA-mxvv-97wh-cfmmghsax_refsource_CONFIRMWEB
- github.com/dlemstra/Magick.NET/releases/tag/14.8.1ghsax_refsource_MISCWEB
- lists.debian.org/debian-lts-announce/2025/09/msg00012.htmlghsaWEB
News mentions
0No linked articles in our index yet.