# Malware scanning

URL: https://docs.vaultpanel.net/guides/websites/malware-scanning

> Install ClamAV on a server, scan websites on request or every week, and quarantine, delete or ignore the files a scan finds.

VaultPanel scans websites for malware with ClamAV. You install ClamAV once per server, then scan each website from its **Malware** tab, or let the server scan every website once a week.

> **Note:**
Malware scanning needs agent 0.43.0 or later on the website's server.

## Install ClamAV on a server

1. Open the server and go to its **Security** tab.
2. In the **Malware scans** card, click **Install**.

ClamAV then downloads its virus signatures, which takes a few minutes; scans can start once they are there. `clamav-freshclam` keeps them current, and the card shows when they were last updated.

ClamAV needs about 1.2 GB of free memory while it scans. When the server has less free memory, the agent refuses the scan with a message saying so; try again at a quieter time, or add memory.

### Weekly scans

Click **Scan every website weekly** in the **Malware scans** card to scan each website on the server once a week. The server scans one website at a time, at low priority. **Stop weekly scans** turns it off. Installing ClamAV and turning weekly scans on or off needs the `security.manage` permission.

## Scan a website

![The Malware tab of wordpress.vaultpanel.net: the Malware scan card, last scanned 2h ago with 4380 files and 0 found, a Scan now button and a Scan log link, above an empty Found list saying Nothing found](https://docs.vaultpanel.net/screenshots/website-malware-light.png)

Open the website, go to the **Malware** tab and click **Scan now**. The **Malware scan** card shows when the last scan ran, how many files it checked and how many it found, and links to the **Scan log**.

A scan runs ClamAV as the website's own Linux user, never as root, at the lowest CPU and disk priority. It checks every file in the site's home folder except its logs, `tmp` folder and caches.

## What a scan finds

The **Found** card lists each file with its kind and status.

| Kind | Meaning |
| --- | --- |
| **Malware** | ClamAV recognised the file. The signature name is shown under the path. |
| **Suspicious** | A PHP file inside `wp-content/uploads`. WordPress keeps only media there, so a PHP file there is usually planted. Check it before you delete it. |

When infected files are found, the tab shows a warning, and the website appears in the dashboard's **Needs attention** list until each file is quarantined, deleted or ignored.

### What to do with a file

| Action | What it does |
| --- | --- |
| **Quarantine** | Moves the file out of the website to a folder only root can read, under `/var/lib/vaultpanel/quarantine`. Pages that need the file stop working until it is restored. **Quarantine all** does this for every file still on the site. |
| **Restore** | Puts a quarantined file back where it was. It is never written over another file. Only restore a file you are sure is not malware. |
| **Delete** | Removes the file for good, from the website or from quarantine. A backup is the only way back. |
| **Ignore** | Leaves the file on the website and stops listing it as found. **Stop ignoring** lists it again. |

A file that a later scan finds again keeps its status, so an ignored file stays ignored.

Quarantine, restore and delete run on the server as root. The agent walks the file's path from the site's home one folder at a time without following links, so a hacked site cannot trick it into touching files outside the site.

> **Tip:**
After you quarantine or delete malware, change the website's passwords, update WordPress and its plugins (see [WordPress tools](https://docs.vaultpanel.net/guides/websites/wordpress-tools)), and scan again.

## Hosting customers

Customers see the **Malware** tab of their own websites. When ClamAV is not installed on the server, the tab asks them to contact their host.

## Permissions

| Permission | Allows |
| --- | --- |
| `websites.read` | Seeing the last scan and what it found. |
| `websites.manage` | **Scan now**, and quarantining, restoring, deleting and ignoring files. |
| `security.manage` | Installing ClamAV and turning weekly scans on or off. |

## Related

- [Web application firewall](https://docs.vaultpanel.net/guides/websites/web-application-firewall) to stop attacks before they reach a website.
- [Backups](https://docs.vaultpanel.net/guides/backups-and-automation/backups) to restore a website from before an infection.
- [API reference](https://docs.vaultpanel.net/api-reference/websites#get-malware-scan-results) for the malware endpoints.
