Foxit Reader Javascript exportDataObject HTA file creation vulnerability
Foxit Reader's JavaScript exportDataObject method fails to validate file extensions and directory traversal, allowing an attacker to create an HTA file in the Windows Startup folder. This leads to arbitrary code execution when the file is launched or on next login.
Originally disclosed on Cisco Talos
An arbitrary file creation vulnerability exists in the Javascript exportDataObject API of Foxit Reader 12.1.3.15356 due to a failure to properly validate a dangerous extension. A specially crafted malicious file can create files at arbitrary locations, 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 application uses a blocklist that includes 'hta ' with a trailing space instead of 'hta', and it fails to sanitise directory traversal sequences in the filename before writing the file.
Impact
An attacker could execute arbitrary code on the victim's machine, but the user must open the malicious PDF or visit a malicious site with the browser plugin enabled.
What the attacker needed
Victim opens malicious PDF; or victim visits malicious site with plugin
The fix
The application should properly filter dangerous extensions (e.g., block 'hta' without trailing space) and sanitise directory traversal sequences in filenames.
How it was found
- Create a PDF with a JavaScript action that calls exportDataObject with a data object name and launch flag set to 2.
- Embed a file with subtype application/hta containing malicious script.
- Define a filespec with a UF key that uses directory traversal to point to the Startup folder and ends with .hta.
- Name the data object to match the embedded file.
- Open the PDF in Foxit Reader; the script extracts the HTA file to the Startup folder.
- The HTA file executes on next login or when launched, running arbitrary code.
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.
Foxit Reader is a program for opening PDF files. It lets PDFs run small scripts, and one script command can save an embedded file to disk. The program meant to block dangerous file types like .hta, but it made a mistake and let .hta through, and it also allowed the script to choose a folder outside the temporary directory. So a malicious PDF could drop a file that runs code when the computer starts.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.