Accusoft ImageGear PICT parsing pctwread_14841 out-of-bounds write vulnerability
A missing buffer size check in the PICT parsing code of Accusoft ImageGear 20.0 allows a crafted PICT file to cause an out-of-bounds heap write. An attacker could supply a malicious file to corrupt memory, potentially leading to code execution.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the PICT parsing pctwread14841 functionality of Accusoft ImageGear 20.0. 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 a missing minimum-size check: the raster size is computed from a height field taken from the file, and when that height is zero the buffer is allocated at 1 byte while the copy loop still uses a length read from the file.
Impact
The out-of-bounds heap writes lead to memory corruption and possibly code execution.
What the attacker needed
Victim opens a crafted PICT file; file must be PICT v2 extended type
The fix
The vendor released a patch, though the text does not describe what the patch changed.
How it was found
- Open a crafted PICT v2 extended file with the library.
- The file uses the DirectBitsRect or PackBitsRect opcode.
- The frame rectangle has equal top and bottom values, so the computed height is zero.
- The raster buffer is allocated at 1 byte, then the copy routine writes past it.
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 reads many image formats, including the old Macintosh PICT format. When it reads a PICT file, it calculates how big a memory buffer should be, but a malformed file can make that calculation come out as zero, so a tiny buffer is allocated. The program then copies far more data into that small buffer, writing past its end and corrupting other memory.
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.