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

Poppler PDF library JPEG 2000 levels Code Execution Vulnerability

An integer overflow in Poppler's internal JPEG 2000 decoder can cause an out-of-bounds heap write when a crafted PDF is opened. This could lead to arbitrary code execution.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable integer overflow vulnerability exists in the JPEG 2000 image parsing functionality of freedesktop.org Poppler 0.53.0. A specially crafted PDF file can lead to an integer overflow causing out of bounds memory overwrite on the heap resulting in potential arbitrary code execution.

Aleksandar Nikolic, 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 an integer overflow in the calculation of image tile coordinates when multiple decomposition levels are specified, leading to a negative value that becomes a large positive number after division and causes an out-of-bounds write.

Impact

A crafted PDF could cause an out-of-bounds heap write, potentially leading to arbitrary code execution when the victim opens the file or even views its directory.

What the attacker needed

Victim opens a malicious PDF; application uses Poppler's internal JPX decoder

The fix

The library should be compiled to use the OpenJPEG library instead of its internal JPEG 2000 parser.

How it was found

  1. Create a PDF containing an embedded JPEG 2000 image with a JPXDecode stream.
  2. Ensure the image's coding style (COD) element specifies multiple decomposition levels.
  3. Open the PDF in an application that uses Poppler's internal JPX decoder, such as Evince.
  4. The integer overflow occurs during tile part processing, leading to an out-of-bounds heap write.

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 PDF can contain a special kind of image called JPEG 2000. Poppler, a library many PDF viewers use, has its own code to read these images. A mistake in that code lets a malicious PDF write data past the end of a memory buffer, which an attacker could use to 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 Aleksandar Nikolic

View all

147 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.