Foxit PDF Reader JavaScript field object isDefaultChecked remote code execution vulnerability
A use-after-free vulnerability in Foxit PDF 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 field object's isDefaultChecked method is called with a crafted argument that closes the document, leaving a stale reference that can be exploited.
Originally disclosed on Cisco Talos
An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s PDF Reader, version 9.2.0.9297. A specially crafted PDF document can trigger a previously freed object in memory to be reused, resulting in 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
The JavaScript engine allows a document to be closed while JavaScript continues to execute, and the isDefaultChecked method keeps a reference to a freed object, leading to a use-after-free.
Impact
An attacker could execute arbitrary code by tricking a user into opening a malicious PDF, and if the browser plugin is enabled, visiting a malicious site could also trigger it.
What the attacker needed
Victim opens malicious PDF; or visits malicious site if plugin enabled
The fix
The vulnerability was fixed by the vendor in version 9.2.0.9297? Actually the tested version is 9.2.0.9297 and the timeline says vendor patched on 2018-09-28, so it was fixed.
How it was found
- Create a PDF with embedded JavaScript that defines a function to close the document.
- In the main function, create an object with a toString method that calls the close function.
- Call the isDefaultChecked method of a field object with this crafted object as argument.
- Open the PDF in Foxit Reader to trigger the 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.
This is a use-after-free bug, where a program keeps using memory after it has been freed. An attacker can craft a PDF that tricks the reader into freeing an object and then reusing it, potentially running their own code. The victim just needs to open the malicious PDF.
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.