Available for new work Remote - worldwide hello@wordpressfixe.com
wordpressfixe

Security

Why your WordPress site keeps getting reinfected after cleanup

Reinfection is not bad luck. It is proof that the entry point is still open — and no scanner will find it for you if the payload was written for your site.

The most demoralising sentence in WordPress security is “it came back”. You paid for a cleanup, the site was clean for four days, and then the redirects returned. The natural conclusion is that cleaning does not work. The accurate conclusion is that the cleanup treated a symptom and left the mechanism in place.

Malware on WordPress is usually two components: a payload (what visitors see) and a persistence mechanism (what brings the payload back). Scanners are good at the first and poor at the second.

How persistence actually works

A dropper file

A small, obfuscated PHP file somewhere the scanner does not look — often a plausible name in wp-content/uploads/, wp-includes/, or the root. It recreates the payload on a schedule when it is requested, or when an admin logs in.

Injected database rows

Code in wp_options, wp_postmeta, widgets or a theme option that is evaluated later. The files can be clean and the site still compromised, because the payload is data.

A malicious cron event

WordPress cron entries stored in the database that fire a callback from a file the attacker controls. Deleting the file without removing the event leaves a broken trigger; deleting the event without the file leaves the file.

A hidden administrator

An admin account with a plausible name, used to log in after each cleanup and reinstall everything. This is why password rotation is not optional.

Must-use plugins

Files in wp-content/mu-plugins/ load automatically with no activation step and are invisible on the normal Plugins screen. This is a favourite hiding place.

An unpatched entry point

An outdated plugin, a nulled theme, or a stolen FTP password. Clean the site perfectly and the attacker repeats the original upload tomorrow.

The order that works

  1. Snapshot everything. Files and database, before any deletion. If the cleanup breaks something, you need a way back, and if you need to prove what happened, you need evidence.
  2. Inventory rather than scan. Compare core, plugins and themes against clean upstream copies. List unknown files and recently modified files. Review them; do not bulk-delete.
  3. Trace the entry point. Access logs for POST requests to PHP files, upload timestamps, and the first malicious file created. The earliest timestamp is usually the way in.
  4. Remove the persistence. Droppers, backdoors, mu-plugins, injected rows, cron events, hidden users — in that order, because each can recreate the next.
  5. Rotate credentials. Salts and keys in wp-config.php, every admin password, the database user, FTP/SFTP, and any API keys stored in the database.
  6. Harden the actual weakness. Update or remove the vulnerable extension, disable file editing, restrict login attempts, and add WAF rules if the host offers them.
  7. Verify, then watch. A second independent scan, a file-integrity baseline, and monitoring for thirty days. Reinfection after this point means something new, not something missed.

Why “restore from backup” often fails

A backup restores the code, the database and the vulnerability together. If the site was compromised three weeks before you noticed, the backup from two weeks ago is already infected. And if the entry point is a stolen FTP password that was never changed, the attacker simply comes back.

A restore is the right move when you have a verified clean point and a closed entry point. It is the wrong move when you have neither.

What to ask anyone who cleans your site

  • What was the entry point, specifically?
  • What did you remove, and can I see the list?
  • Were credentials and salts rotated?
  • Is there monitoring after the cleanup, and for how long?
  • If it comes back within the window, what happens?

If the answer to the first question is “a plugin was vulnerable” without a name and version, the investigation was incomplete.

The honest expectation

A thorough cleanup on a single site is usually a day of work, sometimes two. It is not a scan-and-delete job, and the difference is exactly the difference between a site that stays clean and one that does not.

If you are dealing with a repeat infection, WordPress malware removal includes the entry-point investigation and a thirty-day reinfection watch — because the returning payload is the part that matters.

Written by

Sahed Rana Neka

PHP and WordPress work focused on repair: emergency fixes, malware cleanup, performance and migrations. Portfolio on sahed.dev.

Need this fixed rather than explained?

MoreKeep reading

Other notes from the same work.