Why WordPress Sites Get Hacked: The Five Most Common Entry Points in 2025
Most WordPress hacks are not sophisticated operations. Attackers run automated scanners across millions of domains, identify known vulnerabilities, and
Clicking anywhere on your site opens spam links in new tabs. You clean the infection from wp-config.php, and within hours it's back. You clean it again.
Clicking anywhere on your site opens spam links in new tabs. You clean the infection from wp-config.php, and within hours it’s back. You clean it again. It comes back again. You buy a security plugin, run a full scan, get a clean bill of health, and the next morning your visitors are still being redirected to gambling sites. If this pattern sounds familiar, the problem almost certainly isn’t your WordPress installation. The problem is below it.
A forensic case study published by Malware News documents exactly this situation: a site owner watching malware return to wp-config.php every few hours despite repeated cleanups. A Wordfence analyst ran a full WordPress-level audit — no rogue files, no database injections, no compromised admin accounts. The WordPress installation was clean. The site kept reinfecting itself because the attacker wasn’t living inside WordPress at all.
The attacker had turned a webmail log file into a root-level backdoor. That file sits on the server, outside WordPress entirely, and no WordPress security plugin, file integrity monitor, or admin-panel scan reaches it. The entire attack chain, from initial access to a working webshell, took 14 seconds. Root escalation followed, giving the attacker full control of the server, not just the WordPress site running on it.
With root access, rewriting wp-config.php is trivial. The attacker’s script did exactly that on a cycle of roughly every 2 to 6 hours, so every time the site owner removed the malicious code, the server-level process simply wrote it back. Cleaning WordPress was the equivalent of mopping the floor while the tap was still running.
The payload itself was designed to survive casual inspection: double-encoded, placed at the very top of wp-config.php, and written to suppress error output so it wouldn’t surface in logs. Critically, it targeted only front-end visitors. Anyone logged into the WordPress admin, or any automated tool hitting the API, saw nothing unusual, which is why a developer or security analyst checking the site from an admin session could find nothing wrong while customers were actively being sent to spam destinations. The attack chain connected to 29 or more malicious domains.
This matters for how you interpret a “clean” security scan. A scanner operating at the WordPress level checks files, the database, and user accounts within WordPress. It has no visibility into the server environment, the hosting account’s file system outside the WordPress directory, or any processes running at the operating system level. In this case, a clean WordPress scan and an actively compromised server were running simultaneously.
Each cleanup attempt takes time, often money if you’re paying someone, and carries the assumption that once done, it holds. When the infection returns within hours, the natural response is to clean again, perhaps more thoroughly, perhaps with a different plugin or a different specialist. None of that changes the outcome if the persistent access point is on the server itself.
There is also a reputational dimension that doesn’t reset when you clean the files. Google’s Safe Browsing flags domains that serve malicious redirects, and a flagged domain suppresses search visibility and triggers browser warnings for every visitor who follows a link to your site. Visitors who were redirected to spam have already formed an impression, and those consequences don’t disappear the moment wp-config.php is clean again.
Business owners reasonably assume that a security plugin covering WordPress is covering their site. It is covering one layer of a system that has several. The server, the hosting control panel, the mail service, and the operating system processes running beneath WordPress are all outside that coverage, and an attacker who has escalated to root has access to all of it.
A server-level investigation is a different exercise from a WordPress audit. It means examining server logs for lateral movement, checking for unexpected processes or scheduled tasks, auditing files outside the WordPress directory, reviewing the hosting account for unauthorised access, and tracing the original entry point. In this case, that entry point was a webmail vulnerability, with nothing inside WordPress involved. Fixing WordPress without finding that entry point leaves the door open.
If your site has been reinfected more than once after a cleanup, or if your scans return clean results while visitors are still experiencing redirects or pop-ups, the investigation needs to move to the server layer. The infection will return until the server-level access is found, removed, and the original entry point is closed, making every further WordPress cleanup a cost with no endpoint.
Hosting providers also vary significantly in what they will investigate and remediate on your behalf. Many shared hosting environments give you limited access to the server logs and processes you’d need to diagnose this properly. A site compromised at root level may need to be migrated entirely to a clean server environment, because establishing confidence that every malicious file and process has been removed from a deeply compromised host is difficult without full access to the underlying system.
If your WordPress site keeps getting reinfected after cleanups, or if security scans are returning clean results while visitors are still experiencing redirects, I offer a server-level security review that goes beyond the WordPress layer to examine where persistent access is actually coming from. Every day the backdoor remains in place, your visitors are being sent to spam destinations and your domain risks a Safe Browsing flag that will suppress your search visibility. Contact The WordPress Guy to arrange a server-level investigation before the next reinfection cycle.
Related articles
Most WordPress hacks are not sophisticated operations. Attackers run automated scanners across millions of domains, identify known vulnerabilities, and
A critical security flaw in the Burst Statistics WordPress plugin left more than 200,000 business websites exposed to complete administrative takeover,...
Slider Revolution is installed on millions of WordPress sites worldwide. If yours is among them, a recently disclosed security flaw means any logged-in...
Security issues need permanent fixes, not surface-level patches. This is exactly the work I specialise in.
View security services →
Jason Boyd
Specialist WordPress Engineer · Former W3C Invited Expert · 20+ years
I fix the WordPress problems other developers walk away from. Backed by a 1st Class degree in Computer Science, an MSc in Cybersecurity, and over 20 years of specialist WordPress work, I diagnose issues at their root cause and resolve them permanently — for businesses that cannot afford guesswork or repeat failures.
More about Jason →If this article describes your situation, I can diagnose the specifics and fix it properly. Send your brief and I'll respond the same working day.