Malware scanner
The scanner checks every account's files for web shells and other malicious code and lists what it finds. Deciding about a finding is yours.
What it does
The scanner reads the files of every hosting account and compares them with a set of YARA rules: descriptions of web shells, backdoors and code that is hidden by encoding. A file that matches a rule becomes a finding on the Malware scanner page (under Security).
It reports and nothing else. It never deletes, changes or quarantines a file, and it does not block uploads as they happen: a new file is seen by the next scan. A finding means "this file looks suspicious", not "this file is malicious"; some legitimate code matches too. Open the file and decide.
The scanner is on after the install, with the schedule below.
When scans run
| Scan | When | What it reads |
|---|---|---|
| Nightly | Every night at 03:30 UTC | In each account, only files that are new or changed since the account's last complete scan. An account that was never scanned gets a full scan. |
| Weekly full | Sunday at 04:00 UTC | Every file of every account. |
| Scan now | When you press it | Every account, or one with Scan one account. |
| Rescan | From a finding's Actions | That one file. |
The times and the weekday are on the Settings tab; they are UTC. A scheduled scan starts within 4 hours of its time and not past midnight. If the server is off or busy for that long, it waits for the next day instead of running in business hours.
Switching Scheduled scans off on the Settings tab stops the nightly and weekly scans. Scan now still works then; customers cannot start scans while it is off.
Changing the rules makes the next scan of every account a full one, because files already scanned have to be checked against the new rule: this applies when you switch a rule on, or add, change or switch on a custom rule.
What is scanned and what is not
Each account's whole home under /srv/hosting is scanned: sites, uploads, anything else the customer put there. Not scanned:
- Symlinks and special files. The scanner never follows a link, so a link to a file outside the account cannot make it read that file.
- The Excludes list on the Settings tab: paths relative to each account's home, such as
data/logs. An exclude is honoured only where the account cannot write. A folder the customer owns or can write to is scanned in full even when it is listed, so an exclude cannot be used to hide a web shell. - Path entries of the allowlist (below).
- The middle of large files. A file over Largest file scanned (10 MiB by default) is scanned in part: its start and its end.
Load on the server
A scan runs at the lowest CPU and disk priority, as a separate user that can read the accounts' files and change nothing. CPU quota on the Settings tab caps it: 50% of one core by default, 100 is one whole core. A lower quota makes scans slower, not less thorough.
The status bar
| Shown | Meaning |
|---|---|
| Last scan | Its kind, whether it finished or failed, how long it took and how many files it read. |
| N large files scanned in part | Files over the size limit. See above. |
| N accounts incomplete | The last scan did not get a usable result for these accounts. Click it for the list and the reason. Their next scan repeats what was missed. |
| N accounts partly not scanned | Something in these accounts was left out. Click it for what and why. |
| N accounts hit the result cap | An account had more findings than one scan records. Clear some and scan again to see the rest. |
| Now | The running scan and how many accounts are done, and how many scans wait. One scan runs at a time. |
Findings
A finding is one file matched by one rule. The list shows the account, the path, the rule, and when the scanner first and last saw the match.
| Status | Meaning |
|---|---|
| open | The file matched in its last scan and nobody has decided about it. |
| dismissed | You decided that this content is fine. See Dismiss below. |
| resolved | The match is gone. The reason is shown with it: file deleted, cleaned (the file changed and no longer matches), allowlisted, rule disabled, or account deleted. |
Resolved findings are deleted after 90 days.
Actions on a finding
| Action | What it does |
|---|---|
| View | The details: the rule and its description, the file's size, SHA-256, owner, modification times, and each matched string with the bytes around it. |
| View file | The file as it is now, read-only. The page says so when the file changed since the scan or is no longer there. Only the first 1 MiB is shown. |
| Rescan | Scans this one file again, for example after the customer cleaned it. |
| Dismiss | Adds the file's exact content to the allowlist, for this account or for every account. That content is no longer reported; if the file changes, it is reported again. |
| Allowlist path | The file is no longer scanned in this account, whatever it contains. Use it sparingly: malicious code written to that path later is not seen. |
What to do with a real one
The scanner leaves the clean-up to you and the customer:
- View file to confirm it. A web shell in an upload folder or a block of encoded code at the top of a PHP file is usually plain to see.
- Decide how far it goes. One bad file is rarely alone, and the way in (an outdated plugin, a leaked password) is still open. Suspending the account stops its sites while you look.
- Remove or restore the files: by SSH, in the file manager, or from a backup taken before First seen.
- Rescan the file, or scan the account. A finding whose file is gone or clean becomes resolved.
Rules
The Rules tab has two lists.
- Shipped rules come with alxpanel and are updated with it. They are taken from two public collections, signature-base (web shell rules) and php-malware-finder (its rule for suspiciously encoded PHP). Every rule is on unless you switch it off here; switch one off when it keeps reporting code you know is fine. Its findings become resolved (rule disabled).
- Custom rules are YARA rules of your own, used together with the shipped ones. The server checks a rule before it is saved. A rule may not use
include, and may import only thehash,mathandstringmodules.
Allowlist
Two kinds of entry, for one account or for every account:
| Kind | Effect |
|---|---|
| File content (SHA-256) | A file with exactly this content is scanned but never reported, at any path. This is what Dismiss adds. |
| Path | The path is never scanned. Relative to the account's home; a folder covers everything under it. * and ? do not cross /. |
Prefer a content entry. It stops applying the moment the file changes, and a path entry never does. There may be at most 200 path entries for every account and 200 per account.
Deleting an entry makes matching files show up again from the next scan on.
What customers see
Every customer has a Malware scanner page with the findings of their own account, and nothing of the rules, the allowlist or the settings.
- They can View a finding and View file.
- Scan now scans their account. It is refused while a scan of the account is queued or running, and for 10 minutes after the last one.
- Dismiss hides a finding from their own list only. You still see it, marked "dismissed by customer", and it stays open for you. Show again brings it back for them.
A customer cannot allowlist anything or switch rules off, so a compromised customer login cannot silence the scanner.