How To: Install and run Linux Maldet (Linux)

  Security, Tools

Linux Malware Detect (LMD) is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection.

In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. The signatures that LMD uses are MD5 file hashes and HEX pattern matches, they are also easily exported to any number of detection tools such as ClamAV.

Installation

SSH into the server and run the commands below:

[cc]
cd /ips1
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -zxvf maldetect-current.tar.gz
cd maldetect-1.x.x
./install.sh
[/cc]

After the installation gets completed, it will show

[cc]
Linux Malware Detect v1.4.2
(C) 2002-2013, R-fx Networks <proj@r-fx.org>
(C) 2013, Ryan MacDonald <ryan@r-fx.org>
inotifywait (C) 2007, Rohan McGovern <rohan@mcgovern.id.au>
This program may be freely redistributed under the terms of the GNU GPL

installation completed to /usr/local/maldetect
config file: /usr/local/maldetect/conf.maldet
exec file: /usr/local/maldetect/maldet
exec link: /usr/local/sbin/maldet
exec link: /usr/local/sbin/lmd
cron.daily: /etc/cron.daily/maldet

maldet(328194): {sigup} performing signature update check…
maldet(328194): {sigup} local signature set is version 201205035915
maldet(328194): {sigup} new signature set (2014082316728) available
maldet(328194): {sigup} downloaded http://cdn.rfxn.com/downloads/md5.dat
maldet(328194): {sigup} downloaded http://cdn.rfxn.com/downloads/hex.dat
maldet(328194): {sigup} downloaded http://cdn.rfxn.com/downloads/rfxn.ndb
maldet(328194): {sigup} downloaded http://cdn.rfxn.com/downloads/rfxn.hdb
maldet(328194): {sigup} downloaded http://cdn.rfxn.com/downloads/maldet-clean.tgz
maldet(328194): {sigup} signature set update completed
maldet(328194): {sigup} 11788 signatures (9895 MD5 / 1893 HEX)
[/cc]

Configuration

Maldet can be configured by editing the file below:

[cc]
vi /usr/local/maldetect/conf.maldet
[/cc]

The default configuration should be as below:

[cc]
# [ EMAIL ALERTS ]
##
# The default email alert toggle
# [0 = disabled, 1 = enabled]
email_alert=1

# The subject line for email alerts
email_subj=”maldet alert from $(hostname)”

# The destination addresses for email alerts
# [ values are comma (,) spaced ]
email_addr=”youremail@yourdomain.com”

# Ignore e-mail alerts for reports in which all hits have been cleaned.
# This is ideal on very busy servers where cleaned hits can drown out
# other more actionable reports.
email_ignore_clean=0

##
# [ QUARANTINE OPTIONS ]
##
# The default quarantine action for malware hits
# [0 = alert only, 1 = move to quarantine & alert]
quar_hits=1

# Try to clean string based malware injections
# [NOTE: quar_hits=1 required]
# [0 = disabled, 1 = clean]
quar_clean=1

# The default suspend action for users wih hits
# Cpanel suspend or set shell /bin/false on non-Cpanel
# [NOTE: quar_hits=1 required]
# [0 = disabled, 1 = suspend account]
quar_susp=0
# minimum userid that can be suspended
quar_susp_minuid=500
[/cc]

You may edit the following values to configure Maldet to your needs.

Running a scan

Maldet is usually used to scan files under certain users for malware infections, but can also be used to scan the entire /home folder.

You can be in any directory/path when you run the commands below.
However, make sure to run it in a screen session so that the scan doesn’t get interrupted.
[cc]
maldet -a /home/$user
maldet -a /home
[/cc]

If auto-quarantine is enabled, and the file is automatically put in quarantine, you can find out how to find and restore them by following the guide below:

How To : Restore Maldet Alert