CImg Library Memory Management Vulnerability in Image Processing Software by GreycLab
CVE-2026-47667
What is CVE-2026-47667?
The CImg Library, a popular C++ library used for image processing, contains a memory allocation flaw due to improper handling of the header size field when processing Analyze/NIfTI files. In versions prior to 4.0.0, the header_size is read as an unsigned int from the file's initial bytes and subsequently used to allocate memory without checking the actual file size. This oversight can allow crafted files, containing as little as 6 bytes of data, to trigger excessive memory allocation of around 1.3 GB per call, leading to a memory leak since the allocated memory is not freed on errors. The vulnerability can be exploited via the functions load_analyze() and load(), with specific file extensions like .hdr, .img, or .nii. This significant flaw emphasizes the need for developers to upgrade to version 4.0.0 or higher to mitigate the risks associated with this memory management issue.
Affected Version(s)
CImg < 4.0.0
