Guides · Reinfection
Your site keeps getting hacked again. Here's why.
You cleaned the site. Maybe you paid someone to clean it. Everything looked fine for a week, or a month. Then the redirect is back, the spam is back, or your host emails about malware again. It's one of the most frustrating things that can happen to a website, and it's almost never bad luck.
A hack that comes back means one of two things: something was left behind, or the way in is still open. Usually both. Here's where to look.
1. A backdoor was left behind
Attackers rarely leave just the visible malware. They also leave a backdoor: a small piece of code that lets them get back in whenever they like, even after you change your passwords. Cleanups often remove the obvious problem and miss the backdoor, because it's built to look harmless.
Common places backdoors hide:
- Inside a real plugin or theme file, a few lines added to a file that otherwise looks normal.
- The must use plugins folder (
wp-content/mu-plugins). It loads automatically and doesn't appear in your Plugins screen. - The uploads folder, disguised as an image or a cache file. PHP files have no business being there.
- The site's main folder, with a name that sounds like part of WordPress.
- The database, in options, widgets or posts, so that reinstalling files never touches it.
- Server settings files such as
.htaccessor.user.ini, which can quietly load a hidden file on every page.
2. Only the suspicious plugins were reinstalled
A common shortcut is to reinstall the plugins that look odd and leave the rest. But the injected code is very often in a plugin that looks perfectly fine, which is exactly why it was chosen. The safe approach is to reinstall WordPress core, every plugin and your theme from clean, official copies, and keep only your uploads and database, checking those by hand.
3. An attacker still has an account
Check every administrator in WordPress, and check the database directly too, because some backdoors hide their admin account from the Users screen. Also look at application passwords on admin accounts, extra FTP or SFTP accounts, SSH keys, and users in your hosting control panel. Any one of these lets someone walk straight back in.
4. Another site on the same account is infected
If your hosting account has more than one website, including an old test site or a forgotten copy, one infected site can reinfect the others. Clean one, and it gets reinfected from next door within days. Check every site on the account, not just the one that showed symptoms.
5. Something scheduled puts it back
Some infections set up a scheduled task that reinstalls the malware every few hours, either a WordPress cron event or a server cron job in your hosting panel. Delete the malware without removing the schedule and it simply comes back on its own.
6. The way in was never closed
Even a perfect cleanup won't hold if the original hole is still open. The usual culprits:
- an outdated plugin or theme with a published security flaw
- a plugin that's no longer maintained at all
- a reused or leaked password, especially on an admin account without two factor login
- a nulled (pirated) theme or plugin, which often comes with a backdoor already inside
A good cleanup should tell you which one it was, or at least what's most likely, so you can fix it.
7. Caches are still serving the infected page
Sometimes the site is actually clean, but a caching plugin, your host's cache or a CDN like Cloudflare is still serving the old infected pages. It looks like a reinfection when it isn't. Clear every cache after a cleanup, then check again.
How to check from the outside: open your site in a private window while logged out, on a phone, and by clicking through from a Google search. Many infections only show up for certain visitors. Our free check compares what different visitors and search engines see.
Breaking the cycle
- Back up first, files and database, even though it's infected. It's your evidence.
- Reinstall everything from clean copies: core, every plugin, the theme.
- Hunt the backdoors: must use plugins, uploads, the main folder,
.htaccessand.user.ini, and the database. - Remove every unknown account: WordPress, hosting, FTP and SFTP, SSH keys, application passwords.
- Check scheduled tasks in WordPress and in your hosting panel.
- Clean every site on the account, not only the one that broke.
- Change every password and generate new WordPress security keys, which logs everyone out.
- Close the way in: update or remove the vulnerable component, and turn on two factor login.
- Clear every cache, then check again from the outside the next day, and a week later.
Need a hand?
Reinfections are what we specialise in. We clean the whole account, find the backdoor and the way in, and give you a written report of what we found and what we changed, so you know why it kept coming back and that it's actually gone. We agree the scope and price with you before any paid work starts.