Cloudanix VulnDB

CVE-2025-57807

Low · 3.8

ImageMagick BlobStream Forward-Seek Under-Allocation

CVSS

3.8

EPSS

0.3%

Published

Sep 5, 2025

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in widely used image software can let attackers overwrite internal memory when processing certain files, which may crash programs or allow malicious code to run.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Data Tampering
Component
Library
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

SeekBlob on memory-backed BlobStream advances offset past current extent without resizing; subsequent WriteBlob then reallocates by quantum+length and performs copy at data+offset, resulting in deterministic out-of-bounds heap write on 64-bit builds.

Why it matters to the business

Applications that process images with ImageMagick may experience crashes, memory corruption, or remote code execution, leading to service outages, data integrity issues, or full system compromise when handling untrusted inputs.

How an attack unfolds

An attacker supplies input that causes an ImageMagick blob operation to invoke SeekBlob with an offset larger than the current allocation, followed by WriteBlob that expands insufficiently and writes attacker-controlled data past the heap buffer end.

How to fix it

Upgrade imagemagick/imagemagick to commit 077a417a19a5ea8c85559b602754a5b928eef23e or later; rebuild dependent packages and restart services that link against the library.

How to confirm the fix worked

Confirm installed version contains commit 077a417a19a5ea8c85559b602754a5b928eef23e; run regression tests with crafted blob seek/write sequences; monitor for heap-related crashes or sanitizer violations during image operations.

Typical attack path

  1. Trigger ImageMagick code path that creates a memory-backed BlobStream
  2. Call SeekBlob to advance offset beyond current extent
  3. Invoke WriteBlob with data that forces reallocation and out-of-bounds copy
  4. Achieve deterministic heap write to corrupt adjacent structures or gain control flow

How to detect it

Monitor ImageMagick processes for segmentation faults or heap corruption signals in system logs; inspect application error logs for blob-related failures; review crash dumps for out-of-bounds write patterns near blob allocation routines.

What your security team should do

  • Immediately update all ImageMagick installations to the fixed commit
  • Scan build pipelines and containers for older ImageMagick versions
  • Add memory sanitizer or ASAN checks to CI for image-processing workloads
  • Review and restrict ImageMagick usage on untrusted inputs where possible

The record

For memory-backed blobs (**BlobStream**), [`SeekBlob()`](https://github.com/ImageMagick/ImageMagick/blob/3fcd081c0278427fc0e8ac40ef75c0a1537792f7/MagickCore/blob.c#L5106-L5134) permits advancing the stream **offset** beyond the current end without increasing capacity. The subsequent [`WriteBlob()`](https://github.com/ImageMagick/ImageMagick/blob/3fcd081c0278427fc0e8ac40ef75c0a1537792f7/MagickCore/blob.c#L5915-L5938) then expands by **`quantum + length`** (amortized) instead of **`offset + length`**, and copies to `data + offset`. When `offset ≫ extent`, the copy targets memory beyond the allocation, producing a deterministic heap write on 64-bit builds. No 2⁶⁴ arithmetic wrap, external delegates, or policy settings are required. ---

Affected packages

Ecosystem Package Introduced Fixed
NuGet Magick.NET-Q16-HDRI-OpenMP-arm64 0 14.8.2
NuGet Magick.NET-Q16-HDRI-OpenMP-x64 0 14.8.2
NuGet Magick.NET-Q16-HDRI-arm64 0 14.8.2
NuGet Magick.NET-Q16-HDRI-x64 0 14.8.2
NuGet Magick.NET-Q16-OpenMP-arm64 0 14.8.2
NuGet Magick.NET-Q16-OpenMP-x64 0 14.8.2
NuGet Magick.NET-Q16-arm64 0 14.8.2
NuGet Magick.NET-Q16-x64 0 14.8.2
NuGet Magick.NET-Q8-OpenMP-arm64 0 14.8.2
NuGet Magick.NET-Q8-OpenMP-x64 0 14.8.2
NuGet Magick.NET-Q8-arm64 0 14.8.2
NuGet Magick.NET-Q8-x64 0 14.8.2
Debian:11 imagemagick 0 8:6.9.11.60+dfsg-1.3+deb11u6
Debian:12 imagemagick 0 8:6.9.11.60+dfsg-1.6+deb12u4
Debian:13 imagemagick 0 8:7.1.1.43+dfsg1-1+deb13u2
Debian:14 imagemagick 0 8:7.1.2.3+dfsg1-1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP6 ImageMagick 0 7.1.1.21-150600.3.23.1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP6 ImageMagick 0 7.1.0.9-150400.6.43.1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP7 ImageMagick 0 7.1.1.43-150700.3.16.1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP7 ImageMagick 0 7.1.0.9-150400.6.43.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 ImageMagick 0 7.1.1.21-150600.3.23.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 ImageMagick 0 7.1.1.43-150700.3.16.1
openSUSE:Leap 15.6 ImageMagick 0 7.1.1.21-150600.3.23.1
openSUSE:Leap 16.0 ImageMagick 0 7.1.2.0-160000.4.1
openSUSE:Tumbleweed ImageMagick 0 7.1.2.3-1.1

Related vulnerabilities