CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- No fix listed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA. Impact type from CWE-789.
Summary
CImg Library is a C++ library for image processing. Prior to commit c3aacf5, the nb_colors field read from the BMP file header is used directly to compute an allocation size without validating it against the remaining file size. A crafted BMP file with a large nb_colors value triggers an out-of-memory condition, crashing any application that uses CImg to load untrusted BMP files. This issue has been patched via commit c3aacf5.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- 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
No fixed version listed by the sources yet.
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-42146
References
More GreycLab vulnerabilities
- TI-2026-35174 CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header CVSS 3.1HIGH 7.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-42146 · CVE Program
- CVE-2026-42146 · NVD
- FIRST EPSS
- CVE-2026-42146 · 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