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

Foxit Reader getPageNthWordQuads mishandled exception vulnerability

A memory corruption vulnerability exists in Foxit Reader's JavaScript engine due to improper handling of exceptions thrown by the getPageNthWordQuads method. An attacker could exploit this by crafting a malicious PDF that triggers the exception, potentially leading to arbitrary code execution.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A memory corruption vulnerability exists in the JavaScript engine of Foxit Software’s PDF Reader, version 11.1.0.52543. A specially-crafted PDF document can trigger an exception which is improperly handled, leaving the engine in an invalid state, which can lead to memory corruption and 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 JavaScript binding for getPageNthWordQuads throws a C++ exception that is caught during nested execution, leaving the JavaScript engine runtime in an inconsistent state.

Impact

This could lead to memory corruption and arbitrary code execution, and exploitation is also possible if a user visits a malicious site with the browser plugin enabled.

What the attacker needed

Victim opens malicious PDF; or visits malicious site with plugin

How it was found

  1. Create a PDF with JavaScript that defines a function calling getPageNthWordQuads with a negative second parameter.
  2. Use a property assignment (borderStyle) with an object whose toString triggers a nested function call.
  3. Inside that nested function, call buttonSetCaption with another object whose toString calls the function from step 1.
  4. Open the PDF in Foxit Reader to trigger the exception and subsequent memory corruption.

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.

Foxit Reader is a program for viewing PDF files. It can run JavaScript code inside PDFs. A bug in how it handles certain errors (exceptions) when running that JavaScript can leave the program in a confused state, which can crash it or 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.