Skip to content
Memory corruption Advisory Advanced CVE-2022-37332

Foxit Reader openPlayer use-after-free vulnerability

A use-after-free vulnerability in Foxit Reader's JavaScript engine allows a specially crafted PDF to trigger reuse of freed memory via the media player API, potentially leading to arbitrary code execution. An attacker must trick the user into opening the malicious file or visiting a malicious site if the browser plugin is enabled.

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 PDF Reader, version 12.0.1.12430. A specially-crafted PDF document can trigger the reuse of previously freed memory via misusing media player API, 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 page close and document close actions are executed out of sync, so the closeDoc call frees memory that is later reused in the page close event.

Impact

This could lead to arbitrary code execution, but the attacker needs the user to open a malicious file or visit a malicious site if the browser plugin is enabled.

What the attacker needed

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

The fix

The vulnerability was fixed in a vendor patch release.

How it was found

  1. Open a specially crafted PDF document that contains JavaScript in the document open action and page close action.
  2. The document open action jumps to the first page, creates a media player object, saves it in a global variable, and then closes the document.
  3. Closing the document triggers the page close action, which tries to access the saved media player variable.
  4. The page close action accesses the freed media player object, causing a 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.

A use-after-free bug happens when a program frees some memory but then keeps using it, like deleting a file and then trying to open it. Here, Foxit Reader's JavaScript engine frees a media player object when a document closes, but a page-close action still tries to use it. An attacker can craft a PDF that triggers this, and by carefully controlling memory, could run their own code on the victim's computer.

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.