Foxit Reader deletePages use-after-free vulnerability
A use-after-free vulnerability exists in Foxit Reader's JavaScript engine when handling form field events, allowing an attacker to execute arbitrary code by tricking a user into opening a malicious PDF. Exploitation is also possible via a malicious website 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 11.1.0.52543. A specially-crafted PDF document can trigger the reuse of previously freed 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 saves a pointer to an object, then executes JavaScript that frees that object (via deletePages), and later dereferences the stale pointer.
Impact
This could lead to arbitrary code execution, and exploitation is also possible if a user visits a malicious site with the browser plugin enabled.
What the attacker needed
Victim opens a malicious PDF; or victim visits a malicious site with plugin enabled
The fix
The vendor patched the vulnerability in version 11.1.0.52543 (or later).
How it was found
- Create a PDF with JavaScript that sets an OnBlur action on a form field to call a function that invokes deletePages.
- Trigger the OnBlur action by calling setFocus on another field.
- The deletePages call frees objects, and when execution returns to the event handler, the freed memory is accessed, causing 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 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 Reader's JavaScript engine frees objects during a form event but then accesses them again, which can let an attacker run their own code. The attacker needs the victim to open a malicious PDF or visit a malicious site with the browser plugin enabled.
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.