A compromised website is a business problem before it is a technical one: customers see spam or are redirected, search engines start warning visitors, and payment or contact forms may be leaking data. The pressure is to make it disappear as quickly as possible. That instinct — delete the strange files, restore last night’s backup, change the admin password — is understandable, and it is why so many sites are reinfected within days.
This runbook sets out the order of work we follow for WordPress incidents. Most single-site incidents can be contained and cleaned within a day; server-wide incidents take longer. The order matters more than the speed.
Hour 0–1: contain without destroying evidence
Do:
- Take a full snapshot first — files and database — before changing anything. Label it as compromised and keep it offline. This is your evidence and your fallback.
- Limit the damage. Put the site behind a maintenance page or block public access at the web application firewall if it is redirecting visitors or serving malware. If it handles payments, suspend checkout.
- Change credentials from a clean device: hosting control panel, SFTP/SSH, database user, and every WordPress administrator. Assume any password used on the site’s machines is known.
- Note the timeline: when the problem was first noticed, by whom, and what anyone has already changed.
Don’t:
- Restore a backup yet.
- Delete files you don’t recognise.
- Update every plugin in a panic before you have recorded the versions — the vulnerable version is a clue.
Hour 1–4: preserve and scope
Collect what you will need to find the entry point:
- web server access and error logs (and any WAF or CDN logs) covering at least the last few weeks;
- the list of plugins and themes with exact versions;
- recently modified files:
find . -type f -mtime -14from the site root is a quick start; - WordPress users, especially administrators created recently.
Then check the integrity of what should be unchanged. WP-CLI can compare core files and plugins from the WordPress.org directory against their official checksums — wp core verify-checksums and wp plugin verify-checksums --all. Anything that fails is either modified or not supposed to be there.
Check the database, not just the files. This is where clean-ups most often fall short. Look for:
| Location | What to look for |
|---|---|
wp_users / wp_usermeta |
Administrator accounts nobody recognises; capabilities granted to existing low-privilege users |
wp_options |
siteurl / home changed; injected <script> in widget or theme options; unfamiliar autoloaded options |
wp_options → cron |
Scheduled events calling unfamiliar functions — a common persistence method |
wp_posts |
Spam links or hidden content injected in bulk; sudden bursts of posts from one author |
active_plugins option |
Plugins activated that aren’t in the expected list |
If the site shares a server with other sites, check the neighbours. On shared hosting, the same backdoor and the same rogue admin email often appear across several sites. Cleaning one while its neighbour stays infected almost always means a repeat.
Hour 4–12: find the entry point
Cleaning without knowing how the attacker got in is mowing weeds. The usual suspects:
- A vulnerable plugin or theme. Match installed versions against public vulnerability records. Mass exploitation of popular plugins is routine — for example, CVE-2024-28000, a privilege-escalation flaw in LiteSpeed Cache, was exploited widely in 2024.
- Stolen or reused credentials — check access logs for logins to
wp-login.phpor the control panel from unexpected locations. - Nulled (pirated) themes or plugins, which frequently ship with backdoors.
- A neighbouring compromised site on the same server or account.
- Writable upload directories executing PHP.
Write down what you find. It determines both the fix and whether the incident is reportable.
Hour 12–20: clean or rebuild
Choose the approach based on what you now know:
| Situation | Approach |
|---|---|
| Entry point known; a backup exists from before the compromise | Restore that backup, then patch the entry point before going live, then re-apply legitimate content changes made since |
| Entry point known; no clean backup | Replace WordPress core, plugins and themes with fresh official copies; clean wp-content/uploads; clean the database items above |
| Entry point unknown | Rebuild on fresh core and plugins; migrate content only (posts, media after inspection); new credentials everywhere |
| Several sites on one server affected | Treat as a server incident: scan every site, files and databases, before declaring any of them clean |
Whatever the route: remove unknown administrators, rotate the WordPress salts in wp-config.php (which invalidates all sessions), change database credentials, and remove any PHP files from the uploads directory.
Hour 20–24: harden, verify, return to service
- Update everything to supported versions; remove plugins and themes that aren’t in use.
- Apply the basics from WordPress’s own hardening guide: least-privilege file permissions, no PHP execution in uploads, file editing disabled in the dashboard, two-factor authentication for administrators.
- Put a web application firewall in front of the site.
- Re-scan files and database. Re-check neighbouring sites.
- Request a review in Google Search Console if the site was flagged.
- Turn on monitoring for file changes and new administrator accounts.
Reporting: CERT-In and personal data
Two Indian obligations deserve attention while the incident is still fresh:
- CERT-In. Under CERT-In’s directions of 28 April 2022, service providers, intermediaries, data centres, body corporates and government organisations must report specified cyber incidents — the list includes website intrusion, defacement and unauthorised changes such as inserted malicious code — within six hours of noticing them. The same directions require ICT system logs to be maintained for a rolling 180 days.
- Personal data. If the site held personal data (contact-form submissions, customer accounts, orders), the incident may also be a personal data breach under the Digital Personal Data Protection Act, 2023, with obligations to inform the Data Protection Board and affected individuals as the Act and Rules come into force. See our article on the DPDP Act for websites and IT operations.
Whether a specific incident is reportable is a legal judgement. The technical team’s job is to provide accurate facts quickly: what was accessed, when, how, and what data was involved. Good logs make that possible; missing logs make it guesswork.
The post-incident note
Close every incident with a one-page note: timeline, entry point, what was found (files, database, accounts), what was changed, data potentially affected, and the prevention steps agreed. It is the document your management, your auditor and — if needed — a regulator will ask for.
How Kamyab approaches it
We handle WordPress and server incidents as a regular part of our managed operations, and website hack recovery is usually completed within 24 hours. Because database-level persistence kept appearing in our own incident work, we built CleanShift to scan WordPress databases and correlate infections across every site on a server, with operator-approved remediation. Across Kamyab’s own operations, CleanShift has been used on hundreds of WordPress sites spanning dozens of hosting accounts.
If your site is compromised right now, call +91 11 4161 9300 or WhatsApp +91 99877 77250, or report it here. Outside business hours (Mon–Sat, 10:00–17:00 IST) we respond on a best-effort basis.