Skip to content
Memory corruption Advisory Advanced CVE-2018-3966

Foxit PDF Reader JavaScript this.dataObjects remote code execution vulnerability

A use-after-free vulnerability in Foxit PDF Reader's JavaScript engine allows an attacker to execute arbitrary code by tricking a user into opening a malicious PDF. The flaw occurs when JavaScript continues to run after the document is closed, leading to reuse of freed memory.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.0 View original

An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s Foxit PDF Reader version 9.1.0.5096. A specially crafted PDF document can trigger a previously freed object in memory to be reused, resulting in 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

The JavaScript engine allows code to continue executing after the document is closed, and accessing a saved reference to a freed object (this.dataObjects) leads to a use-after-free condition.

Impact

An attacker could execute arbitrary code by controlling the freed memory, but the closeDoc method requires higher privileges, so the document must come from a trusted location or the user must approve a dialogue.

What the attacker needed

Victim opens malicious PDF; document from trusted location or user approves dialogue

The fix

The vulnerability was fixed by the vendor in a patch released on 2018-09-28.

How it was found

  1. Create a PDF with embedded JavaScript that calls closeDoc() on the active document.
  2. After closing, save a reference to this and modify the toString property of this.dataObjects.
  3. Open the PDF in Foxit Reader to trigger the use-after-free 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.

When a PDF is closed, the program frees the memory it was using. If JavaScript code keeps running and tries to use that freed memory, it can cause a crash or let an attacker run their own code. This is called a use-after-free bug.

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.