Security

Hacked WordPress site keeps getting reinfected? Why the malware comes back

You cleaned your WordPress site, or restored a backup, and everything looked fine. A few days later the spam pages are back, visitors are redirected to strange sites again, or your host sends another warning. This is one of the most frustrating situations for a site owner, and it is very common. The good news: reinfection almost always has a precise cause, and it can be found.

Why the malware comes back

The entry point is still open

Removing malicious files treats the symptom. If the attackers got in through an outdated plugin, a nulled theme or a weak password, and that door is still open, they will simply come back the same way. Often automatically, within days.

A backdoor was left behind

Attackers rarely leave a single file. They hide small scripts in uploads folders, in fake plugin files, in the database or in scheduled tasks, so they can get back in even after the visible malware is gone. A cleanup that misses one of these is only a pause.

Hidden admin users and stolen credentials

An extra administrator account, sometimes hidden from the users list, or credentials that were never changed after the attack, give full access to anyone who has them.

The backup was already infected

Many infections stay silent for weeks before showing anything. Restoring a backup from last week can bring back a site that was already compromised, together with the vulnerability that let the attackers in.

Other sites on the same account

If several sites share the same hosting account, an old forgotten installation or a test site can reinfect the clean one. Every site on the account has to be checked, not just the one showing symptoms.

What a cleanup must include to stick

  1. Find the entry point: server logs, recently modified files and vulnerable components tell you how the attack happened.
  2. Replace core, plugins and themes with clean copies from official sources, keeping legitimate customisations.
  3. Clean the database: injected scripts, spam content, suspicious options and scheduled tasks.
  4. Review every user and remove accounts you do not recognise.
  5. Change every credential: WordPress, hosting, FTP/SFTP, database, plus the security keys in wp-config.php.
  6. Close the vulnerability: update or remove the component that was exploited.
  7. Monitor the site for the following days, because that is when a missed backdoor shows itself.

If you are not sure your site was hacked in the first place, start from how to tell if your WordPress site has been hacked. For the full cleanup procedure, read hacked WordPress site: how to clean it up safely.

A typical example

A company’s site starts redirecting mobile visitors to a gambling site. The hosting provider runs a malware scan, removes a dozen files, and the site works again. Five days later the redirects are back. Looking deeper, the cause is a forms plugin that had not been updated for a year, with a known vulnerability, plus a small file hidden in the uploads folder and disguised as an image. Removing the hidden file, updating the plugin, cleaning the database and changing all passwords stops the reinfection. The site is then put under regular maintenance, so updates no longer wait for months.


Has your site been hacked, or hacked again? With my hacked WordPress site cleanup service I remove the malware, find the entry point and close it, starting within 24 business hours. Get in touch and tell me what is happening.

Do you have a project to build or to put back in order?

Let's talk