Foxit Reader JavaScript choice field format event use-after-free vulnerability
A use-after-free flaw in Foxit Reader's JavaScript engine can be triggered by a crafted PDF that manipulates form field focus and removal during a Format event. An attacker could exploit this to cause memory corruption and potentially achieve arbitrary code execution.
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
Likely the event handler code does not account for the field being removed during the Format event, so it later accesses the freed object.
Impact
This could lead to further memory corruption or arbitrary code execution, and if the browser plugin is enabled, visiting a malicious site can also trigger the vulnerability.
What the attacker needed
Victim opens a malicious PDF; or visits a malicious site if plugin enabled
How it was found
- Set a Format event handler on a choice field to call a function.
- Trigger the Format event by moving focus between two fields.
- In the handler, remove the field, freeing its memory.
- Continue execution, causing a 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.
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 malicious PDF uses JavaScript to remove a form field while it is still being processed, so the program later reads freed memory. This can crash the reader or let an attacker 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.