Skip to content
HyperDAF editorialMalware & Recovery

Find Hidden WordPress Malware: Backdoors & Spam

Learn to remove WordPress malware hiding in plain sight: backdoors, SEO spam, and cloaked infections. Proven detection techniques that find what scanners miss.

Malware & RecoveryEditor-curated guide
16 min9 sectionsIntermediate
Before you beginWhat this guide gives you
9Focused sections16Minutes to finishIntermediateExperience level93Article views
Start reading
Table of contents9

The store owner called me at 2am. His site looked perfect — homepage loading, products showing, checkout working. But his customers were getting spam emails “from” his shop, and Google had started showing Japanese text under his site name in search results. He kept saying the same thing: “But it looks fine to me.” That sentence is the signature of hidden malware. It is designed to look fine to you while it works against you in the dark.

I am Ryan Clarke. I run WordPress infrastructure for high-traffic stores, and I have cleaned more hacked sites than I can count. Here is what nine years of 2am cleanups taught me: hidden malware — backdoors, spam injectors, redirect scripts — survives because people clean in the wrong order. Delete the symptom before killing the cause, and it grows back overnight like a weed you snapped off at the stem.

This guide gives you the exact order of operations I use on real cleanups: how to confirm you’re infected, how to hunt backdoors in your files, how to hunt malware in your database, how to remove everything without breaking your site, and how to lock the door afterward. Whether you have SSH access or only a hosting control panel, you will know what to do. Let’s get your site back.

Illustration of an open trapdoor with a warning sign glowing beneath it, in green on a deep navy background, symbolising hidden WordPress malware.

One important note before we start: this guide teaches manual cleanup because scanners miss things and automated cleaners sometimes break things. But if your site takes payments or handles customer data, consider getting professional help for the actual cleanup — use this guide to understand what’s happening and to verify the work. And whatever you do, back up first. A backup taken before cleanup is your undo button.

Here is what this guide covers:

  • The Symptoms: How You Know You’re Infected
  • Step Zero: Quarantine and Back Up (Your Undo Button)
  • The Golden Rule: Kill the Code Before You Delete the User
  • Hunting Backdoors in Your Files
  • Hunting Malware in Your Database
  • The Nuclear Option: Reinstall Core, Themes, and Plugins From Source
  • Locking the Door: Passwords, Keys, Updates, Monitoring
  • Frequently Asked Questions
  • Final Thoughts

Ready? Let’s get started.

The Symptoms: How You Know You’re Infected

Hidden malware earned its name — the whole point is that you don’t notice it. But it always leaves tracks. Here are the symptoms I check first, in the order that catches the most infections:

Your site looks fine to you but not to everyone else. This is the classic tell. Attackers often show the real site to logged-in admins and to direct visitors, while serving spam or redirects to search engines and new visitors. Log out completely, open your site in a private browser window, and actually look. Then check how Google sees you: search site:yourdomain.com and read the results. Japanese characters, pharmacy words, or gibberish in your titles means your pages are poisoned in the database.

Mystery admin users. Go to Users → All Users in your dashboard and look at every administrator account. Do you recognise all of them? Now compare that list against the database — I will show you how below — because the sneakiest backdoors hide their admin accounts from the dashboard entirely. An admin you can only see in the database is a five-alarm fire.

Emails you never sent. Customers report spam “from” your domain, or your host warns you about outgoing mail volume. Check whether your contact forms are being abused, but also consider the worse option: a spam script living in your files, sending mail directly through your server.

New files with recent dates. In your hosting file manager, sort wp-content by modification date. Files you didn’t touch, modified at 3am last Tuesday? That’s worth investigating.

Google warnings or traffic drops. A sudden “This site may be hacked” notice in search results, or a cliff-edge drop in organic traffic, often means Google detected what you haven’t.

If two or more of these are true, stop treating it as a maybe. Assume infection and move to Step Zero. Here’s the deal: hoping it’s nothing is how a small infection becomes a blacklisted domain.

Step Zero: Quarantine and Back Up (Your Undo Button)

I know — backing up an infected site feels wrong, like photographing a crime scene instead of cleaning it. But a backup taken right now is the only undo button you will have if a cleanup step goes sideways. I learned this the expensive way, deleting a “suspicious” file on a client’s site in 2019 that turned out to be part of their booking system. The pre-cleanup backup saved me. Take the backup.

