Accusoft ImageGear JPEG-JFIF Scan header parser out-of-bounds write vulnerability
The JPEG-JFIF Scan header parser in Accusoft ImageGear 19.10 fails to validate array indices for AC and DC Huffman table selectors, allowing an attacker to use out-of-range values to access arbitrary memory. This can lead to a stack-based buffer overflow and potentially code execution when a malicious JPEG file is opened.
Originally disclosed on Cisco Talos
An improper array index validation vulnerability exists in the JPEG-JFIF Scan header parser functionality of Accusoft ImageGear 19.10. A specially-crafted file can lead to an out-of-bounds write and potential code exectuion.
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 AC and DC table index values from the SOS header are used as array indices without validating that they are within the range of parsed Huffman tables, breaking assumptions made during table parsing.
Impact
An attacker could cause a stack-based buffer overflow, leading to a crash or potentially arbitrary code execution.
What the attacker needed
Victim opens a malicious JPEG file
How it was found
- Craft a JPEG file with an SOS header containing AC or DC table index values outside the valid range (0-3).
- Open the malicious JPEG file with a vulnerable application using ImageGear.
- The parser uses the out-of-range index to fetch a pointer from memory beyond the Huffman table array.
- The fetched pointer is used to calculate an offset that bypasses signed range checks.
- The offset is used to write data outside the stack buffer, causing an access violation or potential code execution.
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 an image is loaded, the software reads a header that tells it which compression tables to use. The code does not check that the table numbers are within the allowed range, so a crafted file can make it read a pointer from outside the table. That bad pointer is then used to write data outside a buffer on the stack, which 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.