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

NitroPDF jpeg2000 ssizDepth Remote Code Execution Vulnerability

A crafted JPEG2000 image embedded in a PDF can cause a heap buffer overflow in NitroPDF due to an incorrectly sized allocation based on the image's ssizDepth value. 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, the buffer size calculation uses a sign-extended value derived from the image's ssizDepth, leading to an undersized allocation, and later loops increment the write index more than once per iteration, causing an out-of-bounds write.

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

How it was found

  1. Craft a PDF containing an embedded JPEG2000 image with an unusually large ssizDepth value in the siz block.
  2. Open the PDF in NitroPDF 12.12.1.522.
  3. The application allocates a buffer based on the crafted size calculation.
  4. During further processing, the application writes out of bounds on the heap, causing a crash or potential 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.

A heap buffer overflow is a memory corruption bug where a program writes more data than it allocated, potentially overwriting other data. In this case, a malicious PDF with a specially crafted image can cause NitroPDF to write outside its intended memory, which could 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.