Skip to content
Memory corruption Advisory Advanced CVE-2019-5133

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.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

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.

Marcin 'Icewall' Noga, on Cisco Talos

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

  1. Load a malformed BMP file through the IG_load_file function.
  2. The parser reads the biWidth field from the file and computes the destination buffer size, which overflows to zero.
  3. The size check is bypassed because the signed comparison sees a negative value.
  4. 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.

More by Marcin 'Icewall' Noga

View all

146 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.