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

Accusoft ImageGear JPG Handle_JPEG420 out-of-bounds write vulnerability

A malformed JPG file can cause an out-of-bounds write in the handle_JPEG420 function of Accusoft ImageGear 19.9 due to a missing size check on a buffer. An attacker could exploit this to corrupt memory, potentially leading to code execution.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

High 8.1 View original

An out-of-bounds write vulnerability exists in the JPG HandleJPEG420 functionality of Accusoft ImageGear 19.9. A specially crafted malformed file can lead to memory corruption.

Emmanuel Tacheau, 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 size of the raster buffer is calculated using values from the JPG file (component count, precision, width) without proper validation, and the write loop uses a width that can exceed the allocated size.

Impact

An attacker could cause memory corruption, potentially leading to code execution or a crash.

What the attacker needed

Victim opens a malicious JPG file

The fix

The vulnerability was fixed by the vendor in version 19.9 (patched on 2021-05-31).

How it was found

  1. Craft a malformed JPG file with an invalid number of components in the SOF0 tag and specific spectral selection values in the SOS tag.
  2. Load the malformed JPG file using the ImageGear library.
  3. The library parses the SOF0 and SOS tags and calls handle_JPEG420.
  4. The function writes beyond the allocated raster buffer, causing an out-of-bounds write.

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 a program reads an image file, it uses the file's stated dimensions to allocate memory. If the file lies about its dimensions, the program may write more data than it allocated, overwriting other memory. This 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

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