Foxit Reader Barcode widget Calculate event use-after-free vulnerability
A use-after-free vulnerability in Foxit Reader's handling of a Barcode widget allows a specially crafted PDF with JavaScript to free a Barcode object and then use it, leading to memory corruption and potentially arbitrary code execution. An attacker could exploit this by tricking a user into opening a malicious PDF or visiting a malicious site if the browser plugin is enabled.
A use-after-free vulnerability exists in the way Foxit Reader 2024.1.0.23997 handles a Barcode 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 Barcode widget object is freed by a page deletion triggered from a JavaScript callback, and then the code later uses the freed object without checking if it is still valid.
Impact
This could lead to memory corruption and potentially arbitrary code execution, but the report notes that exploitation depends on the memory layout of the process.
What the attacker needed
Victim opens a malicious PDF; or visits a malicious site with plugin enabled
The fix
The vendor has provided updated versions.
How it was found
- Create a PDF with a Barcode field named 'Barcode Field0'.
- Assign a Calculate action to the field that calls deletePages() twice.
- Trigger the Calculate action by calling buttonSetIcon() on the field.
- The second deletePages() frees the Barcode widget object.
- The freed object is later 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.
This report describes a memory safety bug in a PDF reader. When a PDF contains JavaScript that deletes pages, a Barcode object is freed but then used again, which can crash the program or let an attacker run their own code. The attacker needs the victim to open a malicious PDF file.
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.