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

Accusoft ImageGear Palette box parser heap-based buffer overflow vulnerability

A heap-based buffer overflow exists in the Palette box parser of Accusoft ImageGear 19.10 due to an off-by-one error in calculating the number of bits required for the NE field. An attacker can provide a malicious JPEG 2000 file to trigger the overflow, potentially leading to code execution.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

A heap-based buffer overflow vulnerability exists in the Palette box parser functionality of Accusoft ImageGear 19.10. A specially-crafted file can lead to code execution.

Emmanuel Tacheau and Francesco Benvenuto, 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 off-by-one error in the bit-required calculation: the code right-shifts the NE field before checking for zero, so it counts one bit fewer than needed, leading to an undersized heap allocation.

Impact

An attacker could exploit this to execute arbitrary code in the context of the application, as indicated by the CVSS score of 9.8, though the report only demonstrates a crash.

What the attacker needed

Victim opens a malicious JPEG 2000 file; application uses vulnerable ImageGear library

The fix

The off-by-one error in the bit-required calculation should be fixed by comparing the value to zero before shifting, ensuring the correct buffer size is allocated.

How it was found

  1. Craft a malformed JPEG 2000 file with a Palette box where the NE field requires more bits than the off-by-one calculation accounts for.
  2. Load the file using the ImageGear library (e.g., via IG_load_file).
  3. The parser computes the palette buffer size using the flawed bit count, allocating a buffer that is too small.
  4. A memcpy copies the palette data into the undersized buffer, causing a heap-based buffer overflow.

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.

This report describes a memory corruption bug in an image processing library. When the library opens a specially crafted JPEG 2000 image, it miscalculates how much memory to reserve for a colour palette, so it writes more data than the buffer can hold. This can crash the program or, in the worst case, 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 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.