CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-34238

CVE-2026-34238: Heap Buffer Overflow in ImageMagick Despeckle Operation

Alon Barad
Alon Barad
Software Engineer

Apr 13, 2026·5 min read·23 visits

Executive Summary (TL;DR)

A 32-bit integer overflow in ImageMagick's despeckle filter leads to an undersized heap allocation and subsequent out-of-bounds write.

ImageMagick versions prior to 7.1.2-19 and 6.9.13-44 contain an integer overflow vulnerability in the DespeckleImage function. When processing maliciously crafted images on 32-bit architectures, this flaw causes a heap-based buffer overflow, leading to process crashes and potentially arbitrary code execution.

Vulnerability Overview

ImageMagick is a widely deployed open-source software suite responsible for parsing, manipulating, and converting digital images. The suite exposes a broad attack surface due to the complexity of image format specifications and algorithmic manipulations. Vulnerability CVE-2026-34238 affects the despeckle operation in ImageMagick versions prior to 7.1.2-19 and 6.9.13-44.

The vulnerability is fundamentally an integer overflow (CWE-190) that directly leads to an out-of-bounds write (CWE-787) on the heap. Specifically, the flaw exists within the DespeckleImage function, which calculates the required buffer size based on user-supplied image dimensions.

When processed on 32-bit architectures, the arithmetic operation used to determine memory allocation size can wrap around. This results in an undersized heap allocation. Subsequent pixel processing loops use the original, non-wrapped dimension values, causing uncontrolled memory corruption during pixel manipulation.

Root Cause Analysis

The root cause of CVE-2026-34238 resides in MagickCore/effect.c. The DespeckleImage function relies on the image->columns and image->rows attributes, which represent the width and height of the target image. To apply the despeckle filter, the algorithm requires a padded buffer, adding 2 to both dimensions before multiplying them to determine the total pixel count.

On 32-bit systems, the variable designated to store this total size is a 32-bit size_t. The maximum representable value is 4,294,967,295. The calculation executes (image->columns + 2) * (image->rows + 2). If an attacker constructs an image where both dimensions approach 65,534, the multiplication results in 4,294,967,296.

Because the result exceeds the 32-bit limit, the integer wraps around to a value near zero. The AcquireVirtualMemory function receives this undersized length argument and successfully allocates a correspondingly small heap buffer. The despeckle algorithm then iterates over the full original dimensions, writing pixel data far past the boundaries of the allocated heap chunk.

Code Analysis and Fix Incompleteness

Analyzing the vulnerable implementation highlights the lack of pre-condition bounds checking before the arithmetic operation. The original code unconditionally performs the addition and multiplication in a single statement, directly casting to size_t.

/* Vulnerable MagickCore/effect.c */
MagickExport Image *DespeckleImage(const Image *image, ExceptionInfo *exception)
{
  /* ... */
  /* Allocate image buffer. Vulnerability occurs here. */
  length = (size_t)((image->columns + 2) * (image->rows + 2));
  pixel_info = AcquireVirtualMemory(length, sizeof(*pixels));
  /* ... */
}

The upstream patch (commit bcd8519c70ecd9ebbc180920f2cf97b267d1f440) introduces a boundary check for the + 2 operation, comparing the raw columns and rows against MAGICK_SIZE_MAX - 2.

/* Patched MagickCore/effect.c */
if ((image->columns > (MAGICK_SIZE_MAX-2)) ||
    (image->rows > (MAGICK_SIZE_MAX-2)))
  {
    despeckle_image=DestroyImage(despeckle_image);
    ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
  }
length=(image->columns+2)*(image->rows+2);

This patch only prevents the addition from overflowing. It does not validate the result of the multiplication. On a 32-bit target, supplying dimensions of 65,534 passes the MAGICK_SIZE_MAX - 2 check. The subsequent multiplication (65534 + 2) * (65534 + 2) still results in an overflow. This indicates the fix is incomplete, and variant attacks remain mathematically viable.

