Install Linux Malware Detect (LMD) v1.5 on Linux

What is Malware ?

Malware is malicious software which is specifically designed to damage a computer system by gather sensitive information, or gain access to private computer systems. Generally, software package is considered as malware based on the activity/intent of the actual features. On real world most of the malware is generated through advertising (adware), stealing sensitive information (spyware), spreading email spam or child pornography (zombie computers), or to extort money (ransomware). Various factors can make computers more vulnerable to malware attacks, including defects in the operating system design. Type of malware’s are adware, bots, bugs, rootkits, spyware, Trojan horses, viruses, and worms.

What is Linux Malware Detect (LMD) ?

Linux Malware Detect (LMD) is a malware scanner for Linux distribution, Which is released under the GNU GPLv2 license. LMD v1.5 has been released after 2 Years & 7 months with huge bug fixs, changes & added new features on September 19, 2015.

That is especially designed to find the threats in shared hosted environments because in shared environment thousand plus users are sharing the resources. Each and every user will upload different things and script, etc.., 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.

LMD Features

  • MD5 file hash detection for quick threat identification
  • HEX based pattern matching for identifying threat variants
  • statistical analysis component for detection of obfuscated threats (e.g: base64)
  • integrated detection of ClamAV to use as scanner engine for improved performance
  • integrated signature update feature with -u|–update
  • integrated version update feature with -d|–update-ver
  • scan-recent option to scan only files that have been added/changed in X days
  • scan-all option for full path based scanning
  • checkout option to upload suspected malware to rfxn.com for review / hashing
  • full reporting system to view current and previous scan results
  • quarantine queue that stores threats in a safe fashion with no permissions
  • quarantine batching option to quarantine the results of a current or past scans
  • quarantine restore option to restore files to original path, owner and perms
  • quarantine suspend account option to Cpanel suspend or shell revoke users
  • cleaner rules to attempt removal of malware injected strings
  • cleaner batching option to attempt cleaning of previous scan reports
  • cleaner rules to remove base64 and gzinflate(base64 injected malware
  • daily cron based scanning of all changes in last 24h in user homedirs
  • daily cron script compatible with stock RH style systems, Cpanel & Ensim
  • kernel based inotify real time file scanning of created/modified/moved files
  • kernel inotify monitor that can take path data from STDIN or FILE
  • kernel inotify monitor convenience feature to monitor system users
  • kernel inotify monitor can be restricted to a configurable user html root
  • kernel inotify monitor with dynamic sysctl limits for optimal performance
  • kernel inotify alerting through daily and/or optional weekly reports
  • e-mail alert reporting after every scan execution (manual & daily)
  • path, extension and signature based ignore options
  • background scanner option for unattended scan operations
  • verbose logging & output of all actions
  • For Change Log
  • Details about LMD

1) Install Linux Malware Detect (LMD)

There is no .rpm, .dep or PPA is available to install LMD on your system, Also its not included in any of the distro official repository. The only option is left for us to install manual method from source. Here I’m going to show you about LMD installation.

# Downloading LMD archive file #
# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz

# Extracting LMD archive file #
# tar -zxvf maldetect-current.tar.gz

# Navigate to extracted directory #
# cd maldetect-1.5

# Install LMD #
# ./install.sh

2) Configure LMD

The configuration of LMD is handled through /usr/local/maldetect/conf.maldet and all options are well commented for ease of configuration. By default LMD has the auto-qurantine of files disabled and you need to enable it. Also make below changes to make it easier and more efficient to use LMD.

# Open conf.maldet file #
# nano /usr/local/maldetect/conf.maldet

# To get email alert #
email_alert=1

# Add your meail id to get email alert #
[email protected]

# To move malware to quarantine & alert #
quarantine_hits=1

# Clean injected malware #
quarantine_clean=1

# To suspend/disable your wish #
quarantine_suspend_user=0

# To set minimum user id that can be suspended #
quarantine_suspend_user_minuid=500

3) Scan The system

To scan the system using LMD, use maldet followed by directory which you want to scan.

# maldet --scan-all /opt
Linux Malware Detect v1.5
            (C) 2002-2015, R-fx Networks 
            (C) 2015, Ryan MacDonald 
This program may be freely redistributed under the terms of the GNU GPL v2

maldet(4465): {scan} signatures loaded: 10822 (8908 MD5 / 1914 HEX / 0 USER)
maldet(4465): {scan} building file list for /opt, this might take awhile...
maldet(4465): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
maldet(4465): {scan} file list completed in 0s, found 1 files...
maldet(4465): {scan} scan of /opt (1 files) in progress...
maldet(4465): {scan} 1/1 files scanned: 0 hits 0 cleaned
maldet(4465): {scan} scan completed on /opt: files 1, malware hits 0, cleaned hits 0, time 1s
maldet(4465): {scan} scan report saved, to view run: maldet --report 151218-2043.4465

The above command will scan entire support.2daygeek.comm directory. It may take time depending upon no of files in that directory.

4) Printing Scan Report

To view scan report, use maldet command followed by SCAN ID which you got from previous output. Output stored under /usr/local/maldetect/sess/ directory.

# maldet --report 151218-2043.4465

HOST:      2daygeek
SCAN ID:   151218-2043.4465
STARTED:   Dec 18 2015 20:43:23 +0530
COMPLETED: Dec 18 2015 20:43:24 +0530
ELAPSED:   1s [find: 0s]

PATH:          /opt
TOTAL FILES:   1
TOTAL HITS:    0
TOTAL CLEANED: 0

===============================================
Linux Malware Detect v1.5 < [email protected] >

5) Removing injected files

In my causes no injection file is there. If you got output with malware injection on your system, use the below commands to remove it.

# To quarantine the infected files #
# maldet -q SCANID

# To clean infected files #
# maldet -n SCANID

6) LMD & signatures Update to latest

Use below both command to update your LMD version & virus signatures to latest.

# Update the installed version from rfxn.com #
# maldet -d

# Update malware detection signatures from rfxn.com #
# maldet -u

7) Live Monitoring

If you want to actively monitor specific directories for malware infection, you can run maldet as a daemon like below. This can be clubbed with inotify-tools, so you have to install the package to run live monitor.

# apt-get install inotify-tools

# maldet -m /home/daygeek
Linux Malware Detect v1.5
            (C) 2002-2015, R-fx Networks 
            (C) 2015, Ryan MacDonald 
This program may be freely redistributed under the terms of the GNU GPL v2

maldet(5814): {mon} set inotify max_user_watches to 49152
maldet(5814): {mon} added /home/daygeek to inotify monitoring array
maldet(5814): {mon} starting inotify process on 1 paths, this might take awhile...
maldet(5814): {mon} inotify startup successful (pid: 5912)
maldet(5814): {mon} inotify monitoring log: /usr/local/maldetect/logs/inotify_log

Use the tail command with above log location to view live monitor.

8) Automatic Scan

While installing LMD, it will drop the auto scan file to /etc/cron.daily/maldet which will perform a daily update of signatures and keep the session, temp and quarantine data upto 14 days. Also run a daily scan of recent file system changes.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...

Close
Please support the site
By clicking any of these buttons you help our site to get better