# CVE-2026-47667: CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.61%, higher than 43% of CVEs (2026-11-30)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-07-21T19:57:49.446Z
- Modified: 2026-10-24T19:10:00.127Z
- Weaknesses: CWE-401, CWE-789, CWE-1284
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- GreycLab CImg: < 4.0.0

## References

- <https://github.com/GreycLab/CImg/issues/480> (exploit)
- <https://github.com/GreycLab/CImg/security/advisories/GHSA-rmfc-grgj-qwhv>
- <https://github.com/GreycLab/CImg/commit/6a69bf725ffd111a4c7dc61cc15e3661abd158ee>

## Sources

- CVE List: [CVE-2026-47667](https://www.cve.org/CVERecord?id=CVE-2026-47667), CVE Terms of Use, modified 2026-07-23
- NVD: [CVE-2026-47667](https://nvd.nist.gov/vuln/detail/CVE-2026-47667), Public domain, modified 2026-10-24

---

Page: https://cve.day/CVE-2026-47667 · Whole record: https://cve.day/CVE-2026-47667.json · Rebuilt by cve.day 2026-11-25T22:59:29.390Z
