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

Accusoft ImageGear TIF bits_per_sample processing out-of-bounds write vulnerability

A malformed TIF file with a null bits_per_sample tag and a T4options tag causes an out-of-bounds write in the ImageGear library's memcpy call. An attacker could provide a malicious file to trigger memory corruption, 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 TIF bitspersample processing 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

Likely the function GetCopyBufferAllocatedWithPixpos computes a destination address as copy_buffer_allocated + raster_size * pixpos without verifying that this address lies within the allocated buffer, and the caller then copies data to it.

Impact

An attacker could cause memory corruption, potentially leading to code execution or a crash, as indicated by the CVSS score of 9.8.

What the attacker needed

Victim opens a malicious TIF file; ImageGear library processes the file

The fix

The vendor patched the vulnerability, likely by adding a bounds check before the memcpy.

How it was found

  1. Create a TIF file that includes a bits_per_sample tag with a null value and a T4options tag.
  2. Load the malformed TIF file using the ImageGear library.
  3. The library processes the tags and reaches the vulnerable memcpy call, 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.

A TIF file is an image format that can contain tags describing how to display the image. The library fails to check that a calculated memory address stays within the allocated buffer, so a crafted file can make it write data past the end of that buffer, corrupting memory. This could let an attacker run their own code or crash the program.

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.