Foxit PDF Reader Javascript Search Query Remote Code Execution Vulnerability
A use-after-free vulnerability in Foxit PDF Reader's JavaScript engine allows an attacker to execute arbitrary code by tricking a user into opening a malicious PDF. The flaw occurs when JavaScript continues to run after the document is closed, and a call to the search query method reuses a freed object.
Originally disclosed on Cisco Talos
An exploitable use-after-free vulnerability exists in the JavaScript engine of Foxit Software’s Foxit PDF Reader version 8.3.2.25013. A specially crafted PDF document can trigger a previously freed object in memory to be reused, resulting 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
The JavaScript engine allows code to continue executing after the document is closed, and the search query method does not properly handle the freed object, leading to a use-after-free.
Impact
An attacker could execute arbitrary code on the victim's machine by convincing them to open a malicious PDF, or by having them visit a malicious site if the browser plugin is enabled.
What the attacker needed
Victim opens malicious PDF; or visits malicious site with plugin
The fix
The vendor released a patch on 2018-04-19 that fixes the issue.
How it was found
- Create a PDF with embedded JavaScript that calls this.closeDoc() and then this.search.query().
- Open the PDF in Foxit Reader.
- The JavaScript executes, closing the document and then invoking the search query method on a freed object, causing a crash or 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.
When a PDF is closed, the program frees memory it was using. But if JavaScript is still running, it might try to use that freed memory, which can be controlled by an attacker to run their own code. This is called a use-after-free bug.
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.