Atlantis Word Processor open document format unchecked NewAnsiString length remote code execution vulnerability
The Atlantis Word Processor incorrectly handles the length of a string when parsing the 'text:c' attribute in an open document format file, leading to an undersized heap allocation and an out-of-bounds null byte write. An attacker could exploit this to corrupt memory and potentially execute arbitrary code by convincing a victim to open a crafted document.
An exploitable arbitrary write vulnerability exists in the open document format parser of the Atlantis Word Processor, version 3.2.7.2, while trying to null-terminate a string. A specially crafted document can allow an attacker to pass an untrusted value as a length to a constructor.
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 integer overflow check in the application fails to account for the addition of 9 to the length in NewAnsiString, causing an undersized allocation when the length is 0x7fffffff.
Impact
This can allow an attacker to corrupt memory, which can result in code execution under the context of the application.
What the attacker needed
Victim opens a crafted document
The fix
The vendor patched the vulnerability, likely by correcting the length calculation to prevent integer overflow.
How it was found
- Create a document in open document format containing a 'text:s' element with a 'text:c' attribute set to 0x7fffffff.
- Open or preview the document in Atlantis Word Processor.
- The application parses the document, extracts the 'text:c' value, and calls LStrSetLength with the large length.
- LStrSetLength calls NewAnsiString, which adds 9 to the length and calls System.GetMemory, resulting in an undersized allocation.
- NewAnsiString then attempts to write a null byte at the end of the string, causing an out-of-bounds write and heap corruption.
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.
When a program reads a document, it sometimes needs to create a string of a certain length. If the length is very large, the program might not allocate enough memory for it. Then, when it tries to write a null character at the end of the string, it writes past the allocated memory, corrupting other data. This can crash the program or, worse, 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.