Foxit Reader Optional Content Group use-after-free vulnerability
A use-after-free vulnerability in Foxit Reader's JavaScript engine allows a specially crafted PDF to trigger reuse of freed memory via the Optional Content Group API, potentially leading to arbitrary code execution. An attacker must trick the user into opening the malicious file or visiting a malicious site if the browser plugin is enabled.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s PDF Reader, version 12.0.1.12430. A specially-crafted PDF document can trigger the reuse of previously freed memory via misusing Optional Content Group API, which can lead to 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 page close and document close actions are executed out of sync, so the closeDoc call frees memory that is then reused in the page close event.
Impact
This could lead to arbitrary code execution, and exploitation is also possible if a user visits a specially crafted malicious site with the browser plugin enabled.
What the attacker needed
Victim opens malicious PDF; or victim visits malicious site with plugin
The fix
The vulnerability was fixed in a vendor patch release.
How it was found
- Create a PDF with a document open action that saves a reference to an Optional Content Group (layer) in a global variable and then calls closeDoc.
- Attach a page close action that accesses the saved layer reference.
- 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.
A use-after-free 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 Reader's JavaScript engine frees a layer object when the document closes, but a page-close action still tries to use it, which can crash the program or let an attacker run their own code. The attacker needs the victim to open a malicious PDF or visit a malicious website.
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.