Catdoc utilities OLE Document DIFAT Parser integer underflow vulnerability
An integer underflow in catdoc's OLE document DIFAT parser allows a crafted file to cause heap-based memory corruption. An attacker could exploit this to execute code under the context of the binary.
An integer underflow vulnerability exists in the OLE Document DIFAT Parser functionality of catdoc 0.95. A specially crafted malformed file can lead to heap-based memory corruption.
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 sector size read from the file is not validated to be at least 4, so when it is smaller, the calculation (sectorSize-4)*i underflows and produces a negative offset, causing an out-of-bounds write.
Impact
This can be used to corrupt memory which can allow for code execution under the context of the binary.
What the attacker needed
Victim opens a malicious file with catdoc
How it was found
- Create a malicious OLE document with a sector size of 1 (by setting the 16-bit integer at offset 0x1E to 1).
- Run catdoc on the crafted document.
- The program crashes due to heap-buffer-overflow.
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.
catdoc is a tool that extracts text from old Microsoft Office files. A bug in how it reads a part of the file called the DIFAT can cause it to write data outside the memory it reserved, 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.