Recover a hacked website

hacked, recovery, malware, restore, defaced, spam, checklist · 0 found this helpful

Work through this list in order. The order matters. If you restore a backup before you change passwords, the attacker is back within hours.

Open a support request first if you're unsure. We can help with steps 2 to 6. See What to include when you ask for help.

Signs of a hacked site

  • Your pages show someone else's message, or redirect to another site
  • Google shows "This site may be hacked" or "Deceptive site ahead"
  • Search results for your site show pills, casino, or foreign-language spam
  • New admin users appear in WordPress
  • Customers say they got spam from your address
  • Your site is much slower, or you got a resource-limit email
  • Imunify360 flagged files. See Malware was found on my site

The checklist

1. Don't panic, and don't delete the evidence

Don't delete the whole site. You'll want the files to learn how the attacker got in.

2. Change passwords, from a clean computer

Do all of these. Use a unique password for each. See Passwords and password managers.

  • Barbrick account
  • WordPress admin users (all of them)
  • FTP and SSH accounts
  • Database password. Also update it in wp-config.php
  • Email accounts on your domain
  • Anything else that shares those passwords

Run a virus scan on your own computer. An infected computer can steal new passwords.

3. Turn on two-factor authentication

See Protect your Barbrick account with two-factor sign-in.

4. Take the site offline for visitors, if needed

If it's showing harmful content, put up a maintenance page. See Put WordPress in maintenance mode. Or rename index.php to index.php.off and add a plain index.html that says you'll be back soon.

5. Take a copy of the current state

Download the current files and database, or ask us to. See Download a backup copy. This copy is for investigation only. Don't put it back on the live site.

6. Find the safe point in time

  1. Open Account → Hosting → your site → Backups. Restore something is at the top. See How backups work at Barbrick.
  2. Look at the backups list. Every plan has one a day for the last 30 days. Business adds weekly and monthly ones, and Pro adds hourly ones. For anything older, ask us.
  3. Pick the last one from before the first sign of trouble. If you don't know, check file dates in Files → File manager, or check Scan history in Security → Malware scanner.
Restore something, at the top of Backups

7. Restore a clean copy

No clean backup? Ask us. See Ask us to restore something for you. We clean hacked sites as paid website work, quoted per job. Ask for a quote. See Website changes and paid work.

8. Update everything

9. Check for what's left behind

  • Users. Remove unknown administrators
  • .php files in wp-content/uploads. They don't belong there
  • Extra files in your site's top folder with odd names
  • .htaccess for redirects you didn't add
  • Cron jobs in Account → Hosting → your site → Developer → Cron jobs that you didn't create
  • FTP accounts you don't recognize
  • Email forwarders you didn't set up

10. Rescan

Run Imunify360 again and confirm the list is clear. See Imunify360.

11. Fix permissions

Check that files are 644 and folders 755. See Fix file and folder permissions.

12. Bring the site back

Remove the maintenance page. Test the home page, forms, checkout, and login.

13. Tell search engines and customers

  • If Google flagged your site, open Google Search Console, find Security & Manual Actions → Security issues, tick I have fixed these issues, and click Request Review.
  • If customers received spam from your address, tell them to ignore it. Don't ask them to click anything.
  • If personal information was exposed, you may have legal duties to notify. Under PIPEDA, a breach that creates a real risk of significant harm must be reported to the Office of the Privacy Commissioner of Canada, and the people affected must be told. Ask a professional if you're unsure.

14. Prevent a repeat

Work through Website security checklist. Turn on automatic updates and keep your own off-site copy. See Keep your own off-site copy.

If something goes wrong

  • Malware returns within a day. A backdoor is still on the site, or a password wasn't changed. Check step 9 again, and ask us for help.
  • The restore point is also infected. Choose an older one.
  • You can't log in to WordPress. See Can't reach wp-admin.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.