WordPress security

WordPress site hacked? What to do first

Deep breath. Panic is how people delete the one backup they needed. Here's the order that keeps your options open: record it, snapshot it, lock it down, then clean it.

01Write down what you see
02Snapshot before you clean
03Change every password
Scroll ↓
Graphic for the guide WordPress site hacked, what to do first. Write it down, snapshot, lock the doors, call your host, scan, then clean.

01

Is it really a hack?

Start with what you can see, because "hacked" covers a lot of ground. The WordPress.org guide FAQ My site was hacked lists the clear signs: your site is blacklisted by Google or Bing, your host has disabled it, it's flagged for distributing malware, visitors say their antivirus is shouting about it, someone tells you it's attacking other sites, new users appear that you didn't create, or you can simply see it's been defaced.

If that's you, carry on. If you're not sure, our seven-step check and the free hacked redirect check will tell you more. Visitors landing on spam pages from Google only? That has its own page.

02

Write down what you see

Boring, but do it first. The WordPress.org guide says to document it: what made you think you were hacked, what time you noticed (and in which timezone), and what you changed recently. Did you install a plugin, edit a theme, add a widget? Jot down your host and plan too.

That note becomes your incident report. It saves you an hour of "when did this start?" whether you fix this yourself or hand it to someone.

03

Take a snapshot of the site as it is

Yes, even the infected version. Back up your files and your database now, before you clean anything. The WordPress.org guide recommends one more snapshot before the cleaning phase because, if the clean-up goes sideways, you'll at least have the bad copy to look at.

Do you have a backup from before the problem? Keep it somewhere safe and don't overwrite it. Ask your host what their backup policy is while you're at it.

04

Lock the doors

Now change access, and change all of it. The guide spells out what counts: FTP or SFTP, wp-admin, your hosting control panel and your database, for every user who has access, not only you. Use long, unique passwords, and turn on two-factor login where you can.

Two more moves from the same guide. Delete admin accounts you don't recognise. Then replace the secret keys in wp-config.php with a fresh set from the WordPress key generator. That logs out anyone who's still signed in, including whoever shouldn't be.

Cleaned up later? Change the passwords again once the site is clean, as the guide says. It's a pain, but the first lot may have been typed on a machine you can't trust yet.

The order of the first hour after a WordPress hack: 1 write down what you see, 2 snapshot files and database, 3 change every password and the secret keys, 4 call your host, 5 scan the site and your own computer, 6 clean or get help.
The order matters: record and snapshot first, then lock the doors.

05

Ring your host

On shared hosting the problem may not stop at your site. Tell your host what you've seen. They can confirm whether it's really a hack or just an outage, and they may already be acting on it.

Ask about email too. The WordPress.org guide warns that hacked sites often get used to send spam, and then the server's IP lands on email blacklists. If your business email suddenly bounces or lands in spam, that's a clue.

06

Scan the site and your own computer

Use a mix. The WordPress.org guide says remote scanners (such as VirusTotal and Sucuri SiteCheck) and plugin-based scanners (such as Wordfence) look at different things, and using both improves your odds. Our own comparison of free malware checks shows what each can and can't see from outside.

Then scan the computer you use to manage the site. The guide points out that attacks often start there, with software that steals your FTP or wp-admin logins. If the infection is on your laptop, a clean site will just get hacked again.

07

What not to do

  • Don't wipe everything in a panic. The guide says it's tempting, but often not possible without losing the site, and you need that snapshot anyway.
  • Don't reinstall WordPress from wp-admin to replace core files. The guide says those installers often overwrite only the files that already exist, and hacks add new ones. Upload fresh copies of /wp-admin and /wp-includes over SFTP instead, matching the exact version you run.
  • Don't forget .htaccess. The guide calls it one of the files most often changed in any type of infection, and it can hide in sub-folders too.
  • Don't stop at the first file you find. Where there's one backdoor there are usually more.

08

Clean it, or get help

The cleaning itself is the hard part, and how you tackle it depends on how comfortable you are with files and servers. Our step-by-step guide to removing malware from WordPress walks through it. Prefer to hand it over? Have a look at our hacked website rescue, or email hello@crawlcare.com and tell us what you're seeing.

On a tight budget? The WordPress.org guide points to the community Hacked or Malware forum as a free place to start. Bring your incident notes with you.

09

After you are clean

Update WordPress, your theme and every plugin, then change the passwords again. If the site shows its version, you can then check which WordPress version it runs from outside to confirm the update went through. Next, ask how they got in. Often it's an outdated plugin, so check the recent ones: the weDevs Project Manager exploit, the Contact Form 7 upload bug and the UpdraftPlus hack are all worth a look. The free plugin check reads what your site publicly shows.

Honest limit: working out exactly how an attacker got in is hard without server logs, and a lot of site owners never get a clear answer. Close the likely doors and keep backups from now on.

10

Common questions

Should I delete the infected files straight away?

Not yet. Back up your files and database first, infected copy included, so you still have something to look at if the clean-up goes wrong. Wiping everything in a panic often can't be done without losing the site.

Who should I call first?

Your host. On shared hosting the problem may not stop at your site, and they can tell you whether it's a real attack or just an outage. Ask about email while you're on the phone, because a server sending spam can end up on email blacklists.

Will changing my passwords fix it?

Not on its own. Change every password (SFTP, wp-admin, the hosting panel and the database) for every user, delete admin accounts you don't recognise, and replace the secret keys in wp-config.php. Change the passwords again once the site is clean, and scan the computer you manage the site from.

How do I know the site is clean afterwards?

Use more than one scanner, because remote scanners and plugin-based scanners look at different things. Then update WordPress, your theme and every plugin, and change the passwords again. For a look at what your site shows the outside world, run a free scan.

11

Sources

Free scan

Not sure how bad it is?

Run a free CrawlCare scan to see what your site shows the outside world. Or email us and tell us what you're seeing.

Talk to us