LMD (Linux Malware Detect) es un detector de malware de código abierto para sistemas operativos Linux. LMD está especialmente diseñado para entornos de alojamiento compartido para detectar y eliminar amenazas en el archivo de los usuarios.
En esta guía, instalaremos Linux Malware Detect (LMD) con ClamAV en Debian 9 /
Instalar Linux Malware Detect en Debian
LMD no está disponible en los repositorios base como un paquete preconstruido, pero puede obtener LMD como tarball desde el sitio web oficial del proyecto.
Descargar la última versión de LMD (v1.6.2) usando el siguiente comando.
cd /tmp/ curl -O http://www.rfxn.com/downloads/maldetect-current.tar.gz
Descomprima el tarball usando el comando tar .
tar -zxvf maldetect-current.tar.gz
Vaya al directorio extraído.
cd maldetect-1.6.2/
Ejecute el script de instalación install.sh presente en el directorio extraído.
bash install.sh
Salida:
Created symlink /etc/systemd/system/multi-user.target.wants/maldet.service → /usr/lib/systemd/system/maldet.service. update-rc.d: error: unable to read /etc/init.d/maldet Linux Malware Detect v1.6 (C) 2002-2017, R-fx Networks <[email protected]> (C) 2017, Ryan MacDonald <[email protected]> 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(933): {sigup} performing signature update check... maldet(933): {sigup} local signature set is version 2017070716978 maldet(933): {sigup} new signature set (201708255569) available maldet(933): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-sigpack.tgz maldet(933): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-cleanv2.tgz maldet(933): {sigup} verified md5sum of maldet-sigpack.tgz maldet(933): {sigup} unpacked and installed maldet-sigpack.tgz maldet(933): {sigup} verified md5sum of maldet-clean.tgz maldet(933): {sigup} unpacked and installed maldet-clean.tgz maldet(933): {sigup} signature set update completed maldet(933): {sigup} 15218 signatures (12485 MD5 | 1954 HEX | 779 YARA | 0 USER)
Configurar detección de malware de Linux
/usr/local/maldetect/conf.maldet es el archivo de configuración principal de LMD. Puede modificar sus parámetros según sus requisitos.
nano /usr/local/maldetect/conf.maldet
A continuación se encuentran las pocas configuraciones que debe tener en LMD para detectar y eliminar con éxito las amenazas de malware.
# Enable Email Alerting email_alert="1" # Email Address in which you want to receive scan reports email_addr="[email protected]" # Use with ClamAV scan_clamscan="1" # Enable scanning for root-owned files. Set 1 to disable. scan_ignore_root="0" # Move threats to quarantine quarantine_hits="1" # Clean string based malware injections quarantine_clean="1" # Suspend user if malware found. quarantine_suspend_user="1" # Minimum userid value that be suspended quarantine_suspend_user_minuid="500"
Si no desea utilizar LMD con ClamAV, omita la parte siguiente.
Detección de malware de Linux con ClamAV
LMD funciona mejor con ClamAV, especialmente cuando se trata de escanear grandes conjuntos de archivos. Clam AV (Clam Antivirus) es un motor antivirus de código abierto para detectar virus, malware, troyanos y otras amenazas maliciosas.
ClamAV está disponible en el repositorio base, por lo que puede usar el comando apt para instalarlo.
apt-get -y install clamav clamav-daemon clamdscan
De forma predeterminada, se ha habilitado el uso de ClamAV con LMD.
Escanear con Linux Malware Detect
Probemos la funcionalidad de LMD descargando una firma de virus de muestra del sitio web de EICAR.
cd /tmp wget http://www.eicar.org/download/eicar_com.zip wget http://www.eicar.org/download/eicarcom2.zip
Ahora, escanea el directorio /tmp en busca de malware.
maldet -a /tmp
Salida:
Linux Malware Detect v1.6.2 (C) 2002-2017, R-fx Networks <[email protected]> (C) 2017, Ryan MacDonald <[email protected]> This program may be freely redistributed under the terms of the GNU GPL v2 maldet(4209): {scan} signatures loaded: 15218 (12485 MD5 | 1954 HEX | 779 YARA | 0 USER) maldet(4209): {scan} building file list for /tmp, this might take awhile... maldet(4209): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6 maldet(4209): {scan} file list completed in 0s, found 4 files... maldet(4209): {scan} found clamav binary at /usr/bin/clamscan, using clamav scanner engine... maldet(4209): {scan} scan of /tmp (4 files) in progress... maldet(4209): {scan} processing scan results for hits: 2 hits 0 cleaned maldet(4209): {scan} scan completed on /tmp: files 4, malware hits 2, cleaned hits 0, time 12s maldet(4209): {scan} scan report saved, to view run: maldet --report 171026-1103.4209
A partir del resultado, puede notar que LMD está utilizando el motor de exploración ClamAV para realizar la exploración y logró encontrar dos accesos de malware.
Informe de análisis del detector de malware de Linux
LMD almacena sus informes de análisis en /usr/local/maldetect/sess/ . Use el comando maldet junto con SCAN ID para ver el informe de escaneo detallado.
maldet --report 171026-1103.4209
Salida:
HOST: lmd SCAN ID: 171026-1103.4209 STARTED: Oct 26 2017 11:03:16 +0000 COMPLETED: Oct 26 2017 11:03:28 +0000 ELAPSED: 12s [find: 0s] PATH: /tmp TOTAL FILES: 4 TOTAL HITS: 2 TOTAL CLEANED: 0 FILE HIT LIST: {HEX}EICAR.TEST.10 : /tmp/eicar_com.zip => /usr/local/maldetect/quarantine/eicar_com.zip.296395948 {HEX}EICAR.TEST.10 : /tmp/eicarcom2.zip => /usr/local/maldetect/quarantine/eicarcom2.zip.418410660 =============================================== Linux Malware Detect v1.6.2 < [email protected] >
Actualizar la detección de malware de Linux
Use el siguiente comando para actualizar su LMD.
maldet -d
Para actualizar las firmas LMD, ejecute:
maldet -u
Eso es todo.