Vulnerability · Published May 4, 2026 · Assigned by GitHub_M

CVE-2026-42146CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp

Medium 5.5

In plain English

A medium-severity security flaw in CImg from GreycLab. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 8% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)5.5Medium
Exploit odds (30 days)0.2%top 92.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12cimgno fix listedDEBIAN-CVE-2026-42146
Debian:13cimg3.5.2+dfsg-1+deb13u1DEBIAN-CVE-2026-42146
Debian:14cimg3.5.2+dfsg-2DEBIAN-CVE-2026-42146
Ubuntu:25.10cimgno fix listedUBUNTU-CVE-2026-42146
Ubuntu:26.04:LTScimgno fix listedUBUNTU-CVE-2026-42146
Ubuntu:26.10cimgno fix listedUBUNTU-CVE-2026-42146

Affected products (as reported)

VendorProductVersions
GreycLab CImg < c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3

Weakness: CWE-789 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

References