Command Injection Affecting clamscan Open this link in a new tab package, versions <1.3.0


0.0
low
  • Exploit Maturity

    Proof of concept

  • Attack Complexity

    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 + "&"}});