This is Part 4 of our hacked WordPress series. Part 3 walked through the clean-up. This part covers the thing that makes clean-ups fail: the backdoor.
A backdoor is the attacker’s spare key. Once they’re in, the first thing most attackers do is leave a few quiet ways back, so that if you change the password or delete their files, they can return anyway. Miss one, and the site is hacked again within days, often with everything you removed planted back.
That’s exactly what happened on the site in Part 1. There, the spare key was a real admin password. Here are the other places we look.
As in Part 2, these commands only look. They don’t change anything. Run them in cPanel’s Terminal, in your website’s folder (cd ~/public_html).
1. Admin accounts
The simplest backdoor isn’t code at all. It’s an admin account. Attackers either create a new one with a believable name, or keep using an old one nobody remembers.
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
Watch for: names like wpadmin, support or wp-system, email addresses you don’t recognise, and old accounts nobody uses. Some attackers also hide their account from the Users screen with a few lines of code, so trust this command over the dashboard.
2. Fake plugins
Fake plugins are uploaded through the dashboard and given names that sound official. On the site in Part 1 they were called things like seo_1794290843 and error_404_1794290907.
wp plugin list --fields=name,status,version
ls -la wp-content/plugins
Watch for: names ending in long numbers, plugins with no version, and folders in wp-content/plugins that don’t appear in the list at all.
3. Must-use plugins
Files in wp-content/mu-plugins run on every page, can’t be switched off from the dashboard, and don’t show in the normal plugins list. That makes them a favourite.
ls -la wp-content/mu-plugins 2>/dev/null
wp plugin list --status=must-use
Watch for: anything you can’t explain. Some hosts put a file or two here for caching or security; check the name with your host before removing it.
4. The uploads folder
Attackers drop PHP files among your images, sometimes named like images (photo.jpg.php) or hidden in old year folders.
find wp-content/uploads -type f \( -name "*.php" -o -name "*.phtml" -o -name "*.phar" -o -name "*.php.*" \)
Watch for: anything at all, apart from a blank index.php. Blocking PHP in this folder, as in Part 3, stops these from running even if one is missed.
5. Look-alike files
A copy of a real WordPress file with one letter changed sits next to the original and goes unnoticed. We found wp-logiin.php on the site in Part 1.
ls *.php | grep -vxE "(index|wp-activate|wp-blog-header|wp-comments-post|wp-config|wp-config-sample|wp-cron|wp-links-opml|wp-load|wp-login|wp-mail|wp-settings|wp-signup|wp-trackback|xmlrpc)\.php"
wp core verify-checksums
Watch for: any name the first command prints, and any “should not exist” line from the second.
6. The database
This is the one scanners miss most. Code can be stored in the database and run from there: in a widget, a setting, or a post. It survives reinstalling every file.
wp db search "eval(" --all-tables --stats
wp db search "base64_decode" --all-tables --stats
wp db search "<script" wp_options --stats
Watch for: matches in wp_options (settings) or widgets that you didn’t add. A few hits in posts can be normal, for example an embedded form or a chat widget. If you’re not sure what you’re looking at, this is a good point to ask for help.
7. Scheduled tasks
A scheduled task can quietly download the attackers’ files again every hour, long after you’ve removed them. There are two kinds: the server’s own, and WordPress’s.
crontab -l
wp cron event list --fields=hook,next_run_relative,recurrence
Watch for: server jobs that use curl, wget or a web address, and WordPress events with strange or random-looking names.
8. Server access
Finally, the doors outside WordPress: an SSH key added to the account, or an extra FTP user.
cat ~/.ssh/authorized_keys 2>/dev/null
FTP accounts are listed in cPanel under FTP Accounts. Watch for: any key or FTP user nobody on your team added. On the site in Part 1 there were none, but we always check.
Why one missed file is enough
Each of these is small. A backdoor file can be a single line of code. But any one of them gives the attackers everything back: they log in, re-upload their tools, and the clean-up starts over.
That’s why we lock them out first, then check every place on this list, then watch for two weeks, as in Part 3. A scan alone is a good start, not proof.
Rather not go hunting?
That’s a fair call. This is slow, careful work, and the database step in particular is easy to get wrong. Send us the site and we’ll check all eight, tell you what we found in plain words, and close the doors. A care plan keeps them closed every month after.
The last part of the series is for owners who aren’t technical at all: what to do in the first hour, before anyone touches the server.
Sources
- WordPress developer docs: wp db search
- WordPress developer docs: wp cron event list
- WordPress developer docs: must-use plugins
- WordPress.org: FAQ, my site was hacked
Common questions
What is a backdoor in WordPress?
Anything an attacker leaves behind to get back in after you clean up: a hidden admin account, a small PHP file that runs their commands, a fake plugin, a scheduled task or an SSH key. It usually looks harmless or hides among normal files.
Why does my WordPress site keep getting hacked after cleaning?
Usually one of two reasons: the attackers still have a working password, or a backdoor was missed. Both let them walk back in and plant everything again. Lock them out first, then check every place in this guide.
Can a security plugin find every backdoor?
Scanners catch a lot, but not everything. Backdoors in the database, fake must-use plugins, cron jobs and SSH keys are often missed. A scan is a good start, not proof that the site is clean.
What is the mu-plugins folder?
wp-content/mu-plugins holds must-use plugins. They run on every page and don't appear in the normal plugins list, so they are a favourite hiding place. Some hosts put legitimate files there, so check what each one is before removing it.