Exploitation Mechanics

Exploitation requires the attacker to supply a maliciously crafted image to an application utilizing a vulnerable, 32-bit compiled version of ImageMagick. The attacker embeds specific structural dimensions within the image header to manipulate the columns and rows values parsed by the library.

When the application triggers the DespeckleImage function, the integer overflow occurs. This trigger often happens via explicit command-line flags (-despeckle) or automated backend image processing pipelines that apply noise-reduction algorithms. The application allocates the undersized heap chunk.

As the memory corruption triggers an out-of-bounds write of pixel data, the attacker overwrites adjacent heap metadata or application data structures. The precise exploitation sequence depends on the underlying heap allocator and the exact layout of memory at the time of the crash. AddressSanitizer logs from the initial disclosure explicitly confirm an 8-byte out-of-bounds write during this phase.

Impact Assessment

The immediate impact of triggering CVE-2026-34238 is a denial-of-service (DoS) condition. As the out-of-bounds write corrupts critical heap metadata, the application process will eventually fault and terminate. This results in high availability impact (A:H) per the CVSS v3.1 vector.

While the CVSS scoring designates confidentiality and integrity impact as none (C:N, I:N), controlled heap buffer overflows inherently introduce the risk of arbitrary code execution. An attacker capable of grooming the heap to place a target function pointer or object adjacent to the undersized allocation could hijack control flow.

Exploiting this condition for code execution requires precise memory alignment and bypassed exploit mitigations (ASLR, DEP). The complexity is marked as high (AC:H) specifically due to the strict 32-bit architectural requirement and the intricacies of heap layout grooming via an image processing pipeline.

Remediation and Mitigation

Organizations must apply the upstream patches by upgrading ImageMagick to versions 7.1.2-19 or 6.9.13-44. Development teams utilizing the Magick.NET bindings must update their NuGet package dependencies to version 14.12.0 or later to ensure the compiled libraries incorporate the patched binaries.

In environments where immediate patching is unfeasible, administrators should implement strict boundary controls via the ImageMagick policy.xml configuration file. By globally restricting the maximum allowable width and height, the parsing engine will reject structurally oversized images before the DespeckleImage function calculates memory requirements.

The recommended policy explicitly limits the width and height resources to 16KP (16,000 pixels). This upper bound is sufficiently low to prevent the integer multiplication from approaching the 32-bit maximum limit of 4,294,967,295, successfully mitigating the overflow condition prior to the vulnerable function call.

Official Patches

ImageMagickGitHub Security Advisory GHSA-26qp-ffjh-2x4v
ImageMagickImageMagick Release 7.1.2-19
dlemstraMagick.NET Release 14.12.0

Fix Analysis (1)

Technical Appendix

CVSS Score
5.1/ 10
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected Systems

ImageMagick v7 (< 7.1.2-19)ImageMagick v6 (< 6.9.13-44)Magick.NET-Q16-AnyCPU (< 14.12.0)Magick.NET-Q16-HDRI-AnyCPU (< 14.12.0)Magick.NET-Q16-HDRI-x86 (< 14.12.0)Magick.NET-Q16-x86 (< 14.12.0)Magick.NET-Q8-AnyCPU (< 14.12.0)Magick.NET-Q8-x86 (< 14.12.0)

Affected Versions Detail

Product
Affected Versions
Fixed Version
ImageMagick (v7)
ImageMagick
< 7.1.2-197.1.2-19
ImageMagick (v6)
ImageMagick
< 6.9.13-446.9.13-44
Magick.NET
dlemstra
< 14.12.014.12.0
AttributeDetail
CWE IDCWE-190
CVSS Base Score5.1
Attack VectorLocal (AV:L)
ImpactHigh Availability (A:H)
Attack ComplexityHigh (AC:H)
Privileges RequiredNone (PR:N)

