May 22, 2026·6 min read·44 visits
An unbounded integer overflow in ImageMagick's factorial calculation for binomial kernels leads to a mathematical division by zero. Attackers can trigger this denial of service by supplying an excessively large kernel radius.
ImageMagick versions prior to 7.1.1-33 contain an integer overflow vulnerability within the morphology module's binomial kernel generation logic. This integer overflow propagates to yield a division by zero error, resulting in a denial of service.
ImageMagick exposes a morphology module designed to apply convolution kernels to images for operations like blurring, edge detection, and noise reduction. The library supports dynamically generated kernels, including binomial kernels, which rely on mathematical combinations to determine pixel weighting.
The generation of these binomial kernels requires the calculation of binomial coefficients, which internally depend on computing mathematical factorials. The function responsible for these factorial calculations operates on standard architecture-dependent integer types without bounds checking.
An integer overflow vulnerability, tracked as GHSA-VF33-6R7X-66XX, exists within this specific calculation path. When the software processes a request for a binomial kernel with a large radius, the factorial calculation exceeds the maximum bounds of the underlying integer type.
This initial integer overflow triggers a secondary flaw where the mathematical operations yield a zero denominator. The subsequent division by zero results in a fatal arithmetic exception (SIGFPE), causing the immediate termination of the ImageMagick process and presenting a denial-of-service vector.
The root cause originates in the fact() inline function located in MagickCore/morphology.c. This helper function calculates the factorial of a given integer n using a standard iterative loop that stores the accumulated product in a size_t variable.
Factorial growth is strictly non-linear and scales rapidly, quickly exceeding standard integer limits. On a 64-bit architecture, the maximum representable value for a size_t is approximately 1.84 x 10^19. The factorial of 21 exceeds this boundary, resulting in a silent integer wrap-around. On 32-bit systems, the overflow occurs much earlier at the factorial of 13.
The binomial kernel algorithm calculates matrix weights using the standard formula. When the order n reaches a high enough value, the accumulated multiplication in fact() gathers sufficient factors of 2. In modular arithmetic constrained by base-2 integer sizes (e.g., modulo 2^64), accumulating at least 64 factors of 2 guarantees that the resulting product evaluates exactly to zero.
When fact() returns zero for elements of the denominator, the algorithm attempts a division operation against this result. The CPU raises a floating-point exception for division by zero, terminating the process ungracefully since ImageMagick does not catch and recover from synchronous arithmetic exceptions in this module.
Analysis of MagickCore/morphology.c reveals the exact progression of the defect. The vulnerable fact() implementation performs unbounded multiplication. The AcquireKernelBuiltIn() function calls fact() directly with user-influenced arguments derived from the kernel radius.
/* Vulnerable implementation snippet */
static inline size_t fact(size_t n) {
size_t f, l;
for(f=1, l=2; l <= n; f=f*l, l++);
return(f);
}This function lacks safety mechanisms to verify if the product operation will exceed SIZE_MAX.
The patch implemented in commit d67eef71764cfeca07b4edf8a8ae922180f5f2e4 addresses the vulnerability by enforcing strict mathematical limits on the kernel order before any factorial computation occurs. The maintainers introduced a dynamic constant max_order that limits the input bounds based on the architecture's size_t width.
/* Patched implementation snippet in morphology.c */
case BinomialKernel:
{
const size_t max_order = (sizeof(size_t) > 4) ? 20 : 12;
size_t order_f;
/* Check if kernel order (width-1) would overflow fact() */
if ((kernel->width-1) > max_order)
return(DestroyKernelInfo(kernel));
order_f = fact(kernel->width-1);
}By restricting the maximum order to 20 on 64-bit systems and 12 on 32-bit systems, the application ensures that the highest possible calculation never exceeds the arithmetic bounds.
Understanding the execution path illustrates how user-controlled data traverses the application to cause the denial of service. The vulnerability path strictly involves the morphology module and internal math functions.
This flow explicitly shows the lack of boundary validation between the kernel width assignment and the factorial computation. The direct propagation of the unvalidated width dictates the arithmetic failure.
Exploitation of GHSA-VF33-6R7X-66XX does not require advanced memory corruption techniques. The trigger is entirely deterministic and relies strictly on providing a large radius parameter to the morphology subsystem. An attacker invokes the binomial kernel generation routine with an excessively large argument.
A minimal proof-of-concept requires invoking the ImageMagick command-line interface with the -morphology or -convolve flags. Passing a parameter string such as Binomial:100 forces the application to calculate the kernel with an order well beyond the overflow threshold.
# Deterministic trigger causing a SIGFPE crash
magick input.png -morphology Binomial:100 output.pngThis command instructs the morphology engine to acquire a built-in kernel of type Binomial with a radius of 100, which invariably hits the integer wrap-around and division by zero.
For applications utilizing Magick.NET, the vulnerability manifests similarly if user input dictates the morphology parameters. An attacker interacting with a web endpoint that processes images and blindy accepts morphology options can send identical malicious values, terminating the hosting application pool.
The vulnerability yields a direct denial-of-service condition. Because the division by zero triggers a hardware-level SIGFPE, the host operating system instantly halts the vulnerable process. There is no memory corruption, memory leak, or instruction pointer hijacking associated with this flaw.
The security impact is classified as Low severity because triggering the vulnerability requires specific conditions. An attacker must have the ability to supply arbitrary command-line arguments to the ImageMagick binary or control the morphology kernel parameters in an API call.
Web applications that allow user uploads but do not expose raw processing parameters remain unaffected by this specific vector. The flaw cannot be triggered merely by parsing a malformed image format; the attack requires injecting arguments into the image processing pipeline configuration.
In shared hosting environments or microservices that rely heavily on ImageMagick for backend processing, continuous exploitation of this flaw can exhaust process supervisors. An attacker repeatedly submitting malicious morphology requests will force the application server to continuously restart worker processes, degrading service availability.
The primary and complete remediation strategy is to update the ImageMagick suite to version 7.1.1-33 or later. This release incorporates the strict max_order bounds checking in the binomial kernel allocation logic, entirely eliminating the integer overflow vector.
Developers utilizing Magick.NET in C# environments must update their NuGet packages to the releases corresponding with ImageMagick 7.1.1-33. Verifying the library dependency tree is necessary to ensure older, static builds of the core library are not inadvertently packaged with the application.
If immediate patching is not possible, system administrators can mitigate the risk through strict input validation. Applications that expose ImageMagick processing capabilities to end-users must sanitize and restrict all morphology parameters. Enforcing a hard limit on kernel radius values prevents the mathematical trigger condition.
Security engineering teams should implement monitoring for abnormal application crashes containing SIGFPE signals. Correlating these crash dumps with incoming user processing requests can identify active denial-of-service attempts targeting the morphology module.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
ImageMagick ImageMagick Studio LLC | < 7.1.1-33 | 7.1.1-33 |
Magick.NET Dirk Lemstra | < 7.1.1-33 equivalent | 7.1.1-33 equivalent |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-369, CWE-190 |
| Attack Vector | Local / Context-Dependent API |
| Impact | Denial of Service (Application Crash) |
| Exploit Status | Proof-of-Concept |
| Severity | Low |
| CISA KEV | Not Listed |
Divide By Zero resulting from an Integer Overflow
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.