Foxit PDF Reader JavaScript field keystroke action remote code execution vulnerability
A use-after-free vulnerability in Foxit PDF 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 file or visiting a malicious site if the browser plugin is enabled.
Originally disclosed on Cisco Talos
An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit PDF Reader, version 9.7.0.29435. 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
Likely the JavaScript engine does not properly handle changes to a form field's default value during a resetForm operation, leading to a freed object being reused.
Impact
This could allow an attacker to execute arbitrary code on the victim's machine.
What the attacker needed
Victim opens malicious PDF; or visits malicious site if plugin enabled
How it was found
- Create a PDF with a form field and JavaScript that sets a default value and a Keystroke action.
- The Keystroke action is triggered by resetForm, which changes the default value again, freeing the object.
- After the event handler returns, the freed memory is accessed, 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.
A use-after-free bug happens when a program frees some memory but then keeps using it, like deleting a file and then trying to open it. Here, Foxit PDF Reader's JavaScript engine frees an object but then accesses it again, which can let an attacker run their own code. The attacker just needs to get someone 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.