SoftMaker Office TextMaker Document Record 0x002a integer overflow vulnerability
A crafted TextMaker document can make the parser multiply a 32-bit length by a constant, overflow the result, and allocate a buffer that is too small. When that buffer is later used, the application writes past its end, causing a heap-based buffer overflow that an attacker could exploit by getting a victim to open the document.
An exploitable integer overflow vulnerability exists in the TextMaker document parsing functionality of SoftMaker Office 2021’s TextMaker application. A specially crafted document can cause the document parser to miscalculate a length used to allocate a buffer, later upon usage of this buffer the application will…
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 32-bit record length is multiplied by 0x23c without an overflow check, so the allocation size wraps to a small value while the subsequent write uses the larger logical size.
Impact
An attacker who convinces a victim to open a malicious document could cause a heap-based buffer overflow, potentially leading to code execution in the context of the application.
What the attacker needed
Victim opens a crafted .tmd document; attacker can deliver the file
How it was found
- Open a crafted TextMaker document in the application.
- The parser fingerprints the file and seeks to the index table.
- It reads the index table and locates a record of type 0x002a.
- It reads a 32-bit length from the record and multiplies it by 0x23c.
- The overflowed size is used to allocate a heap buffer.
- The buffer is later written to beyond its bounds.
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 document file contains a number that tells the program how much memory to reserve. The program multiplies that number by a fixed value, but the result can wrap around to a much smaller number, so it reserves too little memory. When it then writes the real data into that small space, it spills over into neighbouring memory, which an attacker can use to corrupt 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.