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

Foxit PDF Reader Javascript JSON.Stringify this.info Remote Code Execution Vulnerability

Foxit PDF Reader's JavaScript engine kept a stale reference to the document's info object after the document was closed, so calling JSON.stringify on that reference reused freed memory. An attacker could craft a PDF that triggers this use-after-free and, because the freed memory contents are controllable, potentially execute arbitrary code.

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 did not invalidate references to document objects after the document was closed, so JSON.stringify dereferenced a freed object.

Impact

A specially crafted PDF could crash the reader and, since the freed memory contents are controllable, could lead to arbitrary code execution; the user must open the file, or visit a malicious site if the browser plugin is enabled.

What the attacker needed

Victim opens a malicious PDF; or visits a malicious site with plugin enabled

The fix

The vendor patched the issue in version released on 2018-09-28.

How it was found

  1. Create a PDF with embedded JavaScript that stores a reference to the document's info object.
  2. Close the active document from the script, freeing the underlying objects.
  3. Call JSON.stringify on the saved reference, which reuses the freed object and crashes.

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 contain small programs written in JavaScript, the same language many websites use. This reader frees the memory holding a document's details when the document is closed, but a script can still hold a pointer to that memory and ask the reader to process it, so the program reads memory that no longer belongs to it. If an attacker can control what sits in that reused memory, they may be able to make the reader run their own code.

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.