Site hacked: what to do on ISPmanager hosting

Signs of a hack: redirects to other sites, ads or foreign pages, spam from your domain, a browser or Google warning, unknown files and users in the admin area.

Act in order and do not postpone. While the site is infected, it can send spam and infect visitors.

1. Change all passwords

  • the panel and client area password;
  • FTP user passwords: FTP users;
  • the database user password — and the same password in the site config (wp-config.php);
  • site administrator passwords (WordPress etc.); delete unknown administrators;
  • mailbox passwords if spam went from the domain.

If passwords were stored on the computer you used to manage the site, scan it with an antivirus before changing them.

2. Restore the site from a backup

The most reliable way is a copy dated before the hack: Backups. Restore files and the database, then update the CMS and plugins right away — otherwise the site is hacked again through the same hole.

3. No suitable copy — check WordPress

Open the Shell client and go to the site folder. These commands compare core and plugin files with the originals and show recently changed files:

cd ~/www/example.com
wp core verify-checksums 2>&1 | grep -v "should not exist"
wp plugin verify-checksums --all
wp plugin list --fields=name,status,update
find . -name "*.php" -mtime -7 | grep -v "^./wp-"
Checking WordPress in the Shell client
Checking WordPress in the Shell client
  • The core does not match — reinstall it on top, content stays untouched: wp core download --force --skip-content --version=$(wp core version).
  • A plugin failed the check — delete it and install again from the directory. Remove unknown and abandoned plugins completely.
  • Update everything: wp core update, wp plugin update --all, wp theme update --all.
  • .php files in wp-content/uploads are almost always malicious. Delete them.
  • Check .htaccess in the site root and folders: foreign redirects are usually written there.

4. The site is not WordPress

Download a clean copy of your CMS of the same version, compare the files and replace changed ones. Find recently changed files with the same find command. Look at the access log: requests to unknown .php files show where the malicious file sits: Site logs.

5. Protection for the future

  • Keep the CMS, plugins and themes updated. Most hacks come through old plugins.
  • Do not install plugins and themes from unofficial sources.
  • Turn on backups and check that copies exist.
  • Strong, different passwords; a separate FTP user for each contractor.
  • HTTPS for the admin area: HTTPS.

The site owner is responsible for the site content and its updates. If you need a specialist to clean the site, contact support — we will tell you how to order it.

Questions and answers
You can, but without changing passwords and updating the CMS the site gets infected again. It is safer to restore a copy from before the hack and update everything right away.
"Backups" — choose a date before the first signs appeared.