Foxit PDF Reader Javascript Optional Content Group 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 document is closed while JavaScript continues to run, and a saved reference to an Optional Content Group is accessed after the document is freed.
Originally disclosed on Cisco Talos
An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s Foxit 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 script execution continues, and a saved reference to an Optional Content Group object is accessed after the document's memory has been freed.
Impact
An attacker could execute arbitrary code on the victim's machine, and if the browser plugin is enabled, visiting a malicious site could also trigger the vulnerability.
What the attacker needed
Victim opens a malicious PDF; or visits a malicious site if plugin enabled
The fix
The vulnerability was fixed by the vendor in version 9.2.0.9297 (patched on 2018-09-28).
How it was found
- Create a PDF with embedded JavaScript that saves a reference to an Optional Content Group.
- In the script, close the document to free its objects.
- Access a property of the saved reference to trigger the use-after-free.
- Open the PDF in Foxit Reader to cause a crash or potentially execute code.
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 memory but then keeps using it, like deleting a file and then trying to open it. In this case, Foxit PDF Reader's JavaScript engine lets a script close the document but still access objects from it, which can crash the program or let an attacker run their own code. The attacker just needs to get the victim to open 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.