Foxit Reader ComboBox widget Format event use-after-free vulnerability
Foxit Reader mishandles a ComboBox widget when JavaScript attached to its Format event deletes the pages that own the widget, leaving a freed object that is later used. An attacker could corrupt memory and potentially execute arbitrary code if a victim opens a malicious PDF.
A use-after-free vulnerability exists in the way Foxit Reader 2024.1.0.23997 handles a ComboBox widget. A specially crafted JavaScript code inside a malicious PDF document can trigger reuse of a previously freed object, which can lead to memory corruption and result 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 Format event callback frees the ComboBox widget via deletePages(), and the code then dereferences the stale widget pointer without checking whether it is still valid.
Impact
This could lead to memory corruption and arbitrary code execution, though the text only demonstrates a crash in the debugger.
What the attacker needed
Victim opens a malicious PDF; JavaScript enabled in the reader; or browser plugin enabled for web vector
The fix
The vendor provided updated versions that address the issue.
How it was found
- Create a ComboBox field in the active document.
- Assign a Format action to the field that calls deletePages twice.
- Add the ComboBox field again, which triggers the Format callback.
- The second deletePages call frees the widget object.
- The freed widget is then used, causing a crash.
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 PDF can contain small programs (JavaScript) that run when the file is opened. Here the program creates a form dropdown, tells it to run code when its value is formatted, and that code deletes the pages, which destroys the dropdown. The reader keeps using the destroyed dropdown as if it still existed, and that kind of mistake can let an attacker take over the program.
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.