How to scan for malware with Maldet and ClamAV
Install Linux Malware Detect (Maldet) and ClamAV from intoPanel, run a scan of one account or the whole server over SSH, read the report, quarantine and restore files.
Hacked websites usually show it through a web shell, a mass mailer, or code injected into PHP files. Linux Malware Detect (Maldet) is built to find exactly those, and with ClamAV installed it scans with ClamAV's engine and its own signatures together.
Step 1: Install the scanners#
In the admin area, open Add-ons → Malware Scanners (ClamAV) and click Install ClamAV with Maldet, or install only Maldet.
The panel installs a version of Maldet that it pins and checks. Update signatures with the panel's Update signatures button or maldet -u, but do not update the Maldet program itself with maldet -d.
Step 2: Scan one account#
maldet -a /home/USERNAME/public_htmlTo scan only files changed in the last few days, which is much faster:
maldet -r /home/USERNAME/public_html 7Step 3: Scan the whole server#
Large scans are best run in batches from the panel, under Add-ons → Malware Scanners, where they can be scheduled. Over SSH, run it in the background with low priority:
nohup nice -n 19 ionice -c3 maldet -a /home/?/public_html > /root/maldet-scan.log 2>&1 &Step 4: Read the report#
maldet --report list # all scans with their IDs
maldet --report SCANID # the files found by one scanEach hit names the signature, for example {HEX}php.cmdshell.unclassed, and the file.
Step 5: Quarantine, clean or restore#
maldet -q SCANID # move every hit of that scan to quarantine
maldet --clean SCANID # try to remove injected code and put the files back
maldet --restore /home/USERNAME/public_html/wp-content/uploads/x.phpQuarantined files go to /usr/local/maldetect/quarantine, out of the website's reach.
In the panel, the card What Maldet does with what it finds can do this automatically: move hits to quarantine, attempt cleaning, and suspend accounts with hits until you have checked them.
After a hit#
Removing the file is only half the work. Find how it got there:
- Update WordPress, plugins and themes, and remove ones that are not used.
- Change the account's panel, FTP, database and WordPress administrator passwords.
- Look in the website's access log for requests to the malicious file, to find the first one.
- Run the scan again.
Account isolation limits what a hacked website can reach; turn it on under Security → Account Isolation if it is not on yet.
Frequently asked questions
Can clients scan their own files?
Yes, when ClamAV is installed and memory allows: the client area has a virus scanner for the account's own files.
Does Maldet delete files automatically?
By default it only reports. Quarantine and cleaning are switched on in the panel or with maldet -q.
How often should I scan?
Maldet checks recently changed files daily by itself. Add a full scan every week or two, at night, from the panel's schedule.
Something missing? Ask in the community or open a ticket.