CVE-2021-42716 json
An issue was discovered in stb stb_image.h 2.27.
published 2021-10-21 5 y ago modified 2026-06-17 4 mo ago also EUVD-2021-29676
- cvss
- 7.1
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.5%
- EPSS 1.5% chance of exploitation in 30 days, percentile 73%
- public exploits
- 0
- none known
Summary
An issue was discovered in stb stb_image.h 2.27. The PNM loader incorrectly interpreted 16-bit PGM files as 8-bit when converting to RGBA, leading to a buffer overflow when later reinterpreting the result as a 16-bit buffer. An attacker could potentially have crashed a service using stb_image, or read up to 1024 bytes of non-consecutive heap data without control over the read location.
Patch / fix
- libstb Debian 14, Debian 13 0.0~git20230129.5736b15+ds-1
debian advisories DEBIAN-CVE-2021-42716
- zxing-cpp SLE Workstation Extension 12 SP5, SLE Software Development Kit 12 SP5 1.2.0-8.6.1
- zxing-cpp SLE Workstation Extension 15 SP3, SLE Module for Package Hub 15 SP3 1.2.0-9.7.1
suse advisories SUSE-SU-2022:0163-1SUSE-SU-2022:0157-1
- zxing-cpp openSUSE Leap 15.3 1.2.0-9.7.1
- stb Package Hub 15 SP3, openSUSE Leap 15.3 2.32.1549563867.59e9702-bp153.2.3.1
opensuse advisories openSUSE-SU-2022:0157-1openSUSE-SU-2022:0018-1
- github.com/nothings/stb#1223 pull request
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-42716 updated cvss 8.0
stb: heap-based buffer overflow in stb_image PNM loader
-
Red Hat Enterprise Linux 6 clutteraffected: no fix planned “Out of support scope”
-
Red Hat Enterprise Linux 7 cogl, compat-libcogl12, compat-libcogl-pango12 Red Hat Enterprise Linux 8 coglnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
1.46% chance of exploitation in the next 30 days, higher than 73% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/nothings/stb/issues/1166 referenced PoC, tagged "exploit" by a source, unverified
- github.com https://github.com/nothings/stb/issues/1225 referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| NVD | 3.1 | 7.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H |
| NVD | 2.0 | 5.8 | AV:N/AC:M/Au:N/C:P/I:N/A:P |
Classification
- Weakness
-
- CWE-120 Buffer Copy without Checking Size of Input
References
-
github.com
/nothings/stb/pull/1223
third-party-advisory
-
github.com
/nothings/stb/issues/1166
exploit, issue-tracking, third-party-advisory
-
github.com
/nothings/stb/issues/1225
exploit, issue-tracking, third-party-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/G2M5CRSGPRF7G3YB5CLU4FXW7ANNHAYT/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/ID6II3RIKAMVGVMC6ZAQIXXYYDMTVC4N/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/BEGXBDEMTFGINETMJENBZ6SCHVEJQJSY/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/CI23LXPEV2GCDQTJSKO6CIILBDTI3R42/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/FTZXHFZD36BGE5P6JF252NZZLKMGCY4T/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/VP2YEXEAJWI76FPM7D7VXHWD3WESQEYC/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/3TDGZFLBOP27LZKLH45WQLSNPSPP7S7Z/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/AF2CNP4FVC6LDKNOO4WDCGNDYIP3MPK6/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/TXX76TJMZBPN3NU542MGN6B7C7QHRFGB/
vendor-advisory
Sources
- CVE List CVE-2021-42716
- NVD CVE-2021-42716
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.