Accusoft ImageGear PSD Header processing out-of-bounds write vulnerability
A missing check on the allocation size in the PSD header processing function of Accusoft ImageGear 19.8 allows a malformed PSD file to cause an out-of-bounds write. An attacker could provide a malicious file to trigger memory corruption and potentially achieve code execution.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the PSD Header processing functionality of Accusoft ImageGear 19.8. A specially crafted malformed file can lead to code execution.
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 allocation size calculation uses a bit depth value from the file that can be zero, resulting in a zero-size allocation that malloc returns as a small non-null buffer, and the subsequent loop writes more bytes than allocated.
Impact
An attacker could exploit this out-of-bounds write to achieve arbitrary code execution.
What the attacker needed
Victim opens a malicious PSD file
The fix
The allocation size calculation should be corrected to handle a zero bit depth, and the allocation function should check for a zero size.
How it was found
- Craft a malformed PSD file with a bit depth of zero and a channel count of at least three.
- Load the file using the ImageGear library.
- The library allocates a one-byte buffer due to the zero bit depth.
- The processing loop writes channel data into the 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 a file, it often reserves a small memory area (a buffer) to hold data. If the program miscalculates how big that area should be, it may write more data than fits, spilling into other memory. This is called an out-of-bounds write and can 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.