CVE-2026-42146
CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
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.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
5.5
CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
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.
- Record
CVE-2026-42146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-789
- Updated
- 2026-11-02
EUVDEUVD-2026-27077
5.5
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.
- Record
EUVD-2026-27077- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
NVD
5.5
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.
- Record
CVE-2026-42146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-789
- Updated
- 2026-11-02
OSV
5.5
CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
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.
- Record
CVE-2026-42146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-789
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-42146
5.5
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.
- Record
DEBIAN-CVE-2026-42146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-42146
5.5
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.
- Record
UBUNTU-CVE-2026-42146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
cimgDebian:12 |
All versions, plus listed versions 3.2.1+dfsg-13.2.1+dfsg-23.5.0+dfsg-13.5.2+dfsg-13.5.2+dfsg-24.0.4+dfsg-1 |
None known |
cimgDebian:13 |
before 3.5.2+dfsg-1+deb13u1, plus listed versions 3.5.2+dfsg-1 |
3.5.2+dfsg-1+deb13u1 |
cimgDebian:14 |
before 3.5.2+dfsg-2, plus listed versions 3.5.2+dfsg-1 |
3.5.2+dfsg-2 |
cimgUbuntu:16.04:LTS |
All versions, plus listed versions 1.6.4+dfsg-1build11.6.5+dfsg-1 |
None known |
cimgUbuntu:Pro:18.04:LTS |
All versions, plus listed versions 1.7.9+dfsg-21.7.9+dfsg-2build11.7.9+dfsg-2ubuntu0.18.04.11.7.9+dfsg-2ubuntu0.18.04.21.7.9+dfsg-2ubuntu0.18.04.2+esm1 |
None known |
cimgUbuntu:20.04:LTS |
All versions, plus listed versions 2.4.5+dfsg-1 |
None known |
cimgUbuntu:Pro:22.04:LTS |
All versions, plus listed versions 2.9.4+dfsg-22.9.4+dfsg-32.9.4+dfsg-3ubuntu0.1~esm1 |
None known |
cimgUbuntu:Pro:24.04:LTS |
All versions, plus listed versions 3.2.1+dfsg-13.2.1+dfsg-1ubuntu0.24.04.1~esm1 |
None known |
cimgUbuntu:25.10 |
All versions, plus listed versions 3.5.2+dfsg-1 |
None known |
cimgUbuntu:26.10 |
All versions, plus listed versions 3.5.2+dfsg-1build13.5.2+dfsg-2 |
None known |
cimgUbuntu:26.04:LTS |
All versions, plus listed versions 3.5.2+dfsg-13.5.2+dfsg-1build1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-42146 is a medium vulnerability (CVSS 5.5) in Greyclab Cimg, published May 4, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.18%, the 7th percentile. Fixed in cimg 3.5.2+dfsg-1+deb13u1.
References
github.com/GreycLab/CImg/security/advisories/GHSA-g54r-qmgx-c6fv
github.com/GreycLab/CImg/issues/477
github.com/GreycLab/CImg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3
github.com/GreycLab/CImg/releases/tag/v.3.7.5
github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42146.json
nvd.nist.gov/vuln/detail/CVE-2026-42146
security-tracker.debian.org/tracker/CVE-2026-42146
ubuntu.com/security/CVE-2026-42146
cve.org/CVERecord?id=CVE-2026-42146