Skip to content
Memory corruption Advisory Advanced CVE-2016-4324

The Document Foundation LibreOffice RTF Stylesheet Code Execution Vulnerability

A use-after-free flaw in LibreOffice's RTF parser occurs when a document contains a stylesheet and a superscript token in the outermost group, causing the parser to pop one too many states. An attacker could exploit this by crafting a malicious RTF file that, when opened, may lead to arbitrary code execution.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

Medium 6.3 View original

An exploitable Use After Free vulnerability exists in the RTF parser LibreOffice. A specially crafted file can cause a use after free resulting in a possible arbitrary code execution.

Aleksandar Nikolic, on Cisco Talos

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 RTF parser calls popState one time too many when handling a superscript token in the top group alongside a stylesheet, leading to access of a freed parser state.

Impact

The vulnerability could allow arbitrary code execution, though the report only demonstrates a crash and notes that further heap manipulation is needed to possibly achieve code execution.

What the attacker needed

Victim opens a malicious RTF file

How it was found

  1. Create an RTF document with a stylesheet in an inner group and a superscript token in the outermost group.
  2. Open the document in LibreOffice.
  3. Observe the crash due to use-after-free in getProperties.

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 use-after-free is a memory bug where a program keeps using a piece of memory after it has been freed, which can let an attacker control what happens next. Here, opening a specially made RTF document (a rich text format file) can crash LibreOffice and potentially 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.

More by Aleksandar Nikolic

View all

147 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.