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

Accusoft ImageGear SGI Format Buffer Size Processing out-of-bounds write vulnerability

An out-of-bounds write vulnerability exists in the SGI format parsing of Accusoft ImageGear 19.8. A specially crafted SGI file can cause a heap buffer overflow, potentially leading to 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 buffer size is calculated from the SGI header's xsize field, but the memcpy size is taken directly from the file body without bounds checking, leading to a heap overflow.

Impact

This out-of-bounds write causes a heap corruption where size and source can be partially controlled by the attacker, possibly leading to code execution.

What the attacker needed

Victim opens a malicious SGI file

The fix

The vendor patched the vulnerability, likely by adding bounds checking on the memcpy size.

How it was found

  1. Craft an SGI file with a small xsize value (e.g., 1) in the header.
  2. Set the file body to contain a large size value for the memcpy operation.
  3. Open the file with ImageGear, causing the memcpy to write beyond the allocated buffer.

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 the software opens a special image file, it sets aside a small memory space based on a number from the file. Later, it copies data into that space using a size also taken from the file, without checking if it fits. This can overwrite other memory and 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.