Website redirecting to a casino? How I removed the infection
A case study of a real job: a casino redirect infection, the cloaking mechanism aimed at Googlebot and a step-by-step malware removal
The phone rings late in the evening. The client is upset: he types his company name into Google and in the results his website shows up as a Turkish casino. Nothing suspicious is visible on the site itself. Sounds familiar? This is a classic casino redirect infection — and this is how removing it went, step by step.
Why the casino shows in Google but not on the website
The secret of this infection is cloaking, that is, disguising content for a specific recipient. The malicious code checked who was visiting the site. To an ordinary user it showed a normal website — but when it detected the Google robot, it served it a substituted casino page. The goal: to make the search engine index the company as a casino. That is why the problem can go on for weeks before anyone notices it — the owner sees his own website, while the damage happens "behind his back", in the search results.
What exactly I found
After analysing the site's files, the picture was clear. The casino redirect rule had been appended in two places in the configuration (in the index.php and .htaccess files), and the server was hosting several webshells — files that give an intruder remote control over the server. They were cleverly hidden: some posed as ordinary images and system files so as not to stand out during a cursory look.
How they got in
The most important question in any break-in is not "what to remove" but "how did they get in". Here the trail led to an outdated, unupdated WordPress blog with a vulnerable plugin. That was the gateway: through it the attacker got onto the server and then infected the rest. Removing only the files without closing that gateway is like bailing water out of a flooded flat with the tap still running.
How I cleaned it up
Instead of deleting files "by eye", I prepared a tool that does it safely: it removes exactly the identified files (after verifying the checksum, so that nothing is touched by accident), and it precedes every change with a backup. On top of that came cutting the appended fragments out of the configuration files and a plan to close the case: changing all passwords, updating software, hardening the code and submitting the site for re-indexing in Google.
Frequently asked questions
Why does my website show up as a casino even though nothing is visible on it?
Because the infection uses cloaking — it shows the casino only to the Google robot and a normal website to ordinary users. The damage happens in the search results, not on the website itself.
How can I check whether my website is infected?
Type site:twojadomena.pl into Google and check whether there are any foreign subpages. Look in Google Search Console for warnings. Also check the index.php and .htaccess files and the uploads directory for files that should not be there.
Is it enough to delete the suspicious files?
No. That removes the symptom, but it does not close the way in. You need to update the software, change all passwords and ask Google to re-index the site — otherwise the infection will come back.
Get notified about new articles
Subscribe by e-mail or turn on browser notifications — we only send new blog posts, nothing else.

Comments
No comment at this time!
Leave your comment