Vulnerabilities in pkg:npm/phantom-html-to-pdf

PACKAGE
Advisory Identifier: GHSA-6h7f-qwqm-35pp
Advisory Summary

CVE-2020-7763 is a HIGH (CVSS 7.5) arbitrary file read vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Phantom html to pdf libraries in the npm ecosystem. The issue involves arbitrary file read in phantom-html-to-pdf. Remediation is available by upgrading affected packages to version 0.6.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/phantom-html-to-pdf

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/phantom-html-to-pdf. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-6h7f-qwqm-35pp CVE-2020-7763 HIGH Arbitrary File Read in phantom-html-to-pdf

CVE-2020-7763 at a Glance

CVE Identifier CVE-2020-7763
GHSA Identifier GHSA-6h7f-qwqm-35pp
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Phantom html to pdf
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-2020-7763

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

phantom-html-to-pdf fixed: 0.6.2
npm install phantom-html-to-pdf@0.6.2
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 phantom-html-to-pdf

How to Check if You Are Affected

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

npm ls phantom-html-to-pdf

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

Note: The npm ls phantom-html-to-pdf 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Phantom html to pdf, 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

This affects the package phantom-html-to-pdf before 0.6.1. ### PoC ```js var fs = require('fs') var conversion = require("phantom-html-to-pdf")(); conversion.allowLocalFilesAccess = false conversion({ html: "document.write(window.location='c:/windows/win.ini')" }, function(err, pdf) { var output = fs.createWriteStream('output.pdf') console.log(pdf.logs); console.log(pdf.numberOfPages); pdf.stream.pipe(output); }); ```

CVE-2020-7763 Affected Phantom html to pdf Versions

1 component(s)
Fixed Versions:
0.6.2
Product / Package Ecosystem Affected Versions Fixed Version
phantom-html-to-pdf
npm
< 0.6.2
0.6.2

References

Frequently Asked Questions

What is CVE-2020-7763?
CVE-2020-7763 is a security vulnerability in Phantom html to pdf involving Arbitrary File Read in phantom-html-to-pdf under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Phantom html to pdf versions are affected?
Affected versions include releases prior to 0.6.2 across affected packages: phantom-html-to-pdf.
What version fixes CVE-2020-7763?
Upgrading to 0.6.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phantom-html-to-pdf affected?
Yes, phantom-html-to-pdf is affected in releases prior to 0.6.2. Upgrade your dependency to 0.6.2 or later.
What is the CVSS score of CVE-2020-7763?
CVE-2020-7763 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-2020-7763?
CVE-2020-7763 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2020-7763?
Run the dependency tree command: 'npm ls phantom-html-to-pdf'. 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-6h7f-qwqm-35pp",
  "modified" : "2023-09-07T22:36:42Z",
  "published" : "2020-11-06T18:06:16Z",
  "aliases" : [ "CVE-2020-7763" ],
  "summary" : "Arbitrary File Read in phantom-html-to-pdf",
  "details" : "This affects the package phantom-html-to-pdf before 0.6.1.\n\n### PoC\n```js\nvar fs = require('fs') var conversion = require(\"phantom-html-to-pdf\")();\nconversion.allowLocalFilesAccess = false conversion({\n    html: \"document.write(window.location='c:/windows/win.ini')\"\n}, function(err, pdf) {\n    var output = fs.createWriteStream('output.pdf') console.log(pdf.logs);\n    console.log(pdf.numberOfPages);\n    pdf.stream.pipe(output);\n});\n```",
  "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" : "phantom-html-to-pdf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 0.6.1"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7763"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pofider/phantom-html-to-pdf/commit/b5d2da2639a49a95e0bdb3bc0c987cb6406b8259"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-PHANTOMHTMLTOPDF-1023598"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/phantom-html-to-pdf"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-11-06T18:02:24Z",
    "nvd_published_at" : "2020-11-05T14:15:00Z"
  }
}