Công cụ scan hệ thống nếu nghi ngờ server bị hack

Đảm bảo server của bạn hoàn toàn sạch, chúng ta sẽ scan toàn bộ hệ thống bằng 3 công cụ: maldet, rkhunter, lynis.

INSTALL MALDET (Linux Malware Detect):

cd /usr/local/src
sudo wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
sudo tar -xzf maldetect-current.tar.gz
cd maldetect-*
sudo ./install.sh

Sau cài đặt, binary sẽ nằm ở /usr/local/maldetect/maldet

CẬP NHẬT MALWARE DEFINITIONS:

sudo maldet --update

SCAN TOÀN BỘ SERVER:

sudo maldet --scan-all /

⏳ Sẽ mất thời gian (vài phút đến vài giờ tuỳ dung lượng).

👉 Kết quả lưu tại /usr/local/maldetect/sess/

👉 Xem log scan gần nhất:

sudo maldet --report SCANID

INSTALL RKHUNTER (Rootkit Hunter):

CÀI ĐẶT:

sudo yum install epel-release -y
sudo yum install rkhunter -y

Hoặc tải trực tiếp (nếu repo không có):

cd /usr/local/src
sudo wget https://sourceforge.net/projects/rkhunter/files/latest/download -O rkhunter.tar.gz
sudo tar -xzf rkhunter.tar.gz
cd rkhunter-*
sudo ./installer.sh --install

UPDATE DATABASE RKHUNTER:

sudo rkhunter --update
sudo rkhunter --propupd

--propupd: lưu trạng thái file hiện tại → để sau này phát hiện thay đổi.

CHẠY SCAN:

sudo rkhunter --check --sk

Kết quả hiển thị trên terminal + log tại /var/log/rkhunter.log

INSTALL LYNIS (System Audit Tool):

CÀI ĐẶT:

sudo yum install epel-release -y
sudo yum install lynis -y

Hoặc tải tay:

cd /usr/local/src
sudo wget https://downloads.cisofy.com/lynis/lynis-3.0.9.tar.gz
sudo tar -xzf lynis-*.tar.gz
cd lynis

→ chạy trực tiếp từ folder.

CHẠY AUDIT FULL:

sudo lynis audit system

Report sẽ hiển thị trực tiếp, file log: /var/log/lynis.log
Report summary: /var/log/lynis-report.dat

Kết luận.

maldet: tập trung tìm malware, webshell PHP, file nghi ngờ
rkhunter: tập trung tìm rootkit, file hệ thống thay đổi, backdoor kernel
lynis: kiểm tra cấu hình bảo mật, quyền, config sai sót