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.
Originally disclosed on Cisco Talos
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.
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
- Open an OFX file whose content begins with the expected OFX opening tag.
- Include a tag longer than the 1024-byte read buffer inside the file.
- Import the file with a program that uses libOFX, such as GnuCash.
- 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.