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

Foxit Reader JavaScript choice field use-after-free vulnerability

A use-after-free vulnerability in Foxit Reader's JavaScript engine allows an attacker to execute arbitrary code by tricking a user into opening a malicious PDF. The flaw occurs when a choice field's items are cleared while a Keystroke event handler is still processing, leading to memory corruption.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A use after free vulnerability exists in the JavaScript engine of Foxit Software’s Foxit PDF Reader, version 10.1.0.37527. A specially crafted PDF document can trigger 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

The JavaScript engine frees memory associated with a choice field object during an event handler (clearItems) but continues to use that memory before the handler finishes.

Impact

An attacker could execute arbitrary code by convincing a user to open a malicious PDF, or by visiting a malicious site if the browser plugin is enabled.

What the attacker needed

Victim opens malicious PDF; or visits malicious site with plugin

How it was found

  1. Create a PDF with a choice field named 'choiceField'.
  2. Insert an item into the field and set a Keystroke action that calls a function to clear items.
  3. Delete the inserted item, which triggers the Keystroke event and frees the field's memory.
  4. The event handler continues to use the freed memory, causing a crash that can be exploited.

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 use-after-free is a type of bug where a program frees some memory but then keeps using it, like deleting a file and then trying to open it. In this case, Foxit Reader's JavaScript engine frees memory for a form field while still handling an event, which can let an attacker 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.