CVE-2026-33416: LIBPNG has use-after-free via pointer aliasing in `png_set_tRNS` and `png_set_PLTE`
LIBPNG has use-after-free via pointer aliasing in pngsettRNS and pngsetPLTE
Other sources
LIBPNG is a reference library for use in applications that read, create, and manipulate PNG (Portable Network Graphics) raster image files. In versions 1.2.1 through 1.6.55, pngsettRNS and pngsetPLTE each alias a heap-allocated buffer between pngstruct and pnginfo, sharing a single allocation across two structs with independent lifetimes. The transalpha aliasing has been present since at least libpng 1.0, and the palette aliasing since at least 1.2.1. Both affect all prior release lines pngsettRNS sets pngptr->transalpha = infoptr->transalpha (256-byte buffer) and pngsetPLTE sets infoptr->palette = pngptr->palette (768-byte buffer). In both cases, calling pngfreedata (with PNGFREETRNS or PNGFREEPLTE) frees the buffer through infoptr while the corresponding pngptr pointer remains dangling. Subsequent row-transform functions dereference and, in some code paths, write to the freed memory. A second call to pngsettRNS or pngsetPLTE has the same effect, because both functions call pngfreedata internally before reallocating the infoptr buffer. Version 1.6.56 fixes the issue.
— MITRE
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2026-33416?
CVE-2026-33416 has been classified as a high severity vulnerability due to its potential for exploitation via a use-after-free condition.
How do I fix CVE-2026-33416?
To fix CVE-2026-33416, update to a version of libpng later than 1.6.55, ensuring you are utilizing a patched release.
Which versions of libpng are affected by CVE-2026-33416?
CVE-2026-33416 affects libpng versions from 1.2.1 through 1.6.55.
What are the consequences of exploiting CVE-2026-33416?
Exploitation of CVE-2026-33416 can lead to arbitrary code execution or denial of service due to the use-after-free vulnerability.
How does the use-after-free in CVE-2026-33416 occur?
The use-after-free in CVE-2026-33416 occurs due to pointer aliasing in the functions png_set_tRNS and png_set_PLTE, leading to potential memory corruption.