Foxit Reader FileAttachment annotation 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, potentially leading to arbitrary code execution. An attacker can exploit this by tricking a user into opening a malicious PDF 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 10.1.3.37598. A specially crafted PDF document can trigger the reuse of previously free memory, 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 annotation object is freed by a page close handler while the annotation creation code is still executing, leading to a use-after-free when the creation code later accesses the freed memory.
Impact
An attacker could potentially execute arbitrary code on the victim's machine by exploiting this use-after-free, though the browser plugin must be enabled and the user must open a malicious file or site.
What the attacker needed
Victim opens a malicious PDF; browser plugin extension enabled
The fix
The vulnerability was fixed by the vendor in a patch released on 2021-05-06.
How it was found
- Open a malicious PDF that contains JavaScript to switch to page 1 and add a FileAttachment annotation.
- The page switch queues a page close handler for page 0.
- The FileAttachment annotation triggers a file chooser dialog, blocking execution.
- The page close handler runs and destroys the annotation, freeing its memory.
- Dismiss the dialog, causing the annotation creation code to resume and access the freed memory.
- This leads to a use-after-free and potential code execution.
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 report describes a memory safety bug in a PDF reader. When a PDF contains JavaScript that creates and then destroys an annotation, the program frees the memory used by that annotation but later tries to use it again. This is called a use-after-free, and an attacker could exploit it to run their own code on the victim's computer.
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.