Comparisons 5 min read

ClamAV vs Maldet: Which Malware Scanner for a Web Server?

ClamAV is a general antivirus engine. Maldet was built for hacked websites. On a web server the useful question is how to combine them, and what to add on top.

By BashPilot Team
BashSecure Malware & vulnerability protection Scan, find and remove malware across every hosted account. Explore BashSecure

ClamAV versus Maldet sounds like a choice between two scanners, but on a web server it is closer to a choice of how to combine them. ClamAV is a general-purpose antivirus engine. Linux Malware Detect, usually called Maldet or LMD, was designed around what turns up on hacked hosting accounts, and it can use ClamAV's engine to do the scanning. Knowing what each one is good at saves you from trusting a clean result that means less than it looks.

What each one is built for

ClamAVLinux Malware Detect (Maldet)
FocusGeneral antivirus engine, used widely on mail and file serversWeb hosting threats: PHP shells, injected JavaScript, encoded backdoors
SignaturesClamAV's own databases, updated with freshclamMD5, SHA-256, hex patterns, compound signatures and YARA rules, according to its README
Real-time watchingclamonacc with clamd, using fanotifymaldet -m using inotify, batch-scanned every 15 seconds by default
ResponseReports, and can move or remove files with optionsQuarantine (-q), clean attempts (-n) and restore (-s) per scan
Hosting awarenessNone built inIts daily cron scans recently changed files under detected control panel paths

Public head-to-head tests of the two are old or anecdotal, and results swing with the sample set. That is the honest state of things. Treat any claim that one catches "far more" than the other with suspicion, and test both against your own server.

Use them together

Maldet's README describes an engine priority: a remote or local clamd first, then clamscan, and its own scanner otherwise. In practice that means installing ClamAV first and letting Maldet drive it. You get ClamAV's speed and signatures plus Maldet's hosting-focused rules.

a full scan of hosting accounts, then a recent-changes scan
maldet -a /home/?/public_html
maldet -r /home/?/public_html 2

The first command scans everything under each account's web root. The second scans only files changed in the last two days, which is the one to run regularly. Each run prints a scan ID. Read the report before acting on it, then quarantine the hits from that scan if they are what they look like.

review, quarantine, and restore if needed
maldet --report SCANID
maldet -q SCANID
maldet -s SCANID

Real-time scanning, and its cost

A nightly scan finds yesterday's upload. Watching files as they change shortens that window. ClamAV's on-access scanning runs clamonacc alongside clamd, watching the paths in OnAccessIncludePath, and with OnAccessPrevention it can block access to a malicious file. It needs Linux 3.8 or later, and if the kernel lacks fanotify access permissions it runs in notify-only mode, which reports but cannot block. ClamAV refuses / as an include path, because blocking across the whole filesystem could lock up the system.

Maldet monitoring of hosting users, as a background process
maldet -b -m users
maldet -k

The first command starts Maldet's inotify monitoring of user home directories in the background, and the second stops it. Both real-time approaches use memory and inotify watches, so on a server with millions of files check /proc/sys/fs/inotify/max_user_watches before you turn them on, and watch the load for a day.

What neither of them covers

  • Custom or heavily obfuscated code. A backdoor written for one attack may match no signature. Checking file integrity against known-good releases catches what signatures miss, as shown in Check WordPress for Hacked Files with WP-CLI Checksums.
  • Malicious behaviour at runtime. A file scanner looks at what is on disk. It does not see a request that abuses a vulnerable plugin to run a command without writing a file.
  • The entry point. Neither tool tells you which plugin or password let the attacker in, so removal without a fix leads to reinfection.
  • False positives. Both will sometimes flag legitimate minified or encoded code. Verify before deleting, using the diff method in cPanel Malware Scan False Positive? How to Confirm It.

Where BashSecure fits

ClamAV with Maldet is a sensible free baseline, and plenty of servers should run it. BashSecure is aimed at the gaps in that list. It scans file contents rather than trusting names, watches the filesystem and reports new malicious files within seconds, and adds Live Defense, which observes PHP while it runs and can log or abort a harmful action depending on the mode you choose. It connects detections to the source address, URL, script and hosting account, reports modified WordPress, Joomla and Drupal core files separately from malware, and never labels an account clean when a scan did not finish.

Share LinkedIn X
Questions

Frequently asked questions

Is Maldet better than ClamAV for websites?

Maldet was designed for hosting threats such as PHP shells and injected JavaScript, while ClamAV is a general antivirus engine. They work best together: Maldet can use ClamAV's engine for scanning while keeping its own web-focused signatures. Public comparisons of detection rates are old or anecdotal, so test on your own server.

Does Maldet need ClamAV?

No, Maldet has its own scanner. Its README says that when a ClamAV engine is available it will use it, and the `scan_clamscan` setting defaults to detecting that at runtime. Using ClamAV as the engine normally gives better scanning performance than Maldet's built-in scanner.

Can ClamAV scan files in real time on Linux?

Yes, with on-access scanning. `clamonacc` runs alongside `clamd`, watches the directories listed in `OnAccessIncludePath`, and with `OnAccessPrevention` can block access to malicious files. It needs Linux 3.8 or later and kernel support for fanotify access permissions, or it falls back to notify-only mode.

What does maldet quarantine do to a file?

Maldet moves the file into quarantine and stores it with permissions `000`, so it can no longer be read or executed from the site. You can restore the hits from a scan with `maldet -s SCANID` if they turn out to be legitimate, which is why you should keep the scan ID.

If ClamAV and Maldet find nothing, is the server clean?

Not necessarily. Both rely mostly on known signatures, so a custom backdoor can pass both. Combine scans with integrity checks against official releases, a look for PHP files where none should be, such as upload folders, and a review of recent changes and logs.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.