Vulnerabilities in pkg:npm/phantomjs

PACKAGE
Advisory Identifier: GHSA-x43g-gj9x-838x
Advisory Summary

CVE-2019-17221 is a HIGH (CVSS 7.5) phantomjs arbitrary file read vulnerability (CWE-552: Files or Directories Accessible to External Parties) affecting Phantomjs libraries in the npm ecosystem. The issue involves phantomjs arbitrary file read. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/phantomjs

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/phantomjs. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-x43g-gj9x-838x CVE-2019-17221 HIGH PhantomJS Arbitrary File Read

CVE-2019-17221 at a Glance

CVE Identifier CVE-2019-17221
GHSA Identifier GHSA-x43g-gj9x-838x
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-552: Files or Directories Accessible to External Parties
Affected Product Phantomjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2019-17221

To remediate this vulnerability, upgrade all affected Phantomjs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

phantomjs fixed: Latest secure release
npm install phantomjs@Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls phantomjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2019-17221, inspect your project dependencies using npm:

npm ls phantomjs

Analyze the terminal output to locate any version of Phantomjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls phantomjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-552: Files or Directories Accessible to External Parties, where the product makes files or directories accessible to unauthorized actors, even though they should not be. In Phantomjs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

PhantomJS through 2.1.1 has an arbitrary file read vulnerability, as demonstrated by an XMLHttpRequest for a `file://` URI. The vulnerability exists in the `page.open()` function of the webpage module, which loads a specified URL and calls a given callback. An attacker can supply a specially crafted HTML file, as user input, that allows reading arbitrary files on the filesystem. For example, if `page.render()` is the function callback, this generates a PDF or an image of the targeted file. **NOTE**: this product is no longer developed.

CVE-2019-17221 Affected Phantomjs Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
phantomjs
npm
≤ 2.1.1

References

Frequently Asked Questions

What is CVE-2019-17221?
CVE-2019-17221 is a security vulnerability in Phantomjs involving PhantomJS Arbitrary File Read under CWE-552: Files or Directories Accessible to External Parties.
Which Phantomjs versions are affected?
Affected versions include releases prior to current release patches across affected packages: phantomjs.
What version fixes CVE-2019-17221?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is phantomjs affected?
Yes, phantomjs is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2019-17221?
CVE-2019-17221 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2019-17221?
CVE-2019-17221 is classified under CWE-552: Files or Directories Accessible to External Parties (The product makes files or directories accessible to unauthorized actors, even though they should not be.).
How can I check npm dependencies for CVE-2019-17221?
Run the dependency tree command: 'npm ls phantomjs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x43g-gj9x-838x",
  "modified" : "2023-10-19T18:55:53Z",
  "published" : "2022-05-24T22:01:03Z",
  "aliases" : [ "CVE-2019-17221" ],
  "summary" : "PhantomJS Arbitrary File Read",
  "details" : "PhantomJS through 2.1.1 has an arbitrary file read vulnerability, as demonstrated by an XMLHttpRequest for a `file://` URI. The vulnerability exists in the `page.open()` function of the webpage module, which loads a specified URL and calls a given callback. An attacker can supply a specially crafted HTML file, as user input, that allows reading arbitrary files on the filesystem. For example, if `page.render()` is the function callback, this generates a PDF or an image of the targeted file. **NOTE**: this product is no longer developed.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "phantomjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-17221"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Medium/phantomjs"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20191220171022/https://www.darkmatter.ae/blogs/breaching-the-perimeter-phantomjs-arbitrary-file-read"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-552" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-19T18:55:53Z",
    "nvd_published_at" : "2019-11-05T14:15:00Z"
  }
}