Accusoft ImageGear SGI RLE decompression out-of-bounds write vulnerability
A missing size check in the SGI RLE decompression of Accusoft ImageGear 19.8 allows a crafted file to cause an out-of-bounds write via a memcpy, potentially leading to code execution.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the SGI RLE decompression functionality of Accusoft ImageGear 19.8. A specially crafted malformed file can lead to 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 program reads a length value from the file and uses it to copy data into a buffer without checking that the length does not exceed the buffer's size.
Impact
A specially crafted file can cause an out-of-bounds write, leading to memory corruption and possibly code execution.
What the attacker needed
RLE compression used; zsize >= 4; negative starttab entry; rlelength > scanline size
The fix
The vendor patched the vulnerability, likely by adding a check that the read length does not exceed the allocated buffer size.
How it was found
- Craft an SGI file with RLE compression enabled.
- Set the zsize (number of channels) to 4 or more.
- Place a negative value in the starttab table for the rleoffset.
- Set the rlelength to a value larger than the scanline size.
- Ensure the file size is larger than the scanline size.
- Open the file with the vulnerable library to trigger the out-of-bounds write.
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.
When an image file is opened, the program reads compressed data into a fixed-size buffer. If the file claims the data is larger than the buffer, the program writes past the end of the buffer, corrupting memory. An attacker can craft such a file to crash the program or 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.