Procedure

Secure a compromised WordPress site

Treat a compromised WordPress site as an incident by preserving evidence, containing access, verifying checksums, rebuilding from trusted sources, reviewing the database, rotating secrets, fixing the entry vector, and monitoring recurrence.

Objective

Treat a compromised WordPress site as an incident by preserving evidence, containing access, verifying checksums, rebuilding from trusted sources, reviewing the database, rotating secrets, fixing the entry vector, and monitoring recurrence.

Prerequisites

  • Administrative access to WordPress plus hosting, PHP or web-server access when required.
  • A known-good backup and the ability to restore the previous plugin/theme/configuration state.
  • Administrative access appropriate to the system being changed or diagnosed.
  • A clearly identified scope: affected users, systems, addresses, services and the time of the observed problem.
  • A maintenance or test window when the procedure can affect production traffic or availability.
  • A copy of the current configuration or other recovery material before any irreversible action.

Step-by-step procedure

1

Establish the baseline and scope

Before changing anything, reproduce the issue or document the requested change on a representative system. Record the affected users or services, exact time, current configuration, recent changes and a known-good comparison point. This baseline is the reference used to decide whether each later step improves the situation.

Expected result
  • The scope and current state are documented well enough to reproduce or verify the procedure.
2

Evidence

Apply the required security control to this area: evidence. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
3

Containing access

Apply the required security control to this area: containing access. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
4

Verifying checksums

Apply the required security control to this area: verifying checksums. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
5

Rebuilding from trusted sources

Apply the required security control to this area: rebuilding from trusted sources. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
6

The database

Apply the required security control to this area: the database. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
7

Rotating secrets

Apply the required security control to this area: rotating secrets. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
8

Fixing the entry vector

Apply the required security control to this area: fixing the entry vector. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
9

Recurrence

Apply the required security control to this area: recurrence. Start from the current effective configuration, apply least privilege and the smallest required exposure, then validate with representative privileged and non-privileged tests. Record every exception, its owner and its expiry so a temporary bypass cannot become permanent.

Expected result
  • Evidence for this area is explicit, reproducible and consistent with the intended design.
10

Validate the complete service

Repeat the original user, system or application workflow from the real source and verify the complete result, not only one command or one local check. Confirm that logs and monitoring show the expected behavior and that no temporary debug, bypass, test account, rule or maintenance setting remains enabled.

Expected result
  • The end-to-end service works or the remaining failure is isolated to a clearly identified component.

Technical commands from the original procedure

These technical blocks are preserved byte-for-byte from the historical procedure and kept in their original order. Review names, addresses, paths and parameters before use.

Technical block 1
tar -czf wordpress-compromis-$(date +%F-%H%M).tar.gz <DOCROOT>
Technical block 2
wp db export wordpress-compromis.sql
Technical block 3
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
Technical block 4
wp core verify-checksums --include-root --version=$(wp core version)
Technical block 5
wp plugin list
Technical block 6
wp theme list
Technical block 7
wp plugin verify-checksums --all --strict
Technical block 8
find wp-content -type f -name '*.php' -mtime -14 -print
Technical block 9
wp core download --force --version=$(wp core version)
Technical block 10
wp option get home
Technical block 11
wp option get siteurl
Technical block 12
wp cron event list

Validation

The procedure is validated when:

  • The original symptom or change request has been tested end to end.
  • The effective configuration matches the intended design and no unexplained error remains in the relevant logs.
  • Temporary troubleshooting controls have been removed and monitoring remains normal.
  • The result, evidence and any follow-up action are documented.

Rollback

  • Restore the configuration, policy, binding, route, credential assignment or service state recorded in the baseline when the change does not meet its success criteria.
  • Remove temporary rules, test objects and diagnostic settings that were introduced only for the procedure.
  • After rollback, repeat the minimum health checks to confirm that the previous service level has been restored.

Troubleshooting / common errors

  • Separate WordPress application errors from PHP, database, DNS, SMTP and web-server errors.
  • When testing mail or redirects, use a controlled example and verify the complete external path, not only the local UI.
  • If the result changes between tests, compare source, destination, identity, time and policy context before changing additional settings.
  • If a command succeeds but the application still fails, continue at the next protocol or application layer instead of widening access.
  • If the expected evidence is missing, verify that logging, auditing and the test path actually cover the failing component.
  • If the change does not improve the measured symptom, restore the previous state and reassess the working hypothesis.

Official and vendor references preserved from the original procedure

♡ 0