My friend Michael Michelini asked me why visitors to his blog sometimes get sent to a Russian .ru site when they try to visit his blog. He asked his IT friend about the problem and was told he couldn’t replicate it.
Never send an IT guy to do the job of a liberal arts guy. Let me try my hand:
The symptoms were as follows:
- When his blog URL was entered directly in a new browser session, it would load normally
- When clicking on Google search results for his blog, it would get redirected to the suspicious insidetool.ru address
- After clicking on the Google search result for his blog, entering his blog address manually still resulted in a redirect to the .ru address
I suspected that something had infected his Wordpress installation that only redirected Google search results. This would make sense, because it would minimize the chance that the owner of the blog would immediately notice the infection. How many blog owners visit their own blog by searching on Google? Smart.
To remove variables like possibly infected browsers, caches, sessions, etc. I tested this theory by opening a Terminal session and using telnet to connect directly to his web server.
First I simulate a google search “click.” I do this by sending a HTTP GET command via telnet and including a header field Referer set to a Google search results URL:
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Yep. His blog is redirecting us to the .ru link.
Next I simulate the address being directly entered into the web browser. Again, I do this by sending a HTTP GET request for his blog directly to the web server via telnet. Notice how this time, I do not include a Referer header. This indicates to the web server, that the visitor entered the address directly into their web browser instead of clicking on a link.
1 2 3 4 5 6
1 2 3 4 5 6 7 8
Bingo! His site loads up normally.
Now we can be 100% sure that the problem is in his webserver and its Wordpress installation and not because of infected Google results, poisoned web browsers, and the like. Knowing how to replicate a problem is the first step to solving it.
How and why his blog got infected? How to fix it? I’ll leave that to you to figure out.