Accusoft ImageGear TIFF fill_in_raster buffer copy operation code execution vulnerability
An integer overflow in the size calculation for a TIFF raster buffer causes a heap buffer to be allocated too small, and a later fill loop writes past its end. A specially crafted TIFF file could therefore trigger an out-of-bounds write that may lead to remote code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the TIFF fillinraster function of the igcore19d.dll library of Accusoft ImageGear 19.4, 19.5 and 19.6. A specially crafted TIFF file can cause an out-of-bounds write, resulting in 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
Likely the buffer size formula multiplies attacker-controlled width, samples-per-pixel and colour depth without checking for integer overflow, so a small allocation is made while the fill loop still uses the large product as its bound.
Impact
A crafted TIFF file could cause an out-of-bounds write and potentially remote code execution; the report does not describe any mitigation that would block it.
What the attacker needed
Victim opens a crafted TIFF file; application uses ImageGear 19.4-19.6
The fix
The size calculation should be fixed to detect integer overflow and reject or safely handle such TIFF files; the vendor patched it according to the timeline.
How it was found
- Craft a TIFF file whose SamplesPerPixel and ImageWidth tags produce an overflowing size calculation.
- Open the crafted TIFF with the ImageGear library so the raster buffer is allocated using the overflowed size.
- The fill_in_raster loop then writes past the end of the undersized heap buffer.
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.
Image software often calculates how much memory to reserve by multiplying numbers taken from the file itself. If that multiplication overflows, the program reserves far too little memory, and then copies more data into it than fits, corrupting nearby memory. An attacker who can supply a malicious image file may be able to abuse this 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.