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

Ledger CLI Tags Parsing Code Execution Vulnerability

A buffer overflow in Ledger CLI's tag parsing allows a crafted journal file to cause an integer underflow, leading to a large copy into a fixed-size buffer and potential code execution. An attacker can construct a malicious journal file to trigger this vulnerability.

Cory Duplantis Follow

Originally disclosed on Cisco Talos

High 7.5 View original

An exploitable buffer overflow vulnerability exists in the tag parsing functionality of Ledger-CLI 3.1.1. A specially crafted journal file can cause a integer underflow resulting in code execution.

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 code subtracts two pointers to compute a tag length without checking that the end pointer is after the start pointer, causing an integer underflow that becomes a huge size in a fixed-size buffer copy.

What the attacker needed

Victim opens a malicious journal file

How it was found

  1. Create a journal file with a transaction line containing a tag-like sequence where a closing bracket appears before an opening bracket after a semicolon.
  2. Run Ledger CLI with the register command on that file.

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.

Ledger CLI is a command-line accounting tool that reads journal files. A bug in how it reads tags (labels in the file) lets a malformed file cause a buffer overflow, which can crash the program or 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 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.