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

Ledger CLI Account Directive Use-After-Free Vulnerability

A use-after-free vulnerability in Ledger CLI's account parsing allows a crafted journal file to cause arbitrary code execution. An attacker can convince a user to load a malicious journal file to trigger the vulnerability.

Cory Duplantis Follow

Originally disclosed on Cisco Talos

High 7.5 View original

An exploitable use-after-free vulnerability exists in the account parsing component of the Ledger-CLI 3.1.1. A specially crafted ledger file can cause a use-after-free vulnerability resulting in arbitrary code execution.

Cory Duplantis and another member, 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

Likely the parser incorrectly manages a std::unique_ptr, releasing an object while a pointer to it is still retained and later dereferenced.

What the attacker needed

Victim loads a malicious journal file

How it was found

  1. Create a journal file with an account directive line starting with a number.
  2. Include a deferred posting by placing content between '<' and '>' before the next account directive.
  3. Run the ledger binary with the crafted file and a command such as register or xml.

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 happens when a program frees memory but keeps using it, like deleting a file but still opening it. Here, a malformed journal file makes Ledger CLI free an object but later use it, which can let an attacker run their own code. The attacker needs the victim to open a malicious journal file.

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

1 more disclosed report, 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.