CVE-2026-42146 CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
MediumCVSS 5.5
EPSS 0.18%
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: no · technical impact: partial
- Technology
- UbuntuDebian
Description
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.
Upgrade path
8 packages: 2 fixed, 5 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 |
| 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 13) | < 3.5.2+dfsg-1+deb13u1; = 3.5.2+dfsg-1 | 3.5.2+dfsg-1+deb13u1 | Fixed |
| debian/cimg(Debian 14) | < 3.5.2+dfsg-2; = 3.5.2+dfsg-1 | 3.5.2+dfsg-2 | Fixed |
| GreycLab CImg | = < c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| GreycLab CImg | = < c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 | 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) | < 3.5.2+dfsg-1+deb13u1 | 3.5.2+dfsg-1+deb13u1 |
| debian/cimg(Debian:13) | = 3.5.2+dfsg-1 | No fix listed |
| debian/cimg(Debian:14) | < 3.5.2+dfsg-2 | 3.5.2+dfsg-2 |
| debian/cimg(Debian:14) | = 3.5.2+dfsg-1 | 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-g54r-qmgx-c6fv
- https://github.com/GreycLab/CImg/issues/477 exploit
- https://github.com/GreycLab/CImg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3
- https://github.com/GreycLab/CImg/releases/tag/v.3.7.5
- Debian Security Tracker CVE-2026-42146 vendor-advisory
- Ubuntu CVE tracker vendor-advisory
- www.cve.org
- bugs.debian.org issue-tracking