CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA. Impact type from CWE-401.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
Remediation
- Fix · CNA CImg (GreycLab) Fixed in 4.0.0
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-47667
References
More GreycLab vulnerabilities
- TI-2026-30477 CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp CVSS 3.1MEDIUM 5.5
- TI-2026-81159 Heap out-of-bounds read in GreycLab CImg BMP loader CVSS 4.0MEDIUM 6.9
- TI-2026-30475 CImg Library: Integer overflow in PNM size check bypasses memory guard (_load_pnm) CVSS 3.1MEDIUM 6.1
Sources
- CVE-2026-47667 · CVE Program
- CVE-2026-47667 · NVD
- FIRST EPSS
- CVE-2026-47667 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences