Accusoft ImageGear PNG pngread width code execution vulnerability
A specially crafted PNG file causes an out-of-bounds write in the ImageGear PNG parser because the buffer size is calculated from an attacker-controlled width value. An attacker could use this memory corruption to achieve remote code execution when a victim loads the malformed file.
Originally disclosed on Cisco Talos
An exploitable out-of-bounds write vulnerability exists in the igcore19d.dll PNG pngread parser of the Accusoft ImageGear 19.5.0 library. A specially crafted PNG file can cause an out-of-bounds write, resulting in a remote code execution.
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
The buffer size is computed as four times the file-supplied width plus sixteen, and the write routine never checks that the buffer is large enough before writing several values into it.
Impact
Memory corruption from the out-of-bounds write could lead to remote code execution when a victim opens the crafted file.
What the attacker needed
Victim opens a crafted PNG file; attacker supplies the malformed file
How it was found
- Open a malformed PNG file through the library's file-loading function.
- The parser reads the width value directly from the file header.
- The buffer is allocated using a size derived from that width, which can be tiny.
- The write routine stores values past the end of the buffer, causing memory corruption.
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, it trusts a width number stored in the file to decide how much memory to reserve, but a huge or negative number makes that calculation wrong. The program then writes past the end of the small buffer, corrupting memory, which an attacker can use to run their own code.
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.