Free security runbook · WordPress

WordPress plugin supply chain: detect, contain, rotate

A plugin update is a third-party code deploy into your web root. When one turns malicious, the useful questions are which files it touched, which credentials it could read, and what still trusts them. Deactivating the plugin answers none of those.

This page is free. It covers detection with WP-CLI and the checksum API, a containment order that preserves evidence, and the rotation list people usually get wrong. Defensive only.

Scope: reviewed from vendor documentation, no live reproduction
Verified against the WordPress.org plugin checksum API, the WP-CLI checksum command documentation and the WordPress hardening guide on 2026-11-12. Commands assume WP-CLI and a standard wp-content layout; confirm the paths before deleting anything.
Why this is hard

Four gaps a plugin scanner will not close

Checksums cover releases, not your site

wp plugin verify-checksums compares plugin files with WordPress.org's published hashes. A file in uploads or a drop-in is outside that set.

Not every plugin is on WordPress.org

Premium and private plugins have no public checksum to compare against. The command may report success while covering only part of what is installed.

An update is a deploy

Auto-updates run unattended, with the same database and file permissions as the site. The bad release is often a legitimate plugin, not a fake one.

The plugin can read everything PHP can

Database credentials, salts, SMTP keys, payment and API tokens. Removing the code does not rotate any of them.

Detect

Inventory before you contain

CommandWhat it tells you
wp core verify-checksumsCore files that differ from the release; the output names each file.
wp plugin verify-checksums --allPlugin files that differ from WordPress.org hashes. Plugins not hosted there cannot be verified this way.
wp plugin list --fields=name,status,version,update,auto_updateWhat is active, outdated, or updating itself without a human.
wp plugin list --status=inactiveCode still on disk that nobody watches but PHP can still include.
find wp-content -type f -mtime -2 -not -path '*/cache/*' -lsFiles changed outside a deploy window.
wp user list --role=administrator --fields=ID,user_login,user_email,user_registeredAccounts that can install code; check registration dates against your records.
wp cron event listScheduled callbacks a plugin left behind after it was removed.
curl -s 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=<slug>'Upstream version and last update date; an abandoned plugin is a risk even when clean.
Failure modes

Six ways the check passes and the site is still dirty

#Failure modeWhat you seeWhat to do
1Checksums verify plugin directories, not the whole siteSuccess: Verified 8 of 8 plugins. while a PHP file sits in uploads or a drop-in loads on every request.Scan uploads for PHP, compare drop-ins against known files, and block PHP execution there.
2A premium plugin cannot be verifiedThe command reports fewer plugins than are installed, with no per-plugin error.Keep vendor hashes or signed release artifacts, pin versions, and do not read the success line as coverage.
3An auto-update shipped a bad releaseA fatal error at 03:00, a new admin user, or outbound requests that began with the update.Stage updates on a copy, disable auto-updates for code that can write files, and keep the previous plugin directory until the new one is verified.
4A compromised admin session installed a legitimate pluginChecksums pass because the plugin is a real release. The anomaly is a new administrator, a changed siteurl, or an unrecognised session.Review users and sessions, rotate credentials, and read the access log around the install time.
5Rotation stops at the admin passwordThe site is clean, but the database password, SMTP key, payment keys, API tokens and wp-config.php salts are unchanged.Rotate in dependency order: database, object cache, SMTP, payment/API, admin. Then rotate salts to invalidate sessions.
6Deactivation leaves the code on diskThe plugin is inactive, its files are still reachable, and a mu-plugin can still include them.Delete the directory, remove mu-plugins and scheduled events, then re-run the checksum commands.
Contain

In this order

1. Preserve before cleanup

Snapshot files and the database, and export the access-log window. Deleting first destroys the only evidence of the entry point.

2. Take the site out of the blast radius

Maintenance mode or an edge block. Do not delete yet; you still need to know what was reachable.

3. Find the entry point

New administrators, sessions you do not recognise, recent file changes, outbound requests, and cron events that no longer match the plugin list.

4. Remove the code

Delete plugin and theme directories, drop-ins and mu-plugins. Deactivation alone leaves executable files on disk.

5. Rotate

Database user, object-cache credentials, SMTP, payment and API keys, admin passwords. Rotate salts last: it logs everyone out, including the session you are working in.

6. Rebuild and verify

Reinstall core and plugins from upstream, run both checksum commands, confirm no new admin or cron event, then end maintenance mode.

Rotating salts invalidates every session
Do it after the code is removed and the accounts are reviewed, or the attacker's session may simply re-establish with the credential you did not rotate.
Prevent

Make the next update boring

ControlWhy it helps
Stage updates, then promoteA fatal error is cheaper on a copy than on production at 03:00.
Pin and record versionsYou cannot roll back to a version whose artifact you did not keep.
Disable file editing in productionDISALLOW_FILE_EDIT closes the admin editor path; it is not a substitute for least privilege.
Least-privilege database userThe web user rarely needs DROP or full grants on every schema.
Alert on new administrators and file changesMost of the damage happens after the install, not during it.
FAQ

Questions after a bad plugin update

Is deactivating the plugin enough?

No. The files remain on disk and PHP can still reach them. Delete the directory and check mu-plugins, drop-ins and cron events.

Do we have to rotate everything?

Rotate everything the web user could read. That is usually the database credential, salts, SMTP, payment and API keys. Rotating in dependency order avoids breaking the site while you work.

Will checksums catch a modified premium plugin?

Not against WordPress.org. Keep vendor-provided hashes or archive signatures, or at minimum compare file inventories before and after each update.

What if the site was already compromised before the plugin?

Then the plugin is a symptom. Treat it as an incident: preserve evidence, review accounts and sessions, and rebuild from known-good artifacts rather than cleaning in place.

Sources

Primary sources

Going deeper on the change window?

The paid runbooks cover the operational side: secrets that leak into build logs, production defaults, and the checks that only fail on a real domain.

This page is free, no checkout. Paid runbooks are $9.99 each and covered by the 7-day refund policy at /runbooks/refund.