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

Foxit PDF Reader JavaScript createTemplate Remote Code Execution Vulnerability

A use-after-free flaw in Foxit PDF Reader's JavaScript engine is triggered when a document calls createTemplate and then closeDoc, leaving a stale reference to freed memory. An attacker who gets a victim to open a crafted PDF, or visit a malicious site with the browser plugin enabled, could corrupt memory and potentially execute arbitrary code.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit Software Foxit PDF Reader version 9.0.1.1049. 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

Likely a stale reference to an object that was allocated and freed when createTemplate failed, then reused during closeDoc cleanup.

Impact

The freed memory is used as a this pointer, so if its contents can be controlled a vtable dereference could hijack control flow and lead to arbitrary code execution, though the short window limits manipulation.

What the attacker needed

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

How it was found

  1. Open the crafted PDF in Foxit Reader with PageHeap enabled.
  2. The document calls createTemplate, which allocates and frees an object.
  3. The document then calls closeDoc, which reuses the stale reference.
  4. The reader crashes on the freed memory, showing the use-after-free.

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 program frees a piece of memory but keeps using it, that is called a use-after-free. Here the PDF reader's JavaScript engine frees an object during document close but still holds a pointer to it, so later use of that pointer can crash the program or let an attacker take control. The victim only has to open a malicious PDF file.

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.