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

LEADTOOLS JPEG2000 j2pc Parsing Remote Code Execution Vulnerability

A heap buffer overflow exists in LEADTOOLS' JPEG2000 parsing when a crafted J2K image supplies a tile component offset outside the image bounds. An attacker could cause an out-of-bounds write, potentially leading to code execution.

Cory Duplantis Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable heap overflow vulnerability exists in the JPEG2000 parsing functionality of LEADTOOLS 20. A specially crafted J2K image file can cause an out of bounds write of a heap buffer, 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

Likely the allocation size is computed from the image size fields while the write loop uses a per-component tile offset without validating it against the allocated bounds.

Impact

A crafted J2K image could cause an out-of-bounds heap write, potentially resulting in code execution.

What the attacker needed

Victim opens a crafted J2K image; LEADTOOLS 20.0.2019.3.15

The fix

The vendor patched the issue in version 20.0.2019.3.15's successor build, according to the timeline.

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 heap buffer is a chunk of memory the program reserves for data. Here the program reserves space based on the image size but then writes pixel data at an offset that can point past that space, corrupting nearby memory. A crafted image file could 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.