Accusoft ImageGear ICO ico_read buffer size computation code execution vulnerability
A specially crafted ICO file can trigger an integer overflow in the ico_read function of Accusoft ImageGear, causing an out-of-bounds write. An attacker could exploit this memory corruption to execute arbitrary code.
Originally disclosed on Cisco Talos
An exploitable out-of-bounds write vulnerability exists in the icoread function of the igcore19d.dll library of Accusoft ImageGear 19.6.0. A specially crafted ICO 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
Likely an integer overflow in the size calculation for buffer_1, where multiplying a large integer_value by 8 wraps around, resulting in a smaller buffer than the data copied into it.
Impact
An attacker could exploit this memory corruption to execute arbitrary code.
What the attacker needed
Victim opens a malformed ICO file
The fix
The vendor patched the vulnerability, likely by adding proper bounds checks or using safe integer arithmetic in the size calculation.
How it was found
- Craft an ICO file with manipulated biBitCount and biWidth values.
- Load the malformed ICO file using the IG_load_file function.
- The ico_read function computes a buffer size that overflows, allocating a smaller buffer_1.
- During the copy loop, data from buffer_3 is written past the end of buffer_1, causing an 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 a program reads an image file, it calculates how much memory to reserve based on numbers in the file. If those numbers are huge, the calculation can wrap around and reserve a much smaller buffer than needed. The program then writes more data than fits, corrupting memory and potentially letting an attacker 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.