Apache OpenOffice DOC ImportOldFormatStyles Code Execution Vulnerability
A specially crafted DOC file can cause an out-of-bounds write in Apache OpenOffice's WW8RStyle::ImportOldFormatStyles function, leading to memory corruption and potentially arbitrary code execution. An attacker can provide a malicious DOC file to trigger this vulnerability.
Originally disclosed on Cisco Talos
An exploitable out-of-bounds write vulnerability exists in the WW8RStyle::ImportOldFormatStyles functionality of Apache OpenOffice 4.1.3. A specially crafted doc file can cause a out-of-bounds write resulting in arbitrary 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
The code reads a length value (cbChpx) from the file and uses it to loop without checking that it does not exceed the size of the allocated vector (aCHPXOffsets), causing an out-of-bounds write.
Impact
This out-of-bounds write causes memory corruption and can lead to arbitrary code execution by the attacker.
What the attacker needed
Victim opens a malicious DOC file
How it was found
- Open Writer with a malformed DOC file.
- The file contains a small cbName value, so stcp remains 0.
- A vector aCHPXOffsets is allocated with size stcp (0).
- The file contains a large cbChpx value, causing the loop to write beyond the vector's 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.
This report describes a bug in Apache OpenOffice, a free office suite. When you open a malicious DOC file, the program writes data past the end of a memory buffer, which can crash the program or let an attacker run their own code. The attacker just needs to trick you into opening the file.
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.