CVE-2026-33416

LIBPNG has use-after-free via pointer aliasing in `png_set_tRNS` and `png_set_PLTE`

Published Mar 26, 2026 CVSS 3.1 · 7.5 High EPSS 1.1% KEV · Not listed
Description
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, `png_set_tRNS` and `png_set_PLTE` each alias a heap-allocated buffer between `png_struct` and `png_info`, sharing a single allocation across two structs with independent lifetimes. The `trans_alpha` 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 `png_set_tRNS` sets `png_ptr->trans_alpha = info_ptr->trans_alpha` (256-byte buffer) and `png_set_PLTE` sets `info_ptr->palette = png_ptr->palette` (768-byte buffer). In both cases, calling `png_free_data` (with `PNG_FREE_TRNS` or `PNG_FREE_PLTE`) frees the buffer through `info_ptr` while the corresponding `png_ptr` pointer remains dangling. Subsequent row-transform functions dereference and, in some code paths, write to the freed memory. A second call to `png_set_tRNS` or `png_set_PLTE` has the same effect, because both functions call `png_free_data` internally before reallocating the `info_ptr` buffer. Version 1.6.56 fixes the issue.

Analysis

AI-generated

Technical impact

The vulnerability in libpng stems from pointer aliasing between the png_struct and png_info structures when calling png_set_tRNS and png_set_PLTE. These functions share a single heap allocation for the trans_alpha and palette buffers, respectively. When png_free_data frees the buffer via one struct, the other struct’s pointer remains dangling. Subsequent row‑transform functions may dereference or even write to this freed memory, which can corrupt the heap and potentially enable an attacker to execute arbitrary code. The flaw is classified as CWE‑416 and, due to the memory corruption risk, also CWE‑825.

Affected Systems

libpng versions 1.2.1 through 1.6.55 released by pnggroup are affected. Any application that links against these libpng releases and processes PNG files containing tRNS or PLTE chunks is at risk. The defect is present in all historical release lines up to 1.6.55; version 1.6.56 resolves the issue.

Risk and Exploitability

The CVSS score of 7.5 indicates high severity, while the EPSS score of 1% suggests that exploitation is currently improbable. The vulnerability is not listed in the CISA KEV catalog. Based on the description, it is inferred that an attacker can trigger the flaw by supplying a crafted PNG file that includes malformed tRNS or PLTE chunks. If the target application accepts external images—such as via a network service, file upload interface, or local file processing—the attacker can provoke a use‑after‑free during subsequent image processing, potentially leading to denial of service or arbitrary code execution dependent on the privileges of the running process.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade libpng to version 1.6.56 or later.
  • Rebuild all applications or libraries that link against the older libpng releases to use the updated version.
  • If an upgrade is not immediately possible, modify image‑processing logic to validate or reject untrusted PNG files and consider disabling processing of tRNS or PLTE chunks for external images.

Generated by OpenCVE AI on June 18, 2026 at 09:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4521-1 libpng1.6 security update
Debian DSA Debian DSA DSA-6189-1 libpng1.6 security update
Ubuntu USN Ubuntu USN USN-8251-1 libpng vulnerabilities
History
Type Values Removed Values Added
First Time appeared Libpng
Libpng libpng
CPEs cpe:2.3:a:libpng:libpng:*:*:*:*:*:*:*:*
Vendors & Products Libpng
Libpng libpng
Type Values Removed Values Added
First Time appeared Pnggroup
Pnggroup libpng
Vendors & Products Pnggroup
Pnggroup libpng
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description 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, `png_set_tRNS` and `png_set_PLTE` each alias a heap-allocated buffer between `png_struct` and `png_info`, sharing a single allocation across two structs with independent lifetimes. The `trans_alpha` 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 `png_set_tRNS` sets `png_ptr->trans_alpha = info_ptr->trans_alpha` (256-byte buffer) and `png_set_PLTE` sets `info_ptr->palette = png_ptr->palette` (768-byte buffer). In both cases, calling `png_free_data` (with `PNG_FREE_TRNS` or `PNG_FREE_PLTE`) frees the buffer through `info_ptr` while the corresponding `png_ptr` pointer remains dangling. Subsequent row-transform functions dereference and, in some code paths, write to the freed memory. A second call to `png_set_tRNS` or `png_set_PLTE` has the same effect, because both functions call `png_free_data` internally before reallocating the `info_ptr` buffer. Version 1.6.56 fixes the issue.
Title LIBPNG has use-after-free via pointer aliasing in `png_set_tRNS` and `png_set_PLTE`
Weaknesses CWE-416
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Apr 1, 2026, 3:55 AM
Reserved
Mar 19, 2026, 5:02 PM
Status
Analyzed
Published
Mar 26, 2026, 5:16 PM
Modified
Jun 17, 2026, 10:37 AM
Severity
Moderate
Public date
Mar 26, 2026, 4:48 PM