VYPR
High severityNVD Advisory· Published Aug 26, 2025· Updated Feb 26, 2026

ImageMagick (WriteBMPImage): 32-bit integer overflow when writing BMP scanline stride → heap buffer overflow

CVE-2025-57803

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.

PackageAffected versionsPatched versions
Magick.NET-Q16-AnyCPUNuGet
< 14.8.114.8.1
Magick.NET-Q16-HDRI-AnyCPUNuGet
< 14.8.114.8.1
Magick.NET-Q16-HDRI-x86NuGet
< 14.8.114.8.1
Magick.NET-Q16-x86NuGet
< 14.8.114.8.1
Magick.NET-Q8-AnyCPUNuGet
< 14.8.114.8.1
Magick.NET-Q8-x86NuGet
< 14.8.114.8.1

Affected products

2
  • ImageMagick/Imagemagickllm-fuzzy2 versions
    < 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

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

6

News mentions

0

No linked articles in our index yet.