Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

Cleaning a hacked WordPress site: the order that matters

Written by Wayback Press (waybackpress.com), an independent website-restoration and hacked-site cleanup service. Not affiliated with the Internet Archive or the Wayback Machine, and not the Shift8 Web "WaybackPress" CLI

Written by Wayback Press (waybackpress.com), an independent website-restoration
and hacked-site cleanup service. Not affiliated with the Internet Archive or the
Wayback Machine, and not the Shift8 Web "WaybackPress" CLI tool. One link to our
paid cleanup at the end; the steps work without it.

The homepage redirects to a casino, or the host suspends the account overnight, or a customer sends a screenshot with a red browser warning and "is this you?". The first instinct is to start deleting files. Don't. On a compromised site the order you work in matters more than how fast you move, because a scanner that cleans before you've preserved evidence can hide how they got in — and they come back through the same door.

Step 0: confirm it's actually a hack

"Hacked" is a vague word, and WordPress.org's own FAQ says so before offering a single fix. Name the symptoms against its list of indicators of compromise (WordPress.org, FAQ "My site was hacked"):

  • the site is blocklisted by Google, Bing or another engine;
  • your host disabled the site;
  • it's flagged for distributing malware, or visitors' antivirus complains;
  • someone reports your site is being used to attack others;
  • unauthorised behaviour, like new admin users appearing;
  • visible damage in the browser.

Two more checks before you touch anything. Open Search Console → Security Issues; it shows what Google found and sorts hacked-site problems into malware, code injection, content injection and URL injection (Search Console Help, Security Issues report). Then run site:yourdomain.com and look for pages you never wrote. If those pages are Japanese and sell brand goods, that's the Japanese keyword hack — a specific pattern with its own cleanup. If nothing fits and the site is simply down, it may be a bad update or a host fault, not an attack; your host can usually tell you which.

The sequence

  1. Take it offline and snapshot it first. Put the site in maintenance mode or have the host take it down so it stops serving malware and getting deeper into blocklists. Then take a full copy of files and database as-is — this is evidence, not a clean backup. You want to be able to look at how they got in later.
  2. Change the credentials that can lock them out. Hosting panel, SFTP/SSH, database, and all admin WordPress users. Do this before cleaning, so a session they still hold doesn't just re-infect behind you.
  3. Inventory, then compare against known-good. List installed plugins and themes and their versions. Reinstall WordPress core and every plugin/theme from clean sources — wordpress.org or the vendor — rather than hand-editing suspicious files. The core and directory files are replaceable; your wp-content/uploads, your database content and wp-config.php are the parts you have to inspect by hand.
  4. Hunt the payload in the parts that aren't replaceable. Look for PHP where only media should live (executable files in uploads/), unfamiliar admin users, scheduled tasks you didn't create, and injected content in posts/options. The goal is to remove what they left, not just flip the symptom off.
  5. Confirm, then ask for review. Rescan. In Search Console, once the site is clean, use the Security Issues report to request a review so the warning is lifted (Search Console Help).

The part people skip

A clean site with the original hole still open is a site that gets hacked again next week. Cleaning and hardening are one job, not two — update everything, drop unused plugins and themes, rotate credentials, and turn off dashboard file editing. (I wrote the hardening side up separately.)

If the site is badly mangled, or it's a client site and you need it done and verified under time pressure, that's where paid help fits. Wayback Press cleans hacked WordPress sites end to end with a human review before hand-back — no promise about rankings or search recovery timelines, because no one can honestly promise those. Details and fixed pricing: https://waybackpress.com/fix-hacked-wordpress-site/.

Slow is smooth here. Preserve first, clean second, harden in the same pass.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.