Skip to content
Memory corruption Advisory Advanced CVE-2023-33866

Foxit Reader Field OnBlur event use-after-free vulnerability

A use-after-free vulnerability exists in Foxit Reader's JavaScript engine when handling form field events. An attacker could exploit this by crafting a malicious PDF that triggers the reuse of freed memory, potentially leading to arbitrary code execution.

Kamlapati Choubey 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.1.2.15332. By prematurely deleting objects associated with pages, a specially crafted PDF document can trigger the reuse of previously freed memory, which can lead to arbitrary code execution.

Kamlapati Choubey and 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 fails to properly manage object lifetimes when form field events trigger page deletion, leading to a use-after-free.

What the attacker needed

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

The fix

Foxit provided patches for this vulnerability.

How it was found

  1. Assign a callback function to the OnBlur action of a text field.
  2. Trigger the OnBlur event by calling setFocus on another field.
  3. In the callback, call deletePages to free objects.
  4. Call setFocus again to queue another event.
  5. After the event handler returns, the freed memory is reused, 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. In this case, Foxit Reader's JavaScript engine frees objects when pages are deleted, but then tries to use them again, which can crash the program or let an attacker run their own code. The attacker needs to trick a user into opening 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 Kamlapati Choubey

View all

2 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.