Signs to look for
- Google shows gambling titles for your pages: words like “slot gacor”, “togel”, “situs toto” or casino brand names next to your domain.
- A service page shows a completely different site, while the WordPress editor still shows your normal content.
- Posts you didn’t write, published under a real administrator’s name.
- An administrator you don’t know, often with an odd email address such as one ending in
@local.invalid. - Search Console sends you a “new owner” email, or shows a sitemap you never submitted.
- The whole domain sends visitors to a gambling site, even though your hosting and WordPress look untouched.
How the attack worked
These are the steps we found on one site, in the order the attackers set them up over three days. The last step, the domain takeover, happened on a different site in the same week.
1. Getting in and staying in
The site ran an outdated form plugin with a known flaw, and the logs showed logins to the owner’s administrator account from two other countries. The attackers then created a second administrator called content_operator with the email address …@local.invalid. That address can never receive mail, so the owner was never told about it.
2. A fake plugin that posts spam in the owner’s name
They installed a plugin with a random name made of three words and a code, such as trotrax-text-prime-…. It adds a hidden, signed connection that lets the attackers publish posts from their own server. It published about a hundred gambling posts, each credited to the site owner’s real account, so at a glance they looked like the owner’s own work.
3. Folders that replace real pages
This was the clever part. For twelve of the site’s real pages, the attackers created a folder in the site root with the same name as the page, and put a ready-made gambling page inside called index.html. When someone asks for /services/, the web server finds the folder and serves that file. WordPress never even runs. The page keeps its trusted address and its Google ranking, but now shows slot and casino content.
4. Taking over Google Search Console
To get Google to pick up the swapped pages fast, the attackers uploaded their own google….html verification file, which made them a verified owner of the site in Search Console. They also uploaded a static sitemap.xml listing only the gambling pages, and submitted it. WordPress makes its own sitemap at /wp-sitemap.xml and SEO plugins create theirs on the fly, so a plain sitemap.xml file you didn’t upload is a warning sign.
5. Hidden casino links
Links to casino sites were added to the home page, hidden from visitors with styling but still read by Google. They pass your site’s reputation to the gambling sites.
6. A way back in that leaves almost no trace
A small file called wp-obf.php in the site root downloaded code from a free web page each time it ran and executed it. Nothing harmful is stored on your server, so a simple file search finds nothing, and the attackers can change what it does at any time. Another file, core-compat-70.php, was built to wipe the files of other plugins it sees as a threat, including security plugins.
7. The domain itself
On a second site that week, nothing on the server was touched. Instead, the domain’s nameservers were changed at the registrar to the attackers’ own Cloudflare account. From then on, they controlled where the domain pointed, and every visitor was sent to a gambling site. No WordPress scan can see this: the fix is at the registrar.
Check your site in 15 minutes
- Search Google for
site:yourdomain.com slot,site:yourdomain.com casinoandsite:yourdomain.com togel. - Open your main pages in a private browser window, including service and location pages.
- Look at your site root in your host’s file manager or by FTP. A normal WordPress root has
wp-admin,wp-content,wp-includesand a few files. Any other folder holding anindex.html, especially one named like one of your pages, needs a closer look. With SSH:find . -mindepth 2 -maxdepth 2 -name "index.htm*" -not -path "./wp-*" - Look for root files named
google….htmlandsitemap.xml, and PHP files you don’t recognise. Note their dates. - Users: in wp-admin, go to Users, filter by Administrator and check every account and email address. Our guide to unknown admin users covers hidden ones.
- Posts: sort by date and look for posts you didn’t write.
- Plugins: look for names you don’t recognise, especially random word combinations.
- Search Console: check Settings → Users and permissions and Indexing → Sitemaps.
- Nameservers: look up your domain with any WHOIS or DNS lookup tool and check that the nameservers are the ones your host or you set up.
The free Moatline Malware Scanner 1.2.3 and newer finds most of these signs for you: folders that replace your pages, gambling pages in the site root, Search Console verification files, the fake posting plugin, administrators with @local.invalid addresses and files that download and run code from the internet. Nameserver changes and Search Console owners can only be checked by hand.
Clean it up, in this order
- Back up the files and database as they are, so nothing is lost if you need to look back.
- Lock the attackers out. Delete administrators you don’t know (assign their posts to yourself if WordPress asks, then delete the spam). Change every administrator password, log out all sessions, and change the security keys in
wp-config.php. Check application passwords on each profile and delete any you didn’t create. - Delete the fake plugin and any other plugin you don’t recognise.
- Delete the planted folders. Your real pages come back as soon as each folder is gone. Check that each page shows your normal content again.
- Delete the loader and other planted files, such as
wp-obf.php, and look inwp-content/mu-pluginsandwp-content/uploadsfor PHP files that don’t belong. - Remove the attacker from Search Console, then delete their
google….htmlfile and the fakesitemap.xml. Remove the owner first: if the file is still there, they can verify again. - Delete the spam posts and remove the hidden links from the home page, theme and widgets.
- Update WordPress, every plugin and the theme, especially form plugins. Turn on two-factor login for administrators.
- Run a full scan again and check the site daily for a week. Our malware removal guide has the full checklist.
If the whole domain redirects
If every page on your domain goes to a gambling site, check the nameservers first. If they have changed:
- Log in to your domain registrar (where you pay for the domain) and set the nameservers back to your host’s or your own Cloudflare account.
- Change the registrar password, turn on two-factor login and switch on registrar lock or transfer lock.
- Check the contact email on the domain is yours, and look for forwarding rules you didn’t set up.
- Changes can take a few hours to reach everyone. Then check the site from a phone on mobile data.
Get Google to drop the spam
- In Search Console, use URL inspection on each page that was replaced and click Request indexing.
- Use Indexing → Removals for spam post addresses that now return 404.
- If Google listed Security issues, request a review describing what you removed and how the attackers got in.
- Keep your real sitemap submitted and remove any sitemap you didn’t add.
Related: Japanese or pharma spam in Google and “This site may be hacked” in Google.
Don’t want to do this yourself? Our team cleans hacked WordPress sites every week: WordPress malware removal service, from $45, usually done within 24 hours.
Frequently asked questions
Why does my page show gambling content when it looks fine in the WordPress editor?
index.html file, is served by the web server first. The editor shows your real page; visitors and Google get the planted file. Delete the folder and your page comes back straight away.Will changing my password fix it?
Is a google….html file in my site root always a bad sign?
How did they get in?
How long until Google stops showing the gambling pages?
Scan your site for free
Moatline checks files, the database and page-builder content. Nothing changes unless you click a button.
More guides
- “This site may be hacked” in Google: how to get the warning removed
- WordPress site redirecting to spam? How to find and fix it
- Host suspended your WordPress site for malware? What to do next
- Unknown admin user in WordPress? How to check it, remove it and lock the door
- Japanese or pharma spam in Google results? How to fix the WordPress hack
- A website asked you to press Windows + R to “verify you are human”? Here’s what to do