Aspose.PDF for C++ LZWDecode filter predictor remote code execution vulnerability
A malformed Predictor value in an LZWDecode filter causes a use-after-free of an LZW stream object. An attacker could exploit this to corrupt memory and potentially execute arbitrary code.
Aleksandar Nikolic Cisco Talos Follow
Originally disclosed on Cisco Talos
An exploitable use-after-free vulnerability exists in the way LZW-compressed streams are processed in Aspose.PDF 19.2.for C++. A specially crafted PDF can cause a dangling heap pointer, resulting in a use-after-free condition.
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 LZW decoder does not validate that the Predictor value is positive, so a negative value causes the LZW object to be freed while a stale reference remains.
Impact
An attacker could control allocations after the free to place arbitrary objects in its place, leading to further memory corruption and potentially arbitrary code execution.
What the attacker needed
Victim processes a crafted PDF; Aspose.PDF 19.2 for C++
The fix
The vendor patched the issue, likely by validating that the Predictor value is positive before using it.
How it was found
- Create a PDF object with an LZWDecode filter and a DecodeParms dictionary containing a negative Predictor value.
- Process the crafted PDF with the vulnerable Aspose.PDF library.
- The LZW object is allocated and then freed due to the malformed Predictor.
- A stale reference to the freed object is used during further processing, causing a use-after-free.
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 PDF file can contain compressed data, and the program uses a decoder to unpack it. A negative number in a setting called Predictor makes the program free an object but still keep a pointer to it. Later, the program uses that pointer, which now points to freed memory, and this can crash or be abused to run attacker 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.