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

Shell Command Injection #8

Open
susemeee opened this issue Dec 14, 2018 · 2 comments
Open

Shell Command Injection #8

susemeee opened this issue Dec 14, 2018 · 2 comments

Comments

@susemeee
Copy link

Due to the using of /bin/sh -c blablabla... it can execute an arbitrary command with forged 'input'.
i.e.

const qpdf = require('node-qpdf');
qpdf.decrypt('/the/path/of/filename.pdf; ls -al; rm -rf /', 'somepassword');

It could take a time to resolve this issue, but at least it should be documented(to avoid putting arbitrary path on a first argument).

@evolutionxbox
Copy link

If the first argument used path.resolve would that help mitigate injection?

const path = require('path');
const qpdf = require('node-qpdf');
const injectString = '/the/path/of/filename.pdf; ls -al; rm -rf /';
qpdf.decrypt(path.resolve(__dirname, injectString), 'somepassword');

@sawmurai
Copy link

sawmurai commented Jan 5, 2021

The problem also exists in the encrypt method. You can for example prove $(echo hello > file) as a password and it will be executed.

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

3 participants