Hancom Office 2020 Hword Docx XML parsing heap underflow vulnerability
A heap buffer underflow in Hancom Office 2020's Hword when parsing a malformed .docx file with a closing paragraph tag but no opening tag causes the application to read memory before a buffer and call an invalid pointer. An attacker could exploit this to achieve arbitrary code execution by controlling the pointer via heap spraying.
A buffer underflow vulnerability exists in the way Hword of Hancom Office 2020 version 11.0.0.5357 parses XML-based office files. A specially-crafted malformed file can cause memory corruption by using memory before buffer start, which 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
The application assumes a vector contains an element when only a closing XML tag is present, leading to a pointer decrement before the buffer start and an invalid virtual call.
Impact
An attacker could achieve arbitrary code execution by using heap spraying to control the pointer used in an indirect call.
What the attacker needed
Victim opens a malicious .docx file; Hancom Office 2020 version 11.0.0.5357
The fix
The vendor released a patch on 2022-09-30.
How it was found
- Enable PageHeap for the application and HwordApp.dll.
- Open the malicious .docx file in Hancom Office 2020.
- Observe the access violation in the debugger at the instruction dereferencing the underflowed pointer.
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 memory corruption bug in a word processor. When the program opens a specially crafted document, it mistakenly reads data from just before a memory buffer, which can crash the program or let an attacker run their own code. The attacker needs the victim to open a malicious 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.