Foxit PDF Reader JavaScript field action OnBlur remote code execution vulnerability
A use-after-free flaw in Foxit PDF Reader's JavaScript engine can be triggered by a crafted PDF with a field OnBlur action that refocuses and then removes the field. An attacker could exploit this to execute arbitrary code when the victim opens the malicious file or visits 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 Software’s 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 track object lifetime when an OnBlur action refocuses a field that is subsequently removed, leading to a use-after-free.
Impact
An attacker could execute arbitrary code by manipulating the freed memory before it is reused, but the victim must open a malicious PDF or visit a malicious site if the browser plugin is enabled.
What the attacker needed
Victim opens a malicious PDF; or victim visits a malicious site with plugin enabled
How it was found
- Set an OnBlur action on a form field that refocuses the same field.
- Shift focus to that field and then to another field to trigger the OnBlur action.
- Remove the field, causing the freed object to be used again and leading to a crash or 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.
A use-after-free happens when a program frees memory but then keeps using it, like deleting a file and still trying to open it. Here, a PDF's JavaScript can make a form field lose focus, refocus it, and then delete it, causing the program to use the deleted field's memory. An attacker could then take control of that memory to run their own code.
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.