Skip to content
Memory corruption Advisory Advanced CVE-2021-21782

Accusoft ImageGear SGI format buffer size processing out-of-bounds write vulnerability

The SGI image parser in Accusoft ImageGear 19.8 allocates a heap buffer using a size value taken straight from the file header, then copies file-controlled data into it without checking bounds. A crafted SGI file can therefore cause a heap out-of-bounds write, leading to memory corruption and possibly code execution.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

An out-of-bounds write vulnerability exists in the SGI format buffer size processing functionality of Accusoft ImageGear 19.8. A specially crafted malformed file can lead to memory corruption.

Emmanuel Tacheau and a member, 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

The allocation size is taken directly from the SGI header XSIZE field and the subsequent copy length is derived from file data, with no bounds checking between them.

Impact

A malicious file could corrupt heap memory and possibly achieve code execution; the report rates it 9.8 with no user interaction beyond opening the file.

What the attacker needed

Victim opens a crafted SGI file; ImageGear 19.8 used to parse it

The fix

The vendor patched the issue; the parser should validate the header size against the actual data length before allocating and copying.

How it was found

  1. Craft an SGI file whose header sets the XSIZE value, for example to zero, so the allocated buffer is tiny.
  2. Set the file data bytes that control the size argument of the copy operation.
  3. Open the malformed file with ImageGear so the SGI parser runs.
  4. Observe the copy writing past the end of the allocated buffer, corrupting the heap.

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 toolkit that opens many image formats. When it reads an SGI image, it trusts a size number written in the file to decide how much memory to reserve, then copies more data than that into the same space. Writing past the end of reserved memory (a heap overflow) can crash the program or 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 Emmanuel Tacheau

View all

6 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.