MITRE ATT&CK Mapping

T1203Exploitation for Client Execution
Execution
T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-190
Integer Overflow or Wraparound

An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation.

Vulnerability Timeline

Patch committed by ImageMagick maintainers.
2026-03-25
Security advisory GHSA-26qp-ffjh-2x4v published.
2026-04-13
CVE-2026-34238 assigned and published.
2026-04-13

References & Sources

  • [1]GHSA-26qp-ffjh-2x4v
  • [2]ImageMagick Fix Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•5 days ago•CVE-2026-9354
6.9

CVE-2026-9354: Arbitrary Mass Mention Bypass in NousResearch hermes-agent Slack and Mattermost Adapters

A vulnerability in the Slack and Mattermost platform adapters for NousResearch hermes-agent permits an unauthenticated remote attacker to execute arbitrary mass mentions. By leveraging prompt injection, an attacker can bypass output sanitization logic and trigger workspace-wide notification exhaustion.

Alon Barad
Alon Barad
35 views•6 min read
•6 days ago•CVE-2026-9306
6.3

CVE-2026-9306: Unauthenticated Insecure Direct Object Reference (IDOR) in QuantumNous new-api Midjourney Relay

CVE-2026-9306 is a critical unauthenticated Insecure Direct Object Reference (IDOR) vulnerability located in the QuantumNous new-api application, affecting versions up to and including 0.12.1. The flaw is caused by improper middleware ordering combined with a lack of object-level authorization checks. This allows remote, unauthenticated attackers to retrieve sensitive Midjourney images belonging to other users by supplying a valid task identifier.

Amit Schendel
Amit Schendel
13 views•5 min read
•6 days ago•GHSA-GGXF-37HM-9WQF
6.5

GHSA-GGXF-37HM-9WQF: Session Leakage via Unsafe Challenge Path Parsing in instagrapi

The instagrapi library prior to version 2.6.9 contains an improper input validation vulnerability within its challenge handling mechanism. Maliciously crafted server responses can manipulate the client into forwarding session cookies and credentials to an external attacker-controlled domain.

Amit Schendel
Amit Schendel
21 views•6 min read
•7 days ago•GHSA-QQQM-5547-774X
9.1

GHSA-QQQM-5547-774X: Unauthenticated Path Traversal in FileBrowser Quantum PATCH Handler

GHSA-QQQM-5547-774X is a critical path traversal vulnerability in the FileBrowser Quantum application, specifically within the Go backend package. The vulnerability resides in the HTTP handler responsible for processing bulk file modifications via the public API. Unauthenticated attackers can exploit an order-of-operations flaw in the path sanitization logic to bypass intended directory restrictions. This allows adversaries to arbitrarily read, move, and overwrite files on the underlying filesystem by supplying specially crafted HTTP PATCH requests.

Alon Barad
Alon Barad
9 views•6 min read
•7 days ago•CVE-2026-8723
5.3

CVE-2026-8723: Synchronous Denial of Service in qs npm Package via TypeError

The qs query string parsing and serialization library for Node.js is vulnerable to a synchronous Denial of Service (DoS) attack. The vulnerability manifests as a process-terminating TypeError when processing arrays with null or undefined elements under specific configuration parameters.

Amit Schendel
Amit Schendel
37 views•7 min read
•7 days ago•GHSA-7M8F-HGJQ-8GC9
7.5

GHSA-7M8F-HGJQ-8GC9: Pre-Authentication Denial of Service via Insecure Deserialization Order in aiosend

The aiosend library prior to version 3.0.6 contains a pre-authentication Denial of Service (DoS) vulnerability in its webhook handling mechanism. The software processes and deserializes incoming JSON payloads before verifying the cryptographic signature, allowing unauthenticated attackers to exhaust server CPU and memory resources by sending large, complex payloads.

Amit Schendel
Amit Schendel
4 views•6 min read