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-26066
6.20.01%

Infinite Loop, Infinite Pain: Analyzing CVE-2026-26066 in ImageMagick

Amit Schendel
Amit Schendel
Senior Security Researcher

Feb 24, 2026·6 min read·10 visits

No Known Exploit

Executive Summary (TL;DR)

ImageMagick contains an infinite loop vulnerability in `coders/meta.c`. A malicious image with invalid IPTC data can cause the parser to get stuck reading the same byte forever, resulting in a Denial of Service. Patch immediately to 7.1.2-15 or 6.9.13-40.

A logic error in ImageMagick's IPTC metadata parser allows for a trivial Denial of Service (DoS) attack. By supplying a crafted image file, an attacker can trap the processing thread in an infinite loop, causing 100% CPU utilization and potentially taking down image processing pipelines.

The Hook: The Atlas of the Internet Shrugs

If you've ever uploaded a profile picture, generated a thumbnail, or converted a format on the web, you have almost certainly used ImageMagick. It is the silent workhorse of the internet, a library so ubiquitous that it exists in the dependency tree of nearly every major web framework. But heavy lies the crown, and when you are parsing untrusted binary data from anonymous users on the internet, you are playing Russian Roulette with a fully loaded glock.

CVE-2026-26066 isn't a flashy RCE (Remote Code Execution). It won't give me a reverse shell on your server (directly). But in the world of availability, it is a silent killer. It's a logic flaw in how the library handles IPTC (International Press Telecommunications Council) metadata—the stuff that tells news agencies who took the photo.

The vulnerability is a classic "Hamster Wheel" scenario. By feeding ImageMagick a specifically malformed image, we can trick the code into entering a state where it thinks it's making progress, but it's actually just staring at the same byte of memory, forever, screaming internally at 100% CPU usage. For a cloud environment running autoscaling groups, this is the kind of bug that turns a $50 monthly bill into a $5,000 monthly bill overnight.

The Flaw: A Loop Without an Exit

To understand this bug, you have to think like a parser. The vulnerability lives in coders/meta.c, specifically in a function called formatIPTC. Its job is to iterate through binary data, looking for specific marker bytes (specifically 0x1c) that denote the start of an IPTC tag.

A robust parser follows a simple rule: Always Advance. No matter what garbage you find in the stream, you must move the read pointer forward. If you don't, you risk processing the same garbage again.

The developer implemented a while loop that checks if the current byte (c) is EOF (End of File). Inside that loop, if they found the magic byte 0x1c, they processed the tag. But what if they found something else? They wrote an else block to handle invalid data. Theoretically, this block should skip the garbage and move on.

In practice, they made a fatal error. Instead of reading the next byte from the file stream to continue the search, they manually set the variable c to 0 and hit continue. This sends the execution flow back to the top of the while loop. Since 0 is not EOF, the loop runs again. But because they didn't call ReadBlobByte, the file pointer hasn't moved. The variable c is processed, the else block triggers again, sets c to 0, and we spin. Forever.

The Code: The Smoking Gun

Let's look at the diff. It's almost painful in its simplicity. This is the kind of bug that survives code review because it looks like error handling, but it's actually an infinite loop trap.

Here is the vulnerable logic in coders/meta.c:

// Vulnerable Code
c = ReadBlobByte(ifile);
while (c != EOF)
{
  if (c == 0x1c)
  {
    // ... complex parsing logic for valid tags ...
  }
  else
  {
    // THE BUG IS HERE
    c = 0;      // Reset c to a non-EOF value
    continue;   // Restart loop WITHOUT reading a new byte
  }
}

When continue is hit, the code jumps back to while (c != EOF). Since c was forced to 0, the check passes. The if (c == 0x1c) check fails (because 0 is not 0x1c). The else block runs again. c is set to 0. Ad infinitum.

Here is the fix provided in commit 880057ce34f6da9dff2fe3b290bbbc45b743e613:

             break;
           }
         else
           {
-            c=0;
+            c=ReadBlobByte(ifile);
             continue;
           }

