ClamAV Remote Command Transmitter - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/misc/clamav_control metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: ClamAV Remote Command Transmitter
Module: auxiliary/scanner/misc/clamav_control
Source code: modules/auxiliary/scanner/misc/clamav_control.rb
Disclosure date: 2016-06-08
Last modification time: 2020-05-12 22:15:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3310
List of CVEs: -

In certain configurations, ClamAV will bind to all addresses and listen for commands. This module sends properly-formatted commands to the ClamAV daemon if it is in such a configuration.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/misc/clamav_control
msf auxiliary(clamav_control) > show options
    ... show and set options ...
msf auxiliary(clamav_control) > set RHOSTS ip-range
msf auxiliary(clamav_control) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(clamav_control) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(clamav_control) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(clamav_control) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


ClamAV is an open source antivirus engine for detecting trojans, viruses, malare, and other malicious threats.

clamav_control takes advantage of a possible misconfiguration in the ClamAV service on release 0.99.2 if the service is tied to a socket, and allows you fingerprint the version, and being able to shut down the service.

Vulnerable Application


To install ClamAV from Ubuntu:

$ sudo apt-get install clamav clamav-daemon
$ sudo freshclam

You might also need to add the following to /etc/clamav/clamd.conf:

# TCP port address.
# Default: no
TCPSocket 3310

# TCP address.
# By default we bind to INADDR_ANY, probably not wise.
# Enable the following to provide some degree of protection
# from the outside world.
# Default: no
TCPAddr 0.0.0.0

# Maximum length the queue of pending connections may grow to.
# Default: 15
MaxConnectionQueueLength 30

# Clamd uses FTP-like protocol to receive data from remote clients.
# If you are using clamav-milter to balance load between remote clamd daemons
# on firewall servers you may need to tune the options below.

# Close the connection when the data size limit is exceeded.
# The value should match your MTA's limit for a maximum attachment size.
# Default: 10M
StreamMaxLength 55M

# Limit port range.
# Default: 1024
#StreamMinPort 30000
# Default: 2048
#StreamMaxPort 32000

# Maximum number of threads running at the same time.
# Default: 10
MaxThreads 50

# Waiting for data from a client socket will timeout after this time (seconds).
# Value of 0 disables the timeout.
# Default: 120
ReadTimeout 300

# Waiting for a new job will timeout after this time (seconds).
# Default: 30
#IdleTimeout 60

# Maximum depth directories are scanned at.
# Default: 15
#MaxDirectoryRecursion 20

And finally, start the service:

$ sudo /etc/init.d/clamav-daemon start

Options


clamav_control comes with two actions:

VERSION

This is the default action, and shows you the ClamAV version. Output example:

msf auxiliary(clamav_control) > run

[+] 192.168.1.203:3310    - ClamAV 0.98.7/21772/Wed Jun 22 12:54:15 2016

SHUTDOWN

This action allows you to shutdown ClamAV. You can also use the VERSION action again to verify whether is service is down or not.

Go back to menu.

Msfconsole Usage


Here is how the scanner/misc/clamav_control auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/misc/clamav_control

msf6 auxiliary(scanner/misc/clamav_control) > show info

       Name: ClamAV Remote Command Transmitter
     Module: auxiliary/scanner/misc/clamav_control
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2016-06-08

Provided by:
  Alejandro Hdeza
  bwatters-r7
  wvu <[email protected]>

Available actions:
  Name      Description
  ----      -----------
  SHUTDOWN  Kills ClamAV Daemon
  VERSION   Get Version Information

Check supported:
  No

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT    3310             yes       The target port (TCP)
  THREADS  1                yes       The number of concurrent threads (max one per host)

Description:
  In certain configurations, ClamAV will bind to all addresses and 
  listen for commands. This module sends properly-formatted commands 
  to the ClamAV daemon if it is in such a configuration.

References:
  https://twitter.com/nitr0usmx/status/740673507684679680/photo/1
  https://github.com/vrtadmin/clamav-faq/raw/master/manual/clamdoc.pdf

Module Options


This is a complete list of options available in the scanner/misc/clamav_control auxiliary module:

msf6 auxiliary(scanner/misc/clamav_control) > show options

Module options (auxiliary/scanner/misc/clamav_control):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT    3310             yes       The target port (TCP)
   THREADS  1                yes       The number of concurrent threads (max one per host)

Auxiliary action:

   Name     Description
   ----     -----------
   VERSION  Get Version Information

Advanced Options


Here is a complete list of advanced options supported by the scanner/misc/clamav_control auxiliary module:

msf6 auxiliary(scanner/misc/clamav_control) > show advanced

Module advanced options (auxiliary/scanner/misc/clamav_control):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   CHOST                                 no        The local client address
   CPORT                                 no        The local client port
   ConnectTimeout       10               yes       Maximum number of seconds to establish a TCP connection
   Proxies                               no        A proxy chain of format type:host:port[,type:host:port][...]
   SSL                  false            no        Negotiate SSL/TLS for outgoing connections
   SSLCipher                             no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode        PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   SSLVersion           Auto             yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   ShowProgress         true             yes       Display progress messages during a scan
   ShowProgressPercent  10               yes       The interval in percent that progress should be shown
   VERBOSE              false            no        Enable detailed status messages
   WORKSPACE                             no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the scanner/misc/clamav_control module can do:

msf6 auxiliary(scanner/misc/clamav_control) > show actions

Auxiliary actions:

   Name      Description
   ----      -----------
   SHUTDOWN  Kills ClamAV Daemon
   VERSION   Get Version Information

Evasion Options


Here is the full list of possible evasion options supported by the scanner/misc/clamav_control auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/misc/clamav_control) > show evasion

Module evasion options:

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   TCP::max_send_size  0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay     0                no        Delays inserted before every send.  (0 = disable)

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Alejandro Hdeza
  • bwatters-r7
  • wvu

Version


This page has been produced using Metasploit Framework version 6.2.29-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.