Foxit Reader Javascript Field fileSelect 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 Foxit PDF Reader, version 10.1.0.37527. A specially crafted PDF document can trigger 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 JavaScript engine frees objects associated with a form field when the field is removed, but later code still tries to use those freed objects, leading to a use-after-free.
Impact
This could lead to arbitrary code execution, allowing an attacker to take control of the affected system.
What the attacker needed
Victim opens malicious PDF; or victim visits malicious site with plugin
How it was found
- Create a PDF with two text fields, txt1 and txt2.
- Set txt2's defaultValue, focus it, set fileSelect to 1, and set a Validate action that calls a function f.
- Shift focus from txt2 to txt1 to trigger the Validate event.
- In function f, focus txt2, then txt1, then remove the field txt2 (using removeField with an empty string).
- The removal frees objects still in use, causing a crash that can be exploited.
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 in a PDF reader. When a PDF contains JavaScript that removes a form field, the program still tries to use the memory that was freed, which can 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.