Track vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
7.5

CVE-2026-47667: CImg Library: Memory Leak in Image File Loading

CVE-2026-47667 · published 3 months ago
Summary

The CImg Library can leak large amounts of memory when loading certain types of image files. This can happen when the library tries to load a file that is malformed or corrupted. To fix this issue, update the CImg Library to version 4.0.0 or later.

What to do

The CVE record does not list a fixed version. Check the vendor's site or the advisory links below - a fix may already be released.

Affected software
Ecosystem VendorProductAffected versions
Debian:11 debian cimg All versions
Debian:12 debian cimg All versions
Debian:13 debian cimg All versions
Debian:14 debian cimg All versions
– greyclab cimg < 4.0.0
Ubuntu:16.04:LTS canonical cimg All versions
Ubuntu:Pro:18.04:LTS canonical cimg All versions
Ubuntu:20.04:LTS canonical cimg All versions
Ubuntu:Pro:22.04:LTS canonical cimg All versions
Ubuntu:Pro:24.04:LTS canonical cimg All versions
Ubuntu:26.04:LTS canonical cimg All versions
Original advisory text
CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header
CImg Library is a C++ library for image processing. Prior to version 4.0.0 in `_load_analyze()`, the header_size field is read as an `unsigned int` from the first 4 bytes of an Analyze/NIfTI file and passed directly to `new unsigned char[header_size]` without being bounded against the actual file size. A value up to ~4 GB is accepted. If the subsequent `fread` returns `short` as it will for any malformed file), the function throws a `CImgIOException` and the allocated buffer is never freed. A 6-byte crafted file is sufficient to trigger an allocation of ~1.3 GB per call, with the full allocation leaked on every error path. The issue is reachable via `load_analyze()` and the generic `load()` when the file extension is .hdr, .img, or .nii. Version 4.0.0 fixes the issue.
Fix within
Internet-facing 14 days
Internal 60 days
  • Not known to be exploited
  • Can be exploited automatically
  • Gives an attacker partial control
Severity
7.5 High
Exploitation
<1% chance of attack within 30 days
Type
CWE-401Memory Leak
CWE-789Memory Allocation with Excessive Size Value
CWE-1284Improper Validation of Specified Quantity in Input
Timeline
Published21 Jul 2026
Updated4 Nov 2026
First seen21 Jul 2026
Track software like this
Free during beta