Online now · reply within 30 min · Mon–Fri 8 am–8 pm Central Time
// SECURITY · PERSISTENCE

Why cleaned WordPress sites get reinfected

The scanner says clean. Three weeks later the site is hacked again. In almost every case the cleanup removed the payload and left the way in. Here are the seven mechanisms that survive a typical cleanup, and how to check each one.

11 min readUpdated November 2026MexicoWordPress · WordPress since 2012

Reinfection is the normal outcome of a symptom-only cleanup, not bad luck. Automated scanners are built to find known malicious payloads. They are not built to answer the question of how the payload arrived, and they are inconsistent at finding the mechanisms that let it come back.

After fourteen years of WordPress incident work, the pattern is predictable enough that we check for persistence before treating a clean scan as a result.

Payload versus persistence versus vector

Three different things get conflated in the word "hacked", and a cleanup has to address all three:

LayerWhat it isWhat a scanner does
PayloadThe malicious files and injected code doing the damage: redirects, spam pages, phishing forms.Finds most of it. This is what scanners are for.
PersistenceWhat lets the attacker return after the payload is removed: rogue admins, scheduled tasks, hidden backdoors.Inconsistent. Often misses legitimate-looking accounts and cron entries.
VectorHow they got in the first time: an unpatched plugin, a reused credential, an exposed FTP account.Does not address it at all. Not the job of a scanner.

A cleanup that handles only the payload leaves both of the other layers intact. That is the site that gets reinfected, and it is why the second incident often looks identical to the first.

The test that matters

Ask whoever cleaned your site one question: how did they get in? If the answer is a list of deleted files rather than a named component and a mechanism, the vector was not closed.

The seven that survive

1. A second administrator with a plausible name

The most common finding, and the one scanners almost never flag, because a WordPress user is not a file. The account is named to blend in: admin_support, wp_maintenance, seo_editor, or the name of a real plugin. It has administrator rights and it survives every file-level cleanup.

Check: Users → All Users, filter by Administrator. For each one, ask who created it and when. An admin nobody on the team recognizes is a finding, not a mystery.

2. A scheduled task that re-downloads the payload

WordPress has its own cron system, stored in the cron option in the database. An attacker adds an event that fetches and rewrites the malicious file on a schedule. Delete the file, and the next cron run puts it back. Server-level crontab entries do the same thing and are invisible from the WordPress admin.

Check: inspect the cron option for hooks that do not correspond to an installed plugin, and check the hosting crontab. A hook calling an unfamiliar function name is worth tracing.

3. A PHP file in the uploads directory

wp-content/uploads should contain media, not executable code. Attackers know that cleanup tools focus on core, themes and plugins, and that uploads is large, messy and rarely reviewed. A single .php file buried in a year-and-month subdirectory is enough to rebuild everything else.

Check: search the uploads tree for .php, .phtml and .php5. On a normal site the result should be empty or close to it.

Find executable files where they should not be
# From the WordPress root. Read-only: this lists, it does not delete. find wp-content/uploads -type f \ \( -name "*.php" -o -name "*.phtml" -o -name "*.php5" -o -name "*.phar" \) \ -printf "%T+ %p\n" | sort# Also worth checking: PHP in unexpected top-level locations find . -maxdepth 1 -name "*.php" -printf "%T+ %p\n" | sort

4. The vulnerable component, still unpatched

This is the vector itself. An abandoned plugin at version 2.1 with a known file-upload vulnerability does not stop being exploitable because you deleted the files it was used to place. The next automated sweep finds the same door. Restoring a backup makes this worse, because the backup contains the same vulnerable version.

Check: for every plugin and theme, is it still maintained, and is it current? An abandoned component with a public vulnerability is not a candidate for patching. It is a candidate for removal and replacement.

5. Credentials that were never rotated

If the attacker authenticated with valid credentials, cleaning files changes nothing. They log in again. This includes WordPress passwords, application passwords, FTP and SFTP accounts, database users, hosting panel access, and any API keys stored in wp-config.php.

The salts in wp-config.php matter too: rotating them invalidates existing sessions, which logs out an attacker who is currently authenticated. Changing a password alone does not necessarily do that.

Check: after a compromise, every credential in the chain should be considered exposed until rotated. Not just the WordPress admin.

6. Modified core or plugin files that a scanner scored as clean

Not all injected code matches a signature. A three-line addition to a legitimate plugin file, or a modified wp-includes file, can pass a signature-based scan. The reliable comparison is against the original distribution, not against a malware database.

Check: WP-CLI has a command that verifies core checksums against the official release:

Verify WordPress core against official checksums
wp core verify-checksums# And for plugins hosted on wordpress.org: wp plugin verify-checksums --all

A clean result here is meaningful in a way that a clean malware scan is not: it means the files match the originals byte for byte. It does not cover custom code or premium plugins from outside the repository, which need manual comparison.

7. A backdoor in the database, not in a file

