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

NitroPDF ICCBased Color Space Remote Code Execution Vulnerability

A crafted PDF with an ICCBased colour space whose component count is not 1, 3 or 4 causes NitroPDF to store an error value as the component count and then use it as an array index, writing past a heap buffer. An attacker could corrupt adjacent heap memory and, with careful control, potentially achieve arbitrary code execution when the victim opens the file.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A specifically crafted PDF file can lead to a heap corruption when opened 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 parser set the component count to an error sentinel value (0x6f) instead of aborting after raising an exception, and the exception was ignored so later code used the sentinel as an array index.

Impact

Heap corruption could potentially be turned into arbitrary code execution, but the report only demonstrates a crash and states that code execution requires careful memory manipulation.

What the attacker needed

Victim opens a crafted PDF; NitroPDF 12.12.1.522

The fix

The parser should reject an invalid component count and stop processing rather than continuing with a sentinel value; the report does not state that a fix was released.

How it was found

  1. Create a PDF containing an ICCBased colour space object.
  2. Set the required component count N to a value other than 1, 3 or 4.
  3. Open the file in NitroPDF 12.12.1.522.
  4. Observe the out-of-bounds heap write and crash.

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 describe colours using a profile that states how many colour components it has, and the standard only allows one, three or four. NitroPDF noticed an invalid number but saved an error code in its place and carried on, then used that number to work out where to write in memory. Because the number was far too large, the write landed outside the reserved memory block, which is called a heap overflow and can let an attacker take over the program.

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.