CVE-2025-57803
NoneCVSS
—
EPSS
0.9%
Published
Aug 26, 2025
CISA due date
—
Cloudanix analysis
A bug in ImageMagick’s handling of certain BMP pictures on 32-bit systems can let a specially made image damage memory and potentially take control of the program.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Full Compromise
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
32-bit integer overflow in the BMP encoder’s scanline-stride computation causes bytes_per_line to collapse to a tiny value; the per-row writer still emits 3 × width bytes for 24-bpp images, allowing the row base pointer to advance using the overflowed stride and immediately write attacker-controlled bytes past the allocated slot into adjacent heap memory.
Why it matters to the business
Systems that automatically convert or process untrusted BMP images with ImageMagick on 32-bit builds can suffer memory corruption that leads to crashes or potential code execution, disrupting image-handling workflows across many organizations and downstream packages.
How an attack unfolds
An attacker supplies a crafted 24-bpp BMP image whose width triggers the stride overflow during encoding; the corrupted write primitive corrupts heap metadata or adjacent objects, enabling further exploitation in auto-convert pipelines.
How to fix it
Upgrade imagemagick/imagemagick to commit 2c55221f4d38193adcb51056c14cf238fbcc35d7 and imagemagick/imagemagick6 to commit 2fe4a1049f469029878b05426cbbf652a94006f8 (corresponding to versions 6.9.13-28 and 7.1.2-2). Rebuild any dependent packages and restart affected services.
How to confirm the fix worked
Verify installed versions report 6.9.13-28 or newer (6.x) and 7.1.2-2 or newer (7.x); run regression tests with width values that previously triggered the stride overflow and confirm no heap writes occur outside allocated buffers.
Typical attack path
- Attacker crafts a malicious 24-bpp BMP with width chosen to overflow the 32-bit stride calculation
- Victim system receives the image via upload, email attachment, or web conversion
- ImageMagick BMP encoder computes an under-sized bytes_per_line and begins writing rows
- First row write overflows into adjacent heap memory with controlled data
- Heap corruption is leveraged for control-flow hijacking or information disclosure
How to detect it
Review application logs and process crash dumps for BMP encoding paths that terminate with heap-related faults; correlate file-processing timestamps with conversion jobs that handled BMP images.
What your security team should do
- Immediately update all 32-bit ImageMagick installations to the listed fixed commits
- Disable BMP support or enforce strict input validation where upgrades are delayed
- Add ImageMagick version checks to build and deployment pipelines
- Monitor EPSS trend and re-evaluate if exploit maturity increases
The record
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.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| NuGet | Magick.NET-Q16-AnyCPU | 0 | 14.8.1 |
| NuGet | Magick.NET-Q16-HDRI-AnyCPU | 0 | 14.8.1 |
| NuGet | Magick.NET-Q16-HDRI-x86 | 0 | 14.8.1 |
| NuGet | Magick.NET-Q16-x86 | 0 | 14.8.1 |
| NuGet | Magick.NET-Q8-AnyCPU | 0 | 14.8.1 |
| NuGet | Magick.NET-Q8-x86 | 0 | 14.8.1 |
| Debian:11 | imagemagick | 0 | No fix |
| Debian:12 | imagemagick | 0 | No fix |
| Debian:13 | imagemagick | 0 | No fix |
| Debian:14 | imagemagick | 0 | No fix |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP6 | ImageMagick | 0 | 7.1.1.21-150600.3.20.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP7 | ImageMagick | 0 | 7.1.1.43-150700.3.13.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP6 | ImageMagick | 0 | 7.1.1.21-150600.3.20.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP7 | ImageMagick | 0 | 7.1.1.43-150700.3.13.1 |
| openSUSE:Leap 15.6 | ImageMagick | 0 | 7.1.1.21-150600.3.20.1 |
| openSUSE:Leap 16.0 | ImageMagick | 0 | 7.1.2.0-160000.4.1 |
| openSUSE:Tumbleweed | ImageMagick | 0 | 7.1.2.2-2.1 |
Related vulnerabilities
- CVE-2026-27799 ImageMagick is free and open-source software used for editing and manipulating digital… Also affects Magick.NET-Q16-AnyCPU
- CVE-2026-27798 ImageMagick is free and open-source software used for editing and manipulating digital… Also affects Magick.NET-Q16-AnyCPU
- GHSA-r99p-5442-q2x2 ImageMagick has a heap Buffer Over-read in its DJVU image format handler Also affects Magick.NET-Q16-AnyCPU
- GHSA-qpgx-jfcq-r59f ImageMagick: Heap Buffer Over-read in WaveletDenoise when processing small images Also affects Magick.NET-Q16-AnyCPU
- GHSA-gq5v-qf8q-fp77 ImageMagick: Heap-based Buffer Overflow in GetPixelIndex due to metadata-cache… Also affects Magick.NET-Q16-AnyCPU
- GHSA-wfx3-6g53-9fgc ImageMagick: Memory Leak in multiple coders that write raw pixel data Also affects Magick.NET-Q16-AnyCPU
- GHSA-3q5f-gmjc-38r8 ImageMagick: Memory leak in coders/txt.c without freetype Also affects Magick.NET-Q16-AnyCPU
- GHSA-xpg8-7m6m-jf56 ImageMagick: SVG-to-MVG Command Injection via coders/svg.c Also affects Magick.NET-Q16-AnyCPU