libpng Heap-Based Buffer Overflow Vulnerability in pnm2png Component

Vulnerability

A heap-based buffer overflow vulnerability has been identified in the libpng library, specifically in versions through 1.6.55. The issue arises in the pnm2png component, within the do_pnm2png function of contrib/pngminus/pnm2png.c. The vulnerability is caused by an integer overflow when the program processes width and height values from the PNM file header. This overflow allows for attacker-controlled values to be used, leading to a heap-based buffer overflow during the image conversion process. The vulnerability requires local execution to exploit.

Impact

Exploitation of this vulnerability leads to a heap-based buffer overflow, where the buffer overflow occurs in the heap memory, typically allowing for more severe consequences compared to stack-based overflows.

Reproduction

The vulnerability can be reproduced by compiling the libpng library with AddressSanitizer enabled, which can be done using CMake. After compiling, the pnm2png tool can be executed with a crafted PNM file that exploits the integer overflow by using specific width and height values. The AddressSanitizer will detect the heap-buffer-overflow error, confirming the successful exploitation of the vulnerability.

Added: Mar 8, 2026, 6:19 AM
Updated: Mar 8, 2026, 6:19 AM

Vulnerability Rating

Custom Algorithm
spread
9.0
impact
2.5
exploitability
4.2
remediation
0.0
relevance
3.8
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.