Skip to content
Memory corruption Advisory Advanced CVE-2019-5099

LEADTOOLS CMP-parsing code execution vulnerability

An integer underflow in LEADTOOLS' CMP image parsing allows a crafted file to cause a heap buffer overflow, potentially leading to code execution.

Cory Duplantis Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable integer underflow vulnerability exists in the CMP-parsing functionality of LEADTOOLS 20. A specially crafted CMP image file can cause an integer underflow, potentially 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 2 from a two-byte size field without checking if the value is less than 2, causing an integer underflow when the size is 1.

Impact

This could lead to a heap buffer overflow, potentially resulting in code execution.

What the attacker needed

Victim opens a crafted CMP file

The fix

The size field should be validated to ensure it is at least 2 before subtracting, preventing the underflow.

How it was found

  1. Craft a CMP image file with the data size field set to 1.
  2. Open the crafted file in an application using LEADTOOLS CMP parsing.
  3. The parser subtracts 2 from the size, causing an underflow.
  4. The underflowed size is passed to a memmove wrapper, writing beyond the heap buffer.

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.

When a program reads a file, it often uses a number to say how much data to copy. If that number is too small, subtracting a fixed amount can wrap around to a huge number, causing the program to write far more data than intended. This 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.