By replacing the assignment c=0 with c=ReadBlobByte(ifile), the developer ensures that even when garbage data is encountered, the file stream advances to the next byte. Eventually, ReadBlobByte will return EOF, and the loop will terminate naturally.

The Exploit: Asymmetric Warfare

Exploiting this does not require a complex heap groom or ROP chain. It requires a hex editor. The attack vector is strictly Local (AV:L), meaning you need to get the file onto the system, but in the context of a web application processing user uploads, "Local" just means "I uploaded a file."

The Recipe:

  1. Create a valid image container (e.g., JPEG or TIFF).
  2. Inject an IPTC metadata profile.
  3. In the spot where the parser expects the 0x1c marker, place a 0x00 (or literally anything other than 0x1c or EOF).
  4. Upload to target.

When the backend worker (Sidekiq, Celery, or a direct PHP script) picks up this file to resize it or strip metadata, it invokes coders/meta.c. The process will immediately pin a CPU core to 100%.

Now, imagine an attacker automates this. They upload 50 of these images. If your server has 48 cores, you are now completely dead in the water. Legitimate requests time out. If you are on AWS Lambda or similar serverless architecture, the function will run until it hits its maximum execution time limit, racking up costs for compute time that resulted in absolutely nothing.

The Fix: Remediation and Defense

The remediation is straightforward: you must update the library. Because ImageMagick is often installed as a system dependency or a background shared library, simply updating your application code might not be enough—you need to update the OS packages.

For System Administrators: Update to ImageMagick 7.1.2-15 or 6.9.13-40. If you are using a package manager (apt, yum, apk), ensure you pull the latest security patches.

For Developers: If you are using wrappers like Magick.NET, you are also vulnerable because the native logic is wrapped. Update Magick.NET to version 14.10.3 or newer.

Defense in Depth: Beyond patching, this vulnerability highlights the need for Resource Limits.

  1. Timeouts: Never let an image processing job run indefinitely. Set a strict timeout (e.g., 5-10 seconds). If it takes longer than that to resize a profile picture, kill the process.
  2. Resource Constraints: Use cgroups or Docker resource limits to prevent a single container from consuming all host CPU cycles.
  3. Input Sanitization: While hard to sanitize binary blobs, ensure you are only processing expected file types.

Official Patches

ImageMagickGitHub Commit fixing the logic error
ImageMagickOfficial Security Advisory

Fix Analysis (1)

Technical Appendix

CVSS Score
6.2/ 10
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
EPSS Probability
0.01%
Top 90% most exploited

Affected Systems

ImageMagick 7.x < 7.1.2-15ImageMagick 6.x < 6.9.13-40Magick.NET < 14.10.3Web applications allowing image uploadsContent Management Systems (CMS) using ImageMagick

Affected Versions Detail

Product
Affected Versions
Fixed Version
ImageMagick v7
ImageMagick
>= 7.0.0-0, < 7.1.2-157.1.2-15
ImageMagick v6
ImageMagick
< 6.9.13-406.9.13-40
Magick.NET
dlemstra
< 14.10.314.10.3
AttributeDetail
CWECWE-835 (Infinite Loop)
CVSS v3.16.2 (Medium)
Attack VectorLocal (User Supplied File)
Availability ImpactHigh (DoS)
Exploit StatusTrivial / No Public PoC yet
EPSS Score0.00013 (Low probability)

MITRE ATT&CK Mapping

T1499Endpoint Denial of Service
Impact
T1499.003Application or System Exploitation
Impact
CWE-835
Infinite Loop

Loop with Unreachable Exit Condition ('Infinite Loop')

Vulnerability Timeline

Fix merged to main branch
2026-02-12
Public Disclosure & GHSA Created
2026-02-24
NVD Published
2026-02-24

References & Sources

  • [1]GHSA Advisory
  • [2]NVD Detail

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.