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

huntr.dev - Command Injection #66

Closed
huntr-helper opened this issue Apr 2, 2020 · 6 comments
Closed

huntr.dev - Command Injection #66

huntr-helper opened this issue Apr 2, 2020 · 6 comments

Comments

@huntr-helper
Copy link
Contributor

This issue has been generated on-behalf of Mik317 (https://huntr.dev/app/users/Mik317)

Vulnerability Description

The issue occurs because a user input is formatted inside a command that will be executed without any check. The issue arises here: https://github.com/Node-Virtualization/node-virtualbox/blob/master/lib/virtualbox.js#L58

Steps To Reproduce:

  1. Create the following PoC file:
// poc.js
var virtualbox = require('virtualbox');
virtualbox.start('machine_name"; touch HACKED; # ', true, function start_callback(error) {
  if (error) throw error;
  console.log("Virtual Machine has started WITH A GUI!");
});
  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
npm i virtualbox # Install affected module
node poc.js #  Run the PoC
  1. Recheck the files: now HACKED has been created

Bug Bounty

We have opened up a bounty for this issue on our bug bounty platform. Want to solve this vulnerability and get rewarded 💰? Go to https://huntr.dev/

@michaelsanford
Copy link
Member

Hi @Mik317

Please see

I'm open to a PR and have tagged this Up for Grabs.

The way to do this properly is probably to whitelist all permutations of vboxmanage verbs and options.

@JamieSlome
Copy link
Contributor

@michaelsanford - please see #67 for a suggested fix! 🍰

@Mik317
Copy link

Mik317 commented Apr 10, 2020

Hi @michaelsanford :),
thank you for mentioning me and yeah, it's the better way.
Regarding the comment on that issue, I think that code should be security-based, mostly because NodeJS modules aren't webapps themselves, but are modules that can be embedded in really different contexts/scenarios, and sometimes in an unsecure way.
Thank again for your help :).

I saw the fix that has been proposed, and I can confirm the issue is fixed properly through this.
However, I'd like to point your attention to the line 7221596#diff-a28666d942289985393e05fe615f9300R38 it's present the exec function which isn't however imported, it should be execFile :)

Best, Mik

@colonelpopcorn
Copy link
Member

@Mik317 I'd like to get this merged into master and make a new release, but there's some code quality checks that need to be addressed here.
Thanks,
Jonathan Ling

JamieSlome added a commit to 418sec/node-virtualbox that referenced this issue Apr 30, 2020
@JamieSlome
Copy link
Contributor

@Mik317 @colonelpopcorn - I have made the code quality changes requested and updated the exec to the newly updated execFile.

Let me know your thoughts and if you are happy to merge! 🍰

@colonelpopcorn
Copy link
Member

This one's been merged in!

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

No branches or pull requests

5 participants