Accusoft ImageGear create_png_object heap-based buffer overflow vulnerability
A specially crafted PNG file with a width value of 3 and some missing tags causes a heap-based buffer overflow in the create_png_object function of Accusoft ImageGear 20.1. An attacker could supply a malicious file to corrupt heap memory, potentially leading to code execution or a crash.
Originally disclosed on Cisco Talos
A heap-based buffer overflow vulnerability exists in the createpngobject functionality of Accusoft ImageGear 20.1. A specially crafted malformed file can lead to memory corruption.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an unsigned underflow in the loop condition `__size_buffer - 3 <= dVar6` when the raster size is 3, causing the loop to run indefinitely and write past the allocated buffer.
Impact
An attacker could cause heap memory corruption, which may lead to a crash or potentially code execution, though the CVSS score rates confidentiality and availability impact as low.
What the attacker needed
Victim opens a malicious PNG file; ImageGear 20.1 library in use
How it was found
- Open a malformed PNG file with the ImageGear library.
- The file has a width value of 3 and some PNG tags missing.
- The raster size is computed as 3, and the loop condition underflows, so the loop never terminates.
- The loop writes zero bytes past the end of the heap buffer until it corrupts adjacent heap metadata.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
ImageGear is a library that programs use to open and convert image files. When it reads a PNG image, it reserves a small area of memory for the image data, but a flaw in a loop means it can keep writing past the end of that area. This is called a buffer overflow, and it can crash the program or let an attacker take control of it.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.