Injected JavaScript in post content, a malicious value in an autoloaded option, a widget with embedded code, or PHP in a field that a plugin later evaluates. File-only cleanup never looks here. It is also what survives a full file replacement, which is why some sites are "completely reinstalled" and still redirect.

Check: review wp_options for unfamiliar autoloaded entries, scan post content for <script> and eval, and check widgets and any plugin that stores executable templates.

How to check your own site

A quick triage, in the order that finds the most with the least effort. All of it is read-only. If you find something, preserve the evidence before you delete it.

01

Administrators you cannot account for

Two minutes. Highest hit rate of anything on this list.

02

PHP in uploads

One command. Should return nothing on a healthy site.

03

Core and plugin checksums

Two commands. Catches modified files a scanner missed.

04

Abandoned components

Look at last-updated dates in the plugin list. Anything unmaintained for two years with a public vulnerability is a live risk.

05

Cron events with no owner

Hooks that do not map to an installed plugin.

06

Recently modified files

Sort by modification time. A cluster of changes at one timestamp is a story.

Recently modified PHP files, newest first
find . -name "*.php" -type f -printf "%T+ %p\n" \ | sort -r | head -40

That last one is underrated. Legitimate plugin updates change many files at once, so a cluster is not automatically suspicious. But a cluster at 3 am that does not correspond to any update you performed is worth reading.

Closing the vector is not patching one plugin

Finding the entry point is only useful if the fix addresses the class of problem, not just the instance.

If the vector wasClosing it means
An abandoned pluginRemove it and replace the functionality. Updating is not possible if nobody maintains it.
A nulled or pirated pluginRemove it and buy the legitimate version. Nulled distributions frequently ship with the backdoor pre-installed.
A reused or weak passwordRotate it, rotate it everywhere it was reused, enforce MFA on administrators, and rotate the salts.
Stolen FTP credentialsRotate FTP, check the transfer log for other uploaded files, and move to key-based SFTP.
An exposed backup or config fileRemove the file from the web root, check whether it was downloaded, and rotate every credential it contained.
A vulnerable themeUpdate if maintained, replace if not. Child themes inherit the vulnerabilities of the parent.
Why the same site gets hacked twice

If the second incident uses the same vector as the first, the cleanup did not fail at removing malware. It failed at diagnosis. That distinction is worth making when you evaluate who did the work.

What a cleanup that holds looks like

The difference is not effort or tools. It is scope and order:

  • Preserve first. A copy before changes, so the diagnosis has inputs and a claim has evidence.
  • Name the vector. A specific component and mechanism, not "malware was found and removed".
  • Enumerate persistence. Users, cron, uploads, database, modified files. All five, explicitly.
  • Rotate the whole credential chain. Including salts, FTP, database and API keys.
  • Verify against originals. Checksums, not just signatures.
  • Watch it afterwards. Reinfection usually happens within weeks. Thirty days of monitoring covers the window where a missed mechanism would show itself.

That is the sequence our malware removal service follows, and it is why it includes monitoring rather than ending at a clean scan. If the incident may involve a claim or a dispute about responsibility, the analysis version is forensic analysis, which documents the timeline and chain of custody.

And the reason most clients move to a maintenance plan afterwards is simple: the vector on a cleaned site was almost always an unmaintained component. Keeping components current is what stops the next one from opening.

Questions

How long after a cleanup would reinfection show up?

Most automated re-exploitation happens within days to a few weeks, because the same scanners that found the site the first time keep sweeping. A dormant backdoor used manually can take longer. Thirty days of monitoring covers the common case.

Is a security plugin enough?

It helps, and it is not sufficient on its own. A plugin runs inside WordPress, so it cannot see server-level cron, FTP uploads or another site on the same account. It also cannot patch an abandoned plugin for you.

Should I just reinstall WordPress completely?

Replacing core files is useful and it does not touch the database, the uploads directory or the credentials. Sites get "fully reinstalled" and keep redirecting because the injection was in post content. Reinstall is a step, not a solution.

Can you tell whether the second hack is the same attacker?

Sometimes the infrastructure and tooling overlap enough to say the method is the same. Attributing it to the same person is a different claim, and log evidence alone does not support naming an individual. We are explicit about that limit in reporting.

What is the single highest-value check?

The administrator list. It takes two minutes, requires no tools, and finds the most common persistence mechanism we encounter.

Related reading
SERVICE

Malware removal and hack recovery

Entry point identified, persistence enumerated, credentials rotated, 30 days of monitoring.

See the service →
ARTICLE

Preserve your logs before you clean

The three-line email to your host, and what each log type can prove.

Read the article →
SERVICE

Maintenance plans for agencies

Keeping components current is what stops the next vector from opening. Resellable under your brand.

See the service →

Cleaned twice and still getting hacked?

Send us the URL and what was done last time. We will tell you which of these seven was probably missed.

MexicoWordPress · Central Time · fluent English · USD invoicing · since 2012.