Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-55004

CVE-2025-55004: ImageMagick Buffer Overflow Vulnerability

CVE-2025-55004 is a heap-buffer overflow flaw in ImageMagick that affects handling of images with separate alpha channels during magnification. This post covers technical details, affected versions, and mitigation steps.

Published:

CVE-2025-55004 Overview

CVE-2025-55004 is a heap-buffer overflow read vulnerability [CWE-122] affecting ImageMagick, the open-source image editing and manipulation library. The flaw resides in the ReadOneMNGIMage function when handling images with separate alpha channels during image magnification. Attackers can craft malicious MNG (Multiple-image Network Graphics) files that trigger an out-of-bounds read, potentially leaking subsequent heap memory contents into the resulting output image. The vulnerability affects ImageMagick versions prior to 7.1.2-1, which contains the patch. Exploitation requires user interaction, typically opening or processing a crafted image file through an application that embeds ImageMagick.

Critical Impact

Processing a crafted MNG image with a vulnerable ImageMagick build can leak adjacent heap memory into the output image, exposing sensitive process data.

Affected Products

  • ImageMagick versions prior to 7.1.2-1
  • Applications and services embedding vulnerable ImageMagick libraries for image conversion
  • Web platforms exposing MNG parsing through user-supplied uploads

Discovery Timeline

  • 2025-08-13 - CVE-2025-55004 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-55004

Vulnerability Analysis

The vulnerability is a heap-buffer overflow read triggered inside ReadOneMNGIMage, the routine responsible for decoding MNG images within ImageMagick's coder subsystem. When the decoder processes an image containing a separate alpha channel and performs the magnification operation, it reads past the bounds of the allocated heap buffer. The bytes read from adjacent heap memory are then written into pixel data of the output image, creating a memory disclosure primitive rather than a code execution primitive.

Because the leaked bytes surface in the rendered output, an attacker who submits a crafted MNG and retrieves the converted image can recover arbitrary heap contents. This can include fragments of prior image data, environment strings, or other in-memory secrets held by the host process. The attack vector is network-reachable in typical deployments such as image conversion services, content management systems, and cloud media pipelines.

Root Cause

The root cause is missing or incorrect bounds validation on pixel access during the magnification path for images with a separate alpha channel. The MNG coder does not correctly account for the layout difference between combined and separate alpha channel formats when computing source pixel offsets, causing reads beyond the allocated pixel buffer.

Attack Vector

An attacker crafts an MNG file with a specific separate-alpha configuration and submits it to any application that invokes ImageMagick to convert, thumbnail, or resize the image. User interaction is required — a user or automated pipeline must process the file. See the GitHub Security Advisory for advisory details.

// No verified exploit code is published for CVE-2025-55004.
// The vulnerability is triggered by processing a crafted MNG image with a
// separate alpha channel through a vulnerable ImageMagick build,
// causing ReadOneMNGIMage to read past a heap buffer during magnification.

Detection Methods for CVE-2025-55004

Indicators of Compromise

  • Presence of ImageMagick binaries or libraries with version strings below 7.1.2-1 on hosts running conversion services.
  • Unexpected MNG file uploads to endpoints that normally receive only JPEG, PNG, or WebP content.
  • Converted output images containing visible noise bands or artifacts inconsistent with the source, which may indicate leaked memory rendered into pixels.

Detection Strategies

  • Inventory installed ImageMagick packages across servers and container images and compare against version 7.1.2-1.
  • Inspect application logs for magick, convert, or identify invocations processing .mng files or MIME type video/x-mng.
  • Monitor for process crashes or ASan-style heap-read reports originating from coders/mng.c or ReadOneMNGIMage.

Monitoring Recommendations

  • Alert on ImageMagick child processes spawned by web servers or media workers when handling MNG inputs.
  • Track anomalous outbound transfers of converted images that could carry disclosed memory back to an attacker.
  • Ingest package inventory and process telemetry into a centralized data lake to correlate vulnerable versions with file-processing activity.

How to Mitigate CVE-2025-55004

Immediate Actions Required

  • Upgrade ImageMagick to version 7.1.2-1 or later on all systems, including container base images and CI runners.
  • Disable the MNG coder in policy.xml on hosts that do not require MNG support until patching is complete.
  • Restrict accepted upload MIME types and file extensions on public-facing services to a minimal allow-list.

Patch Information

The issue is fixed in ImageMagick 7.1.2-1. Refer to the upstream GitHub Security Advisory GHSA-cjc8-g9w8-chfw for commit and release details. Rebuild dependent container images and redeploy after upgrading system packages.

Workarounds

  • Add a policy.xml rule denying the MNG coder to block parsing of the affected format.
  • Route image processing through a sandboxed worker with seccomp filters and no access to sensitive in-process secrets.
  • Strip or reject files whose magic bytes identify them as MNG at the ingress layer before invoking ImageMagick.
bash
# Deny the MNG coder in ImageMagick policy.xml
# Location: /etc/ImageMagick-7/policy.xml (path varies by distribution)
<policymap>
  <policy domain="coder" rights="none" pattern="MNG" />
</policymap>

# Verify the installed version meets the patched baseline
magick -version | head -n 1

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.