CVE-2026-47667 CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: yes · technical impact: partial
- Technology
- UbuntuDebian
Description
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.
Upgrade path
8 packages: 1 fixed, 6 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/cimg(Debian 12) | = 3.2.1+dfsg-1; = 3.2.1+dfsg-2; = 3.5.0+dfsg-1; = 3.5.2+dfsg-1 +3 more | No fix listed | No fix yet |
| debian/cimg(Debian 13) | = 3.5.2+dfsg-1; = 3.5.2+dfsg-1+deb13u1; = 3.5.2+dfsg-2; = 4.0.4+dfsg-1 +1 more | No fix listed | No fix yet |
| ubuntu/cimg(Ubuntu 22.04) | All versions | No fix listed | No fix yet |
| ubuntu/cimg(Ubuntu 24.04) | All versions | No fix listed | No fix yet |
| ubuntu/cimg(Ubuntu 26.04) | All versions | No fix listed | No fix yet |
| ubuntu/cimg(Ubuntu 26.10) | All versions | No fix listed | No fix yet |
| debian/cimg(Debian 14) | < 4.0.4+dfsg-1; = 3.5.2+dfsg-1; = 3.5.2+dfsg-2 | 4.0.4+dfsg-1 | Fixed |
| GreycLab CImg | = < 4.0.0 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| GreycLab CImg | = < 4.0.0 | No fix listed |
| debian/cimg(Debian:12) | All versions | No fix listed |
| debian/cimg(Debian:12) | = 3.2.1+dfsg-1 | No fix listed |
| debian/cimg(Debian:12) | = 3.2.1+dfsg-2 | No fix listed |
| debian/cimg(Debian:12) | = 3.5.0+dfsg-1 | No fix listed |
| debian/cimg(Debian:12) | = 3.5.2+dfsg-1 | No fix listed |
| debian/cimg(Debian:12) | = 3.5.2+dfsg-2 | No fix listed |
| debian/cimg(Debian:12) | = 4.0.4+dfsg-1 | No fix listed |
| debian/cimg(Debian:13) | All versions | No fix listed |
| debian/cimg(Debian:13) | = 3.5.2+dfsg-1 | No fix listed |
| debian/cimg(Debian:13) | = 3.5.2+dfsg-1+deb13u1 | No fix listed |
| debian/cimg(Debian:13) | = 3.5.2+dfsg-2 | No fix listed |
| debian/cimg(Debian:13) | = 4.0.4+dfsg-1 | No fix listed |
| debian/cimg(Debian:14) | < 4.0.4+dfsg-1 | 4.0.4+dfsg-1 |
| debian/cimg(Debian:14) | = 3.5.2+dfsg-1 | No fix listed |
| debian/cimg(Debian:14) | = 3.5.2+dfsg-2 | No fix listed |
| ubuntu/cimg(Ubuntu:22.04) | All versions | No fix listed |
| ubuntu/cimg(Ubuntu:24.04) | All versions | No fix listed |
| ubuntu/cimg(Ubuntu:26.04) | All versions | No fix listed |
| ubuntu/cimg(Ubuntu:26.10) | All versions | No fix listed |
References
- https://github.com/GreycLab/CImg/security/advisories/GHSA-rmfc-grgj-qwhv
- https://github.com/GreycLab/CImg/issues/480 exploit
- https://github.com/GreycLab/CImg/commit/6a69bf725ffd111a4c7dc61cc15e3661abd158ee
- Debian Security Tracker CVE-2026-47667 vendor-advisory
- bugs.debian.org issue-tracking
- Ubuntu CVE tracker vendor-advisory
- www.cve.org