Do this now, in this order:

1. Download a full file backup — everything, via your host’s backup tool or FTP. Yes, it includes the malware. That’s fine; it’s evidence and insurance, not a restore candidate. 2. Export the database — via phpMyAdmin (Export → Quick) or WP-CLI: wp db export backup-before-cleanup.sql. Name it clearly with today’s date. 3. Screenshot everything suspicious — the mystery user, the weird search results, the strange files. If this ever becomes a conversation with your host or a security professional, evidence helps.

Then quarantine. If your host offers it, put the site in maintenance mode or restrict it while you work — not because visitors are in danger from most WordPress malware (they usually aren’t), but because an active infection can fight your cleanup: some malware re-downloads its friends while you delete them. If you have the option, block the site at the server level during cleanup and work fast.

One more thing: change nothing yet. Don’t delete the weird user. Don’t delete the weird file. Every premature deletion destroys evidence and, worse, can trigger the malware’s self-defence. The golden rule is next, and it explains why.

The Golden Rule: Kill the Code Before You Delete the User

This is the single most important section in this guide. Read it twice.

Most hidden malware has two parts: the payload (spam scripts, redirect code, the stuff doing damage) and the dropper (hidden code whose only job is to recreate the payload — and the attacker’s admin account — if you delete them). The dropper is the weed’s root. Delete the visible weed without digging the root, and it grows back. I have watched site owners delete the same rogue admin account four nights in a row, getting angrier each time, because nobody told them about the dropper.

So the order of operations is everything:

1. First, find and remove every piece of malicious code (files and database). 2. Then, delete the rogue users and clean the damage. 3. Finally, rotate credentials and lock the door.

Delete the user first, and the dropper — sitting quietly in your theme’s functions file or a must-use plugin — simply creates a new admin within minutes. This is the mistake behind nearly every “the malware keeps coming back” story I have ever heard. Work the list in order and it won’t be your story.

Bonus tip: while you hunt, keep a simple text log of everything you find and remove — file paths, database rows, usernames. If something comes back, that log tells you (or a professional) exactly where the surviving dropper lives.

Hunting Backdoors in Your Files

Time to dig. You need file access for this — FTP/SFTP, your host’s file manager, or SSH. If you have SSH, everything is faster; I’ll give you the commands and the manual equivalents.

