Part of Datorkirurgen AB – IT experts across Sweden

A hacked WordPress site often looks normal to the owner, while it serves spam to Google and hides code that lets the attacker return. This article follows a real case where Business IT Support found and removed every trace.

The first warning is often an email from Google

In this case, the owner received an email from Google Search Console about a new owner of the property. Nobody at the company had added that owner. In other words, the attacker had verified the site in their own Search Console account, which gave them control over how Google saw it.

That warning is serious. Therefore, we removed the unknown owner at once, deleted the verification file and started a full investigation of the server and the database.

Google Search Console warning about a new owner on a hacked WordPress site
Warning in Google Search Console about a new owner. An unknown owner is a clear sign that someone controls the site.

Hidden files in mu-plugins and disguised scripts

First of all, we searched for recently changed files. In the folder mu-plugins, which WordPress loads automatically on every request, we found a file with a harmless name. However, the code inside was obfuscated and loaded further instructions.

In general, attackers like mu-plugins because these plugins do not appear in the normal plugin list and cannot be deactivated from the dashboard. Consequently, we always check that folder when we investigate a hacked WordPress site.

Suspicious file among WordPress mu-plugins on a hacked WordPress site
A suspicious file in the mu-plugins folder. Code here runs on every request without appearing in the plugin list.

The fake cache plugin fetched external content

Next, we found a plugin that pretended to be a cache tool. In reality, it fetched content from an external server and showed it only to search engine bots. As a result, Google saw spam pages, while ordinary visitors saw the normal site.

We also found a file called ad.php in the root folder that acted as a backdoor. Through it, the attacker could upload new files at any time. For that reason, removing only the visible spam would have been useless.

Fake WordPress plugin with malicious code
Malicious plugin code that fetches external content. The plugin pretended to be a cache tool.
Malicious file ad.php in the web root acting as a backdoor
A malicious PHP file in the root folder. The file worked as a backdoor for new uploads.

SEO spam: a static page with foreign content

Finally, the attacker had placed static spam pages in a foreign language in the root folder. Google had indexed many of them, so search results for the company showed unrelated products. Consequently, both the brand and the rankings suffered.

Then we removed the pages, made sure they returned 410 Gone and asked Google to recrawl the site. Moreover, we checked the database for spam posts and changed metadata.

Spam page from SEO spam in the root folder of a hacked WordPress site
A spam page in the root folder. Pages like this damage both the brand and the rankings.

How we clean a hacked WordPress site and harden it

After the removal, we also replaced WordPress core files with fresh copies, updated all plugins and themes, changed every password and replaced the security keys. In addition, we blocked PHP execution in the uploads folder and set up monitoring of file changes.

Within a few weeks, Google removed the spam pages from the index, and the site regained its normal search results. As a result, the company could focus on its business again instead of on the attack.

Contact Datorkirurgen AB about a hacked WordPress site

Business IT Support is part of Datorkirurgen AB, which has more than 30 years of experience in IT for businesses. We clean hacked WordPress sites, remove backdoors and SEO spam and harden the site for companies remotely anywhere, and on site in Stockholm and across Sweden.

In addition, our prices start at €250 per hour excluding VAT, or as agreed, and we guarantee to solve the problem. Google explains how to recover in its guide for hacked sites. Contact us at once if you suspect an intrusion.

Frequently asked questions about hacked WordPress sites

Signs of a hacked WordPress site

Investigation and clean-up

Prevention and support

Website developed by Datorkirurgen AB · Privacy policy