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.
Originally disclosed on Cisco Talos
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.
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
- Create a PDF with JavaScript that defines a function calling getPageNthWordQuads with a negative second parameter.
- Use a property assignment (borderStyle) with an object whose toString triggers a nested function call.
- Inside that nested function, call buttonSetCaption with another object whose toString calls the function from step 1.
- 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.