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

Command injection #128

Closed
Peter-Maguire opened this issue Oct 16, 2020 · 6 comments
Closed

Command injection #128

Peter-Maguire opened this issue Oct 16, 2020 · 6 comments

Comments

@Peter-Maguire
Copy link

The ping input is not sanitised, so something like

const response = await ping.promise.probe('localhost;id', {});

Will execute id and print the output in response

@mondwan
Copy link
Collaborator

mondwan commented Oct 17, 2020 via email

@Peter-Maguire
Copy link
Author

Why is enabling shell a requirement? You could remove characters from the input like &;| and remove most of the problems.

@eternalharvest
Copy link
Contributor

@mondwan

I'm agree with @UnacceptableUse if there is no reason to enable shell option of child_process#spawn() call.
I wonder why shell option is needed, it seems working without enabling this option.
Please tell me if I am misunderstanding.

@m-rousse
Copy link

Enabling the shell option also prevents the error from being raised in lib/ping-promise.js#L64 as it is treated as output on stderr and not as a faulty exit code.
So I’m also in favor of disabling shell here.

mondwan pushed a commit that referenced this issue Dec 19, 2020
@mondwan
Copy link
Collaborator

mondwan commented Dec 19, 2020

Hi all, I have just set shell to False as requested, and I have pushed that commit to master :D

so... let's see whether what will happen afterwards :D

@mondwan
Copy link
Collaborator

mondwan commented Dec 26, 2020

Patches are available on 0.4.0. Reopen this issue if there are things to follow up

@mondwan mondwan closed this as completed Dec 26, 2020
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

4 participants