Security
Malware scanning
Weekly and realtime scanning of every webspace with ClamAV and Berth's own backdoor detector, scanning of uploads and of everything that enters a site, and quarantine, restore, delete or ignore for each finding.
On this page
Hacked websites are the most common security incident on a hosting server. An outdated plugin lets someone drop a webshell, and from there the site is used for spam, phishing pages or worse. Berth looks for that in several places: when files arrive, continuously while they sit in the webspace, and in a weekly full sweep. When it finds something, the administrator or the customer decides what happens next.
This article covers website files. Scanning of e-mail attachments is described in Spam and antivirus.
What is scanned, and when
| Moment | What happens |
|---|---|
| Weekly scan | Every webspace is scanned in full: the document root, tmp/ and everything next to it. |
| Realtime scan | Every new or changed file in a webspace is scanned as soon as it is written (ClamAV on-access scanning through clamd). On by default on new installs with enough memory. |
| Upload scan | With the WAF on, files uploaded to a PHP site are scanned by ClamAV before the site sees them. An upload with known malware is refused with 403. If the scanner is unavailable, uploads are let through and the Scan uploads card turns red. |
| Scan on entry | Uploads through the panel's file manager and archives unpacked there are scanned straight away. After a restore, a site import, a migration or a Git deploy, Berth scans what changed in the background. |
| On demand | Scan now for one domain, Scan everything now for the server. |
Scans run at low priority in the background, so they do not slow down the sites. A scan that could not finish completely is marked as such on the page, so you know when a result is partial.
Two detection engines
ClamAV provides signature-based detection of known malware, with definitions updated automatically. When clamd runs, all scans share it, so the definitions are only held in memory once.
Berth's own backdoor detector looks at PHP files and at PHP and web server settings in the webspace. It is code-aware: it reads the code the way PHP does, so text in comments, strings and HTML does not trigger it. It reports two kinds of findings:
- Hard findings are code that no legitimate package contains. They are treated like a virus signature and can be quarantined automatically.
- Suspicious findings are patterns that are common in malware but have legitimate uses too. They are reported with file, line and an excerpt, and never quarantined automatically. You judge them.
The detector is tested against the cores of WordPress, Joomla and Drupal and against popular plugins, and gives no findings on them.
Handle a finding
Findings appear on the domain's Malware page and, for administrators, server-wide under Security → Malware. For each finding you choose:
- Quarantine: the file is moved out of reach of the website. The site can no longer load it.
- Restore: puts a quarantined file back with its original owner and permissions, for a false alarm.
- Delete: removes the file for good.
- Ignore: keeps the file and stops reporting it, for a suspicious finding you have checked.
The panel explains what each choice means under What do I do with a finding?. Removing the malware is half the job: also find out how it got in, usually an outdated plugin or a leaked password, and fix that. Vulnerability management and Smart updates help with the first, the history in Restoring data with putting clean files back.
On the server:
berth security malware --sysuser acme # list findings
berth security malware --id 42 --action quarantine # or restore, delete, ignore
berth security scan --sysuser acme --background # scan one subscription
berth security scan --all --background # scan everythingQuarantine a file yourself
If you find a backdoor the scan did not catch, quarantine it yourself. It then appears among the findings, where you can restore or delete it like any other.
- On the domain's malware page: Quarantine a file yourself.
- In the file manager: the Quarantine button next to a file.
- On the server:
berth security malware --domain example.nl --quarantine-path httpdocs/wp-content/uploads/x.phpCustomers can do this themselves
Customers see the Malware page of their own domains, with the same findings, buttons and scan history, and can quarantine, restore, delete or ignore within their own webspace. A restricted login needs the security permission for it. This saves the administrator a support ticket for every infected WordPress site, and the customer sees straight away what was found.
Realtime and upload scanning settings
Both have a card on Security → Malware:
- Realtime scan: on or off, and whether a hard finding goes into quarantine immediately or is only reported.
- Scan uploads: on or off. The card shows honestly whether uploads are really being scanned right now (green), whether scanning is switched on but needs attention (red), or whether it is off (grey).
berth doctorwarns about the red case as well.
berth security malware --realtime on # quarantine hard findings at once
berth security malware --realtime on --realtime-quarantine=false # report only
berth security malware --upload-scan onYour choice survives updates and reinstalls. When you install a new server, berth install accepts --malware-realtime and --upload-scan, and --no-malware leaves the scanner out entirely. See Install.
See also
- WAF: stops many attacks before a file is ever written.
- Isolation: a hacked site stays inside its own subscription.
- Audit trail and approvals: integrity and rootkit checks for the server itself.