Skip to content
Memory corruption Advisory Advanced CVE-2020-13570

Foxit Reader JavaScript remove template use-after-free vulnerability

Foxit Reader's JavaScript engine mishandles page template objects, so removing a template frees memory that a saved reference still points to. An attacker who gets a victim to open a crafted PDF, or visit a malicious site with the browser plugin enabled, could trigger reuse of that freed memory and potentially achieve arbitrary code execution.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 7.5 View original

A use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s PDF Reader, version 10.1.0.37527. A specially crafted PDF document can trigger the reuse of previously free memory which 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 template removal frees the underlying object while an existing JavaScript reference to it is not invalidated, so later property access reads freed memory.

Impact

The freed buffer is dereferenced and crashes the reader; with precise memory allocation control and reuse it could lead to further memory corruption and possibly arbitrary code execution, though the report only demonstrates a crash.

What the attacker needed

Victim opens a crafted PDF; or victim visits a malicious site; browser plugin extension enabled (site path)

How it was found

  1. Create a page template through the document scripting API and keep a reference to it.
  2. Remove the template, which frees the underlying object.
  3. Create another template, which changes the list of existing templates.
  4. Set a property on the stale reference, which touches the freed memory 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 scripts, and Foxit Reader runs them. This report shows that if a script creates a page template, deletes it, then uses the old handle again, the program touches memory it has already given back to the system. That kind of mistake, called use-after-free, can let an attacker take control of the program if they can shape what lands in that memory.

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.