PhantomJS Arbitrary File Read Vulnerability in phantomjs

phantomjs Updated 02 Oct 2025

Summary

24/05/2022
No i
High
7.5

CVE-2019-17221: PhantomJS Arbitrary File Read. Affects phantomjs versions < 2.1.1. No fix is published. How to fix ↓

Also tracked for

The same CVE-2019-17221 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

PhantomJS is an open-source headless web browser that allows users to automate web page interaction, perform web scraping, and generate screenshots or PDFs of web pages. It provides a JavaScript API for controlling various browser functionalities. However, PhantomJS versions up to 2.1.1 are affected by an arbitrary file read vulnerability.

Vulnerability Detail

The vulnerability exists in the page.open() function of the webpage module in PhantomJS. This function is responsible for loading a specified URL and calling a given callback. An attacker can exploit this vulnerability by supplying a specially crafted HTML file as user input. By leveraging this vulnerability, an attacker can read arbitrary files on the filesystem. For example, if the page.render() function is used as the callback, it can generate a PDF or an image of the targeted file. This vulnerability poses a significant risk as it allows unauthorized access to sensitive files and can lead to information disclosure.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a workaround, it is advised to implement input validation and sanitization for user-supplied URLs. Additionally, it is crucial to restrict access to sensitive files and directories by implementing proper file permissions and access controls. Regularly monitoring and auditing file access logs can also help detect any unauthorized attempts to read files.

Conclusion

PhantomJS versions up to 2.1.1 are affected by an arbitrary file read vulnerability, which allows unauthorized access to sensitive files on the filesystem. To mitigate this vulnerability, it is recommended to upgrade to a non-affected version of PhantomJS or consider migrating to other actively maintained headless browser solutions. Regular monitoring and auditing of file access logs can also help detect any unauthorized attempts to read files. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for phantomjs →

Share this vulnerability

FAQ

PhantomJS is an open-source headless web browser that allows users to automate web page interaction, perform web scraping, and generate screenshots or PDFs of web pages.

This vulnerability allows an attacker to read arbitrary files on the filesystem, potentially leading to unauthorized access to sensitive information.

To fix this vulnerability, it is recommended to upgrade to a version of PhantomJS that is not affected by this issue. However, considering that PhantomJS is no longer actively developed, it is advisable to migrate to other actively maintained headless browser solutions.

As a workaround, it is advised to implement input validation and sanitization for user-supplied URLs. Additionally, proper file permissions and access controls should be implemented to restrict access to sensitive files and directories.

Yes, there are alternative headless browser solutions available that are actively maintained and regularly updated with security patches. Consider exploring these alternatives as a replacement for PhantomJS.

Related vulnerabilities

Recent vulnerabilities recorded for phantomjs.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback