Foxit Reader Barcode Calculate CPDF_FormField Use-After-Free Vulnerability
A use-after-free flaw exists in how Foxit Reader handles a Barcode form field when JavaScript triggers a Calculate action that deletes the page. An attacker could corrupt memory and potentially achieve arbitrary code execution by getting a user to open a malicious PDF.
A use-after-free vulnerability exists in the way Foxit Reader handles a Barcode field object. A specially crafted JavaScript code inside a malicious PDF document can trigger this vulnerability, 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 Calculate action callback frees the page's form field objects via deletePages(), and the freed CPDF_FormField object is later dereferenced without any validation.
Impact
Depending on the memory layout, this could allow arbitrary read and write operations and ultimately arbitrary code execution, though the text only says it may be possible.
What the attacker needed
Victim opens a malicious PDF; JavaScript enabled in the reader; or victim visits a malicious site with plugin
The fix
The vendor released a patch on 2025-12-19.
How it was found
- Assign a Calculate action callback to a Barcode form field.
- Trigger the callback by calling getField on that field.
- In the callback, delete the page, which frees the form field object.
- The freed object is then dereferenced, 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, one of those programs deletes a page while the reader is still using information about a form field on that page, so the reader later reads memory that has already been handed back. That kind of mistake can let an attacker control what the program does next, potentially running 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.