Feb 16, 2026·5 min read·29 visits
ImageMagick's OpenCL device profiler leaks memory when parsing bad XML. By placing a malformed 'ImagemagickOpenCLDeviceProfile.xml' in the cache directory, an attacker can cause persistent memory leaks in long-running processes, eventually leading to Denial of Service.
A memory leak vulnerability exists in ImageMagick's OpenCL benchmarking component. When parsing malformed device profile XML files, the parser fails to release allocated string members within the benchmark structure, leading to resource exhaustion.
ImageMagick is the heavy lifter of the internet. If you've ever uploaded a photo to a website and it magically resized itself, ImageMagick probably did the work. To keep up with the demand for speed, the library tries to offload work to your GPU using OpenCL. But GPUs are finicky beasts, so ImageMagick runs a "benchmark" the first time it sees a device to figure out if it's worthy of the workload.
This benchmark data is cached in an XML file so it doesn't have to run every time. It sounds efficient, right? Well, that caching mechanism is where our story begins. In the rush to parse this XML and get to the GPU acceleration, the developers left a small but critical gap in their memory management logic. It’s a classic case of "happy path" programming—assuming the data is always good, and failing to clean up the mess when it isn't.
This isn't a remote code execution that will give you a shell in five seconds. It's a slow burn. A memory leak. It's the digital equivalent of a dripping faucet that eventually floods the basement. In long-running services that process thousands of images, this drip turns into a deluge.
The vulnerability lives in MagickCore/opencl.c, specifically within the LoadOpenCLDeviceBenchmark() function. This function is tasked with reading ImagemagickOpenCLDeviceProfile.xml. It iterates through the XML nodes, looking for <device> tags. When it finds one, it does what any good C program does: it asks the operating system for some memory.
It allocates a MagickCLDeviceBenchmark structure. Inside that structure, there are pointers to strings: platform_name, vendor_name, name, and version. These aren't just fixed buffers; they are dynamically allocated strings created via ConstantString().
Here is the logic flaw: The code assumes that if the XML parsing fails or hits a weird state (like a malformed tag), it should just free the parent structure (device_benchmark) and bail out. The problem is that freeing a struct in C does not free the pointers inside it. It's like demolishing a house but leaving all the furniture floating in mid-air. The parent container is gone, but the string allocations remain in the heap, orphaned and unreachable.
Let's look at the crime scene. In the vulnerable version of MagickCore/opencl.c, the cleanup block at the end of the function (or during error handling) looked something like this:
// The Vulnerable Exit Block
// 1. Free the temporary token string
token=(char *) RelinquishMagickMemory(token);
// 2. Free the benchmark struct itself
device_benchmark=(MagickCLDeviceBenchmark *)
RelinquishMagickMemory(device_benchmark);
// WAIT! What about device_benchmark->platform_name?
// What about device_benchmark->vendor_name?
// They are gone. Leaked forever.The fix is straightforward but tedious. You have to manually walk through the struct and free every member before you free the struct itself. This is why languages like Rust are eating C's lunch, but I digress. Here is the corrected logic:
// The Fixed Cleanup Logic
if (device_benchmark != (MagickCLDeviceBenchmark *) NULL)
{
// Manually free every string member first
if (device_benchmark->platform_name != (char *) NULL)
device_benchmark->platform_name=
RelinquishMagickMemory(device_benchmark->platform_name);
if (device_benchmark->vendor_name != (char *) NULL)
device_benchmark->vendor_name=
RelinquishMagickMemory(device_benchmark->vendor_name);
// ... repeat for name and version ...
// Finally, free the parent struct
device_benchmark=(MagickCLDeviceBenchmark *)
RelinquishMagickMemory(device_benchmark);
}To exploit this, we don't need to overflow a buffer; we just need to lie to the parser. The parser expects a well-formed XML entry like <device name="..." />. If we give it a <device tag that opens but never closes, or contains garbage, the parser hits the error path—the same error path that forgets to free memory.
The attack vector is local, which limits the fun, but it's deadly in shared environments. The target file is typically located at ~/.cache/ImageMagick/ImagemagickOpenCLDeviceProfile.xml. If you are on a multi-user system or a web server where you can write files to the working directory or the user's home (perhaps via a separate unrestricted file upload vulnerability), you can drop this time bomb.
The Payload:
<managed_devices>
<!-- Open the tag, allocate the memory, but never close it -->
<device
platform="LeakyPlatformString_That_Takes_Up_Space"
vendor="LeakyVendorString_That_Takes_Up_Space"
name="LeakyName_That_Takes_Up_Space"
version="1.0" Every time the ImageMagick library initializes (which could be every time a PHP script processes an upload), it reads this file. It allocates the strings. It hits the malformed syntax. It errors out. It leaks the strings. Rinse and repeat until the server runs out of RAM and the OOM killer steps in.
The remediation is simple: update. The Magick.NET team (specifically dlemstra) identified this and patched it in version 14.10.2. For the core C library, you'll want to be on 7.1.2-13 or later.
If you can't update immediately, you have two options. First, verify permissions on the ImageMagick cache directory. Ensure that the user running the ImageMagick process is the only one who can write to it. If an attacker can't place the XML file, they can't trigger the leak.
Second, turn off the feature entirely. If you aren't doing heavy lifting that requires OpenCL (and let's be honest, most simple web resizing tasks don't), you can disable it via environment variables or the policy.xml configuration. No OpenCL means no benchmarking, which means no XML parsing, which means no leak.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
ImageMagick ImageMagick Studio LLC | <= 7.1.2-12 | 7.1.2-13 |
Magick.NET dlemstra | < 14.10.2 | 14.10.2 |
| Attribute | Detail |
|---|---|
| CWE | CWE-401 (Memory Leak) |
| Attack Vector | Local (File System) |
| CVSS | 6.5 (Medium) |
| Component | MagickCore/opencl.c |
| Function | LoadOpenCLDeviceBenchmark |
| Exploit Status | Proof of Concept Available |
The software does not sufficiently track and release allocated memory after it has been used, which effectively reduces available memory over time.
CVE-2026-16454 is an object-level authorization bypass vulnerability (CWE-284, CWE-862) in Eclipse hawkBit versions 1.0.3 and prior. The flaw exists within the Direct Device Integration (DDI) REST controller (hawkbit-ddi-resource), where endpoints responsible for enumerating software module metadata and serving firmware binaries fail to verify whether the requested software module is assigned to the authenticated device. Consequently, any device with valid credentials (such as a TargetToken or GatewayToken) can enumerate software module identifiers and download arbitrary firmware artifacts across the entire tenant namespace.
CVE-2026-62284 (GHSA-5w5g-j6hw-6p8f) is a code injection and server-side request forgery vulnerability in the console-proxy component of the OSAC Operator. The RemoteConfigResolver parses Kubernetes Secrets containing kubeconfig files via clientcmd.RESTConfigFromKubeConfig without sanitizing execution-related fields. An attacker with RBAC permissions to create or modify labeled Secrets in monitored namespaces can supply a malicious exec credential plugin, resulting in arbitrary command execution within the console-proxy pod.
CVE-2026-62361 (GHSA-xgjr-7j9q-2h4r) is an authenticated SQL injection and authorization bypass vulnerability in listmonk, an open-source, self-hosted newsletter and mailing list manager written in Go. In versions prior to 6.2.0, the subscriber export endpoint (GET /api/subscribers/export) directly interpolates user-supplied SQL filter expressions into a PostgreSQL query without invoking the table allowlist validation function (validateQueryTables). Consequently, authenticated users possessing the subscribers:sql_query and subscribers:get_all permissions can bypass relational access controls, execute arbitrary subqueries against restricted tables such as users and settings, and modify database state via writable Common Table Expressions (CTEs).
CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.