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

Accusoft ImageGear JPG sof_nb_comp header processing out-of-bounds write vulnerability

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

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

An out-of-bounds write vulnerability exists in the JPG sofnbcomp header processing functionality of Accusoft ImageGear 19.8 and 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 buffer size is calculated from a file-controlled value without a null check, so a zero value leads to a one-byte allocation and subsequent writes overflow it.

Impact

This could lead to memory corruption and possibly code execution.

What the attacker needed

Victim opens a malicious JPG file

The fix

The vulnerability was fixed by the vendor.

How it was found

  1. Craft a malformed JPG file with a zero value for the number of components in the SOS header.
  2. Load the file using the ImageGear library.
  3. The library allocates a one-byte buffer and then writes beyond it, 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.

When a program reads a file, it often uses numbers from the file to decide how much memory to set aside. If it doesn't check those numbers, it might set aside too little memory and then write more data than fits, corrupting 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.