The first 24 hours after a WordPress compromise: an incident runbook

What to do — and what not to do — in the first day after a WordPress site is hacked: contain, preserve, scope, clean, harden and report.

Author
Kamyab Engineering
Published
12 October 2026
Reading
8 min
Capability
Protect

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 -14 from 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:

  1. 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.
  2. Stolen or reused credentials — check access logs for logins to wp-login.php or the control panel from unexpected locations.
  3. Nulled (pirated) themes or plugins, which frequently ship with backdoors.
  4. A neighbouring compromised site on the same server or account.
  5. 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.

Frequently asked questions

Should I restore yesterday's backup as soon as I notice the hack?
Not first. Restoring immediately destroys evidence of how the attacker got in, and if the backup was taken after the compromise began, it restores the infection too. Preserve a copy of the current state, identify the entry point, then restore or clean.
Is deleting the infected files enough?
Usually not. Attackers commonly persist in the database — extra administrator accounts, injected options, scheduled tasks — and through the original vulnerability. If those remain, the site is reinfected.
Do I need to report a website hack to CERT-In?
CERT-In's April 2022 directions require service providers, intermediaries, data centres, body corporates and government organisations to report specified incidents, including website intrusion and defacement, within six hours of noticing them. Confirm whether your incident is reportable with your legal or compliance adviser.

Related capability

Related case studies

  1. WRK-02

    Moving 1,300+ business mailboxes between servers — and proving none were left behind

    A 1,300+ mailbox estate migrated server-to-server, resynced in controlled waves and audited account by account: zero mailboxes behind, zero missing.

    Client
    Unicorn Infosolutions
    Industry
    Retail
    Capability
    Operate, Build, Protect
    Year
    2026
  2. WRK-03

    CleanShift: server-level WordPress security that scans the database, not just the files

    Kamyab's database-aware WordPress server security, born from a CVE-2024-28000 incident and battle-tested across hundreds of sites we host.

    Product
    CleanShift by Kamyab Infotech
    Industry
    Web hosting & WordPress security
    Capability
    Protect, Build
  3. WRK-06

    LegacyData: a privacy-first data-preservation service engineered on a single edge Worker

    Kamyab's family data-preservation service: one Cloudflare Worker running the public site, risk assessment, customer portal, payments and staff operations.

    Product
    LegacyData by Kamyab
    Industry
    Consumer data services
    Capability
    Build, Protect, Operate
    Year
    2026

Tell us what you run. We’ll tell you what we’d do first.

Tell us what you run and what keeps breaking. We will map it, tell you plainly what we would change, and quote it in writing.

support@kamyab.co.inWhatsApp +91 99877 77250