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

Fixed Command Injection Security Issue #1

Closed
wants to merge 1 commit into from

Conversation

realgam3
Copy link

After finding command injection vulnerability in the code,
I made a new package to fix this issue...

About Command Injection: https://www.owasp.org/index.php/Command_Injection

Vulnerable Code example:

var ws = require('windows-shortcuts');  

var payload = "calc.exe";
var link_path = '%USERPROFILE%/Desktop/';  
var appName = 'Facebook" && ' + payload + ' && echo "';  
var icon_path = '%WINDIR%/notepad.exe';  

ws.create(link_path + appName + ".lnk", {    
    icon: icon_path  
});  

This code will run calc.exe while creating the shortcut.

You can double check my code to be sure the it didn't break the functionality.

@j201
Copy link
Owner

j201 commented Aug 11, 2015

Sorry I haven't gotten back to you on this. I've been out of the loop on my github repos recently, but I hope to get back to you on this soon.

As far as injection security goes, my original use cases for this were more for automation utilities that wouldn't take untrusted input. But I agree that it makes sense for it to handle untrusted input.

For a security application such as this, I would generally prefer a module that's seen more real world use. I don't want to pass judgement on node-php-escape-shell itself, I would just feel more comfortable with a more tested package. I'd also like to look at the code and API first to see if the vulnerability can be avoided without explicit escaping.

(Also, at this point, I agree that package.json should use 2 spaces. I was hoping for it to be configurable, or at least use tabs so users could choose their own indents, but isaacs seems to be of the opinion that npm isn't responsible for its JSON, even though --save and --save-dev have become part of many npm workflows. Oh well.)

@realgam3 realgam3 closed this Jul 14, 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

Successfully merging this pull request may close these issues.

None yet

2 participants