Accusoft ImageGear BMP code execution vulnerability
A specially crafted BMP file causes an out-of-bounds write in the ImageGear BMP parser because the destination buffer size calculation overflows to zero while the width field is huge. An attacker could supply a malformed file to a victim to corrupt memory and potentially achieve remote code execution.
Originally disclosed on Cisco Talos
An exploitable out-of-bounds write vulnerability exists in the igcore19d.dll BMP parser of the ImageGear 19.3.0 library. A specially crafted BMP 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 destination buffer size calculation combined with a signed comparison in the size check, so a huge biWidth value passes validation and the write loop overruns the small allocation.
Impact
Memory corruption from the out-of-bounds write could allow an attacker to achieve remote code execution.
What the attacker needed
Victim opens a malformed BMP file; attacker supplies the crafted file
The fix
The vendor patched the vulnerability, presumably by correcting the size calculation and the signed comparison.
How it was found
- Load a malformed BMP file through the IG_load_file function.
- The parser reads the biWidth field from the file and computes the destination buffer size, which overflows to zero.
- The size check is bypassed because the signed comparison sees a negative value.
- The write loop iterates over the huge width and writes past the end of the small buffer, causing an access violation.
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 BMP image, it works out how much memory to reserve for the converted picture, but a huge width value makes that calculation wrap around to zero, so it reserves almost nothing. It then keeps writing pixel data past the end of that tiny buffer, corrupting memory, which can let 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.