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

NitroPDF jpeg2000 yTsiz Remote Code Execution Vulnerability

A crafted JPEG2000 image embedded in a PDF causes an integer overflow when calculating memory size, leading to a heap buffer overflow. An attacker could exploit this to execute arbitrary code when the victim opens the malicious PDF.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A specifically crafted jpeg2000 file embedded in a PDF file can lead to a heap corruption when opening a PDF document in NitroPDF 12.12.1.522. With careful memory manipulation, this can lead to 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 the memory size for a JPEG2000 image, caused by multiplying large dimensions without checking for overflow, resulting in an undersized allocation.

Impact

An attacker could potentially execute arbitrary code on the victim's system by convincing them to open a malicious PDF.

What the attacker needed

Victim opens a malicious PDF; NitroPDF 12.12.1.522

The fix

The vulnerability should be fixed by validating image dimensions and using overflow-safe calculations for memory allocation.

How it was found

  1. Craft a PDF containing an embedded JPEG2000 image with unusually large xSiz and yTsiz values.
  2. Open the PDF in NitroPDF 12.12.1.522.
  3. The program calculates the memory size and overflows, allocating a smaller buffer than needed.
  4. The program writes pixel data in a loop, overflowing the buffer and corrupting adjacent heap memory.
  5. The corruption eventually causes a crash or, with careful manipulation, arbitrary code execution.

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 opens a PDF with a special image inside, it calculates how much memory to reserve for the image. A mistake in that calculation makes it reserve too little memory, and then it writes more data than fits, corrupting other parts of memory. This can let an attacker run their own code on the victim's computer.

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.