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.
Originally disclosed on Cisco Talos
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.
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
- Craft a PDF containing an embedded JPEG2000 image with an unusually large ssizDepth value in the siz block.
- Open the PDF in NitroPDF 12.12.1.522.
- The application allocates a buffer based on the crafted size calculation.
- 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.