Start with the places backdoors love most:

  • wp-content/uploads/ — any PHP file here is guilty until proven innocent. WordPress never puts executable code in your uploads folder. Every .php file under uploads should be treated as hostile: download a copy for your records, then delete it. With SSH: find wp-content/uploads -name "*.php" -type f lists them all.
  • wp-content/mu-plugins/ — the invisible plugin folder. Must-use plugins load automatically and don’t appear in your normal Plugins list, which makes them perfect hiding spots. If you didn’t put files here yourself, investigate every one. Delete anything you don’t recognise (after backing up).
  • Your theme’s functions.php. The single most common backdoor location I encounter. Open it and read it — all of it. Look for long obfuscated blobs, base64_decode, eval(, gzinflate, str_rot13, or include statements pointing at strange paths. Compare it against a fresh copy of your theme if you have one.
  • wp-config.php and .htaccess. Both should be short, readable files. Anything obfuscated or appended here doesn’t belong. A malicious .htaccess is often the culprit behind “redirects only for Google visitors” symptoms.

Now run the signature hunts. These SSH commands search your files for the fingerprints malware leaves. Run them from your WordPress root:

grep -rlE "wp_(create|insert)_user" wp-content --include=*.php

This finds files that create user accounts — something few legitimate plugins need to do outside specific folders. Anything in mu-plugins, uploads, or a plugin you don’t recognise deserves a hard look. (Membership and shop plugins create customers legitimately — check those results with judgement, not panic.)

find . -type f -name '*.php' | xargs egrep -li "(eval\(|base64_decode|gzinflate|str_rot13|shell_exec|passthru)" 2>/dev/null

This is noisy — some legitimate code uses these functions — but every real backdoor I have ever found lit up on this search. Open each hit, read the surrounding code, and ask: does this belong here?

Verify your core files. WordPress can check itself. With WP-CLI: wp core verify-checksums compares every core file against the official release. Any file that fails is modified or fake — replace it. Without WP-CLI, download a fresh copy of your exact WordPress version from wordpress.org and compare the wp-admin and wp-includes folders file by file. Tedious, but conclusive.

No SSH? No problem. Your host’s file manager can do all of this — it’s just slower. Sort by date modified to spot recently changed files, open suspicious files in the editor to read them, and compare against fresh downloads. The technique is the same; only the tool changes. For a deeper walkthrough of manual scanning techniques, see our manual malware scanning guide.

Illustration comparing a clean web page with an infected one marked by a bug, in green on a deep navy background, symbolising malware symptoms.

Hunting Malware in Your Database

Files are only half the battlefield. Modern WordPress malware loves the database because most site owners never look there. Here’s where to look, with the actual queries. Back up first (you already did — Step Zero), and test destructive queries on a copy if you’re nervous.

Ghost admins: the two-list test. Open phpMyAdmin and run:

SELECT ID, user_login, user_email, user_registered FROM wp_users;

(If your tables use a different prefix than wp_, adjust accordingly.) Now compare this list against Users → All Users in your dashboard. Any administrator in the database who doesn’t appear in the dashboard is hidden by malicious code — and that code is your real target (remember the golden rule). Note the usernames and IDs, but don’t delete them yet.

Poisoned options. The wp_options table is a favourite hiding spot for redirect scripts and spam payloads because it autoloads on every page:

SELECT option_id, option_name FROM wp_options
WHERE option_value LIKE '%<script%' OR option_value LIKE '%eval(%'
OR option_value LIKE '%base64_decode%' OR option_value LIKE '%<iframe%';

Investigate every hit. Legitimate plugins occasionally store script snippets, so read before deleting — but an eval( blob in an option named something innocent is malware until proven otherwise.

Poisoned content. Spam injections hide in posts and postmeta — the Japanese SEO spam from our 2am story lives here:

SELECT ID, post_title FROM wp_posts
WHERE post_content LIKE '%<script%' OR post_content LIKE '%display:none%'
OR post_content LIKE '%position:absolute%';

Check wp_postmeta too, and look for unfamiliar domains anywhere in the database. When you find injected content, don’t just delete the script tags — check whether the whole post or page was created by the attacker (compare post_author and post_date against your real publishing history).

Suspicious autoload entries. Attackers sometimes register their payload as an autoloaded option so it runs on every request. In phpMyAdmin, browse wp_options sorted by autoload = 'yes' and eyeball unfamiliar option_name values. Anything you don’t recognise, research before removing — but unfamiliar plus obfuscated equals guilty.

Write down everything you find. That log from the golden-rule section? This is where it earns its keep.

The Nuclear Option: Reinstall Core, Themes, and Plugins From Source

Here’s an honest line from nine years of cleanups: never hand-clean a plugin or theme file. You will miss the second copy. Malware authors know you’ll find the obvious blob, so they plant two or three. The file you “cleaned” still has a friend, and the friend has the dropper, and you’re back to deleting rogue admins at midnight.

The reliable fix is replacement, not surgery:

1. Replace WordPress core entirely. With WP-CLI, one command does it: wp core download --version=$(wp core version) --force --skip-content. Without WP-CLI: download your exact version from wordpress.org, delete wp-admin and wp-includes, upload the fresh copies, and overwrite every root PHP file except wp-config.php. Your content lives in wp-content and the database — neither is touched. 2. Reinstall every plugin from its source. Delete the plugin’s folder completely, then install fresh from wordpress.org or the vendor’s site. Premium plugins: download a clean copy from your account with the vendor. And hear me on this: pirated (“nulled”) premium plugins are the single most common infection source I see. If your site runs any, they go now, permanently. No exceptions, no “but it was working fine.” 3. Do the same for themes. Delete and reinstall from source. Remove every inactive theme while you’re at it — disabled themes are still executable code and still get exploited. 4. Clean uploads as described above — delete every PHP file under wp-content/uploads, no exceptions.

After replacement, re-run your checksum verification and your grep searches. They should come back clean. If they don’t, you missed a file — go back to the file hunt. A clean rescan is the only “done” signal that counts. Our full security audit checklist makes a good post-cleanup verification pass.

Abstract 3D illustration of a shield being cleaned by sweeping green geometric waves on a deep navy background, symbolising malware removal.

Locking the Door: Passwords, Keys, Updates, Monitoring

The site is clean. Now make sure it stays clean — because the attacker knows your address now.

Rotate every credential. Every admin password, your hosting control panel password, FTP/SFTP passwords, and the database password. The attacker may have harvested all of them. Then regenerate your WordPress security keys: visit the official salt generator, copy the output, and replace the eight *_KEY and *_SALT lines in wp-config.php. This logs out every session on the planet — including the attacker’s.

Now delete the rogue users — finally, the code is gone so they can’t come back. In the dashboard: Users → All Users → Delete, reassigning any content to yourself (rogue admins rarely have real content, but WordPress asks anyway). Check application passwords too: open each real admin’s profile and revoke any application passwords you didn’t create — they bypass the normal login entirely.

Update everything and set the discipline. Update core, themes, and plugins to current versions. Delete what you don’t use. Then decide your update policy going forward — our 3-2-1 backup guide and backup restore drills belong in your regular routine now, because the next incident is a matter of when, not if.

Harden the usual entry points. Disable XML-RPC if you don’t need it (our XML-RPC guide shows the safe way), set proper file permissions so the web server can’t rewrite your code, and consider limiting login attempts. If this was your second infection in a year, that’s a signal to move to a host with real security monitoring — some lessons are cheaper to buy than to repeat.

Watch for a month. Check your users list weekly. Watch your search results. Set a calendar reminder. Most reinfections happen within thirty days because something was missed — early detection turns a disaster into a footnote.

Frequently Asked Questions

How did my site get hacked? I didn’t do anything wrong. You probably didn’t. Most WordPress infections are automated — bots probe millions of sites for known vulnerabilities in outdated plugins and themes. The entry point is almost always software that wasn’t updated, not something you clicked. That’s actually good news: it means the fix (update discipline) is entirely in your control.

Can I just restore from a backup instead of cleaning? Only if you know the backup predates the infection — and most people don’t know when the infection started. Restoring a backup from after the breach just restores the malware. If you have a verified clean backup (scanned, from before symptoms), restoring it plus rotating credentials is legitimate. Otherwise, clean first.

Will a security plugin remove the malware for me? Scanners are good at finding known malware and some offer cleanup, but they miss custom backdoors and can’t judge your specific files the way you can. Use a scanner as a second opinion after manual cleanup, not as the cleanup itself. No plugin replaces the order of operations in this guide.

My host suspended my site for sending spam. What do I tell them? Tell them the truth: the site was compromised, you’ve completed a full cleanup (list what you did), rotated all credentials, and updated everything. Ask what their reinstatement process requires — some hosts want a clean rescan before unsuspending. Your cleanup log from this guide is exactly the evidence they want to see.

How do I know it’s really gone? Three green lights: your file searches (checksums, grep, uploads PHP hunt) come back clean, your database queries return nothing suspicious, and the symptoms stop — no new mystery users, no spam, clean search results — for at least two weeks of watching. One green light is hope. Three is confidence.

Abstract 3D illustration of a padlock with a key surrounded by green geometric rings on a deep navy background, symbolising a secured WordPress site.

Final Thoughts

That 2am store owner? We worked the list in order — backup, file hunt, database hunt, full replacement from source, credential rotation — and by sunrise his site was clean. Two weeks of watching, three green lights, and he finally slept. The malware had been there for months. Nobody noticed because it was designed not to be noticed. That’s the thing about hidden malware: finding it is the skill, and now it’s yours.

My honest line: cleanup is stressful, tedious work, and the temptation to skip steps is enormous. Don’t. Every shortcut — deleting the user first, hand-cleaning one file, skipping the rescan — is how infections survive. The order of operations is the whole game.

Found something weird on your site while reading this? Describe it in the comments — symptoms, what you’ve checked, what you found. I read every one, and I’ll help you spot the pattern if I can. Related reading: how to stop WordPress brute-force attacks, the WordPress file permissions security guide, WordPress major versus minor updates, shared versus managed WordPress hosting, and plugin mistakes that slow WordPress.

Written by

Ryan Clarke

Ryan runs WordPress infrastructure for high-traffic stores. His 9 years in hosting and DevOps shape his guides on servers, staging workflows, backups, and deployment.

7 published articles
View all articles

Related articles

View all articles

2 comments

Join the discussion

Your email address will not be published. Required fields are marked *

Keep comments relevant and respectful.