Skip to content
Memory corruption Advisory Advanced CVE-2017-2816

LibOFX Tag Parsing Code Execution Vulnerability

The tag sanitising routine in LibOFX copies characters from an OFX file into a fixed-size stack buffer without checking the length, so a long tag overflows it. An attacker could craft a malicious OFX file that, when imported, writes past the buffer and potentially leads to code execution.

Cory Duplantis Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable buffer overflow vulnerability exists in the tag parsing functionality of LibOFX 0.9.11. A specially crafted OFX file can cause a write out of bounds resulting in a buffer overflow on the stack.

Cory Duplantis, 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 loop copies each character of the tag into a fixed 1024-byte stack array indexed by a counter that is never bounds-checked against the array size.

Impact

A crafted OFX file could overflow the stack buffer and potentially lead to code execution when imported by a victim.

What the attacker needed

Victim imports a crafted OFX file; file begins with the OFX tag

How it was found

  1. Open an OFX file whose content begins with the expected OFX opening tag.
  2. Include a tag longer than the 1024-byte read buffer inside the file.
  3. Import the file with a program that uses libOFX, such as GnuCash.
  4. The tag is copied into the stack buffer past its end, triggering the overflow.

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 program that reads a file often stores pieces of it in small, fixed-size boxes in memory. Here the program keeps copying characters into one such box without ever checking whether it is full, so a long tag spills into neighbouring memory. That spill can crash the program or, in the worst case, let an attacker control what it does next.

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 Cory Duplantis

View all

35 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.