Foxit Reader Choice Field use-after-free vulnerability
A use-after-free vulnerability in Foxit Reader's JavaScript engine allows a specially crafted PDF to free a form field object during rendering and then reuse its memory, leading to memory corruption and potentially arbitrary code execution. An attacker could 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 12.1.1.15289. A specially crafted PDF document can trigger the reuse of previously freed memory by manipulating form fields of a specific type.
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 frees a form field object during event handling (via an overridden toString function) but later reuses its memory without proper checks, leading to a use-after-free.
Impact
This could lead to memory corruption and arbitrary code execution, though the report notes that with careful memory layout manipulation, further exploitation is possible.
What the attacker needed
Victim opens a malicious PDF; or visits a malicious site with plugin enabled
The fix
The vulnerability was fixed by the vendor in a patch release.
How it was found
- Create a PDF with a choice field named 'choice'.
- Assign an item to the field with an overridden toString function that calls removeField('choice').
- Open the PDF in Foxit Reader to trigger rendering of the field, which calls toString and frees the field.
- Observe memory corruption or crash when the freed memory is reused.
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 the program frees an object but later uses it again, an attacker can control that memory and potentially run their own code. The attacker needs 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.