How to use Google Alerts to find out if your site gets hacked

by Patrick Altoft on / 124 responses

Every month thousands of websites get hacked into and have hidden links inserted into the pages by people wanting their spam sites to rank highly in the search engines.

Most SEO companies, including mine, see a good number of hacked websites, usually after the site owner contacts us wanting to find out why their Google traffic has suddenly dropped for no apparent reason.

Matt Cutts has stated that 2008 will be the year hacking and SEO collide:

2008 will be the year that hacking and search engine optimization (SEO) collide in a major way. By the end of the year, a nontrivial fraction of blackhat SEO will involve illegally hacking sites for links or landing pages.

One webhost will get a significant black eye as hundreds or thousands of customers’ websites are hacked. The growth of illegal-blackhat SEO will leave traditional blackhats with a difficult choice: risk doing something illegal or sit out.

Google doesn’t give you a warning when they see lots of links to black hat sites – they just stop sending traffic to the pages that contain them. If the hacker has only added the code to a few of your pages the traffic drop can be quite small and it becomes almost impossible to diagnose the problem.

Clearly what we need is some kind of easy to use method for site owners to get a notification as soon as these links are added. Because the hackers often hide the links from everybody apart from Google it’s clear that we need to leverage the Google spider to do the work for us.

Luckily Google Alerts allows us to create advanced search queries so we can set up an alert to monitor our websites for any terms that might appear when a hacker takes control. Of course we can’t monitor every term but it is a very good starting point. I must thank Vin from Digital Agencies for tipping me off about this trick.

To get started we need to think of a few likely spam terms that people might like to inject in our site and then use them to make up a search query:
viagra OR cialis OR levitra OR Phentermine OR Xanax site:blogstorm.co.uk

Next simply go to Google Alerts and enter the query above into the “Create a Google Alert” box and you will get an email whenever Google spots one of your chosen spam words on your site.

Patrick Altoft is Director of Search at Branded3, a Leeds SEO & Digital Agency specialising in SEO, Web Design, Development & Social Media.

Get daily posts direct to your inbox

You can get our blog posts delivered for free by email every day - simply add your email address to the box above, or alternatively you can grab the RSS feed.

Comments

Read the 88 comments below, or add your own!

June 26, 2008 at 10:35am

This is such a nice tip thanks Patrick – setting up straight away

Reply

June 26, 2008 at 10:40am

Unlike most SEO tips it is really easy to do. :-)

Reply

Sir Nitti
July 9, 2008 at 5:28pm

really,

It does not work as you can not mark a particulare site that you want to track those keywords on. All you can do is add those keywords to an alert. Now, Regardless if thousand and thousand of websites add the word like Viagra to their site, you will have hundreds and hundreds of alert to go through to see if one of them is your website. Ya great tip Patrick!

Reply

July 9, 2008 at 5:56pm

Sir Nitti what do you think the site: command does in the search query?

Please think before you make sarcastic comments.

Reply

June 26, 2008 at 11:22am

Fantastic post again Patrick, I’m going to add you too my blogroll.

Reply

June 26, 2008 at 12:15pm

Sometimes I find hacked posts and notify the owner of the blog. However, most of the times owners just don’t reply.

Maybe you should insert some casino related terms to ;)

(check source, ctrl+f “casino”) An example of a blogger that doesn’t reply to mail!. But hey, that’s his own mistake.

Reply

June 26, 2008 at 3:11pm

Awesome tip. Wish I had thought of it first!

Reply

June 26, 2008 at 4:10pm

Good tip Patrick. You’ve just pushed me to release the application we created to help with this problem too. It uses Google’s new Safe Browsing API and can send out alerts via email and RSS.

http://serpguard.com

Reply

June 26, 2008 at 4:19pm

Matt Cutts has stated that 2008 will be the year hacking and SEO collide.

Reply

June 26, 2008 at 4:44pm

Great tip Patrick, for sure I will blog about this article later :D

Reply

June 26, 2008 at 4:51pm

Great idea!

Reply

Tom
June 26, 2008 at 5:25pm

thanks a lot for the tip – my site was hacked just three days ago.

the hackers included some no index for the search engines and injected lots of spammy URLs.

since than I wondered how I can make sure to react faster in the future if this happens again – so, thx again for this useful tip!

I will give this article lot’s of “social love” ;-)

Reply

December 24, 2011 at 11:56am

Nice post and a useful tip. I think you also need to use a file compare tool fairly regularly. There are plenty of free ones out there. Also keep your eye on which query keywords are being used to hit your pages.

Reply

June 26, 2008 at 10:12pm

Great idea, I have been using alerts to keep informed about other things and places for link building – never thought of it for this.

Never been hacked yet – but way below most peoples radar so far.

Reply

June 27, 2008 at 12:14am

Thanks so much for this tip, I will put it to good use. I am about to revamp several of my websites and I will set up google alerts for each one as I go along. Two thumbs up!

Reply

June 27, 2008 at 12:58am

Great tip. Happened to me a while ago and only through sheer luck did I find the spammy terms before too much damage happened. Thanks!

Reply

June 27, 2008 at 3:34am

GAH! How did I not think of this on my own?!?! I LIVE by Google Alerts, and my site had been hacked for exactly this reason. I went through all necessary security thingies, but this is such a great solution that I could kiss you mate… ‘cept that we’re both blokes and all…

Maybe a hearty “thanks” would be more appropriate?

Reply

June 27, 2008 at 1:38pm

Thanks for the tip. I’ve been using Google Alerts more and more often recently. It’s a really handy tool and this tip just made it better.

Reply

June 27, 2008 at 2:05pm

Good Tips, one should always be aware of what is going on with their site and should check it quite often.

JT

Reply

tt
June 27, 2008 at 7:53pm

If you are going to trust Google Alerts to protect/inform you of when you site has been hacked, you’ve already lost the game.

When exactly will Google index that specific page that contains the bad data? At which point will Google Alerts service do its run and notice your search terms and report them to you?

Google Alerts is meant to be an “email me these search results on weekly basis”-kind of service. It does not guarantee it will ever send you any notification.

If you want to keep your site safe, keep your eye on it and take necessary precautions to secure if from bad things ever happening.

Reply

June 27, 2008 at 9:02pm

Thanks for the tip and the interesting feedback comments, some valid points to consider.

Reply

June 27, 2008 at 10:47pm

So glad I saw this today. I’ve noticed some people reaching my site over the last couple of days with a search for Viagra, and Google searches have disappeared. Read your post, found the code, deleted it and changed my login. They had tucked the code into my WordPress theme files!

Will Google automatically add me back?

Reply

June 28, 2008 at 12:19am

Maybe not, you should submit a reinclusion request.

Reply

June 28, 2008 at 3:30am

So I received a Google Alert today for the search terms you listed above but I can’t find any reference to any of the spam words on the post. Am I missing something or does Google Alerts work of cached version (I believe this post was one of the posts that got hacked previously)?

This is the post in question Any insight you might have would be immensely appreciated…

Reply

June 28, 2008 at 9:30am

Useful tip. I’ve been using Alerts to monitor rogue comments (via mail on my Nokia), but this one beats that too. The only problem happens when hackers read this tip and decide not to use any of the above tips :)

Reply

June 28, 2008 at 4:29pm

Thank you for the tip – i’ll use it asap.

Reply

June 29, 2008 at 12:10pm

This actually was a good tip. Thanks!

Reply

June 30, 2008 at 12:40pm

Hey! Thanks for this nice tip. I really want to be on guard against hackers in my sites.

Reply

Doug Davidson
July 1, 2008 at 8:11am

I totally disagree with the suggestion that Google Alerts would be helpful. There are better things to do than set up Google alerts for possible hacked search term / link insertions on a site — for terms like Viagra or Cialis. What other search terms might be inserted? And who’s to say a hacker would even use meaningful search terms to meet their end?

A better defense is intrusion detection by file compare. If a file on your site gets touched when it was suppose to be left alone, then look into. Run a file compare if needed.

Alternatives could also be to get a truly secure host provider… one that rely on real security pros; or better, run your own secure server with software that monitor host file system changes (i.e. IPS, Tripwire, OSSEC, etc.).

If you’ve got something valuable enough to justify the expense, get the right protection.

If those aren’t doable options, Google Alerts could be a viable cheap safety net against such attacks – albeit gaps big enough to drop an elephant through. Just don’t get lulled into a false sense of security just because you think you’ve got Google Alerts looking for potential black hat seo attacks.

Last, what’s also important is the real likelihood of a black hat seo search term / link insertion attack vs. real threats situations like rootkit compromised servers, shopping cart sql injection, cross site scriting / forgery, web session hijacks, etc.? Matt Cutts could be more helpful by giving real Google stats and findings on the real threat than dispensing unsubstantiated predictions.

And that’s all I have to say…

Doug

Reply

July 1, 2008 at 9:26am

@Doug

You make some good points. I’m sure the total number of cracked sites exceeds the number of sites exploited for this purpose. Google hasn’t released any figures but they are working in partnership with StopBadware.org, who reports 132,638 urls in their database.

Installing tripwire, upgrading your server environment would all be more effective anti-hacking methods than this tip – but it is still useful as an additional step.

The real issue here is how many of these malware infections have been a result of WordPress or other Open Source software. We have drastically reduced the diversity of web production software out there, so once an exploit is discovered it can be applied to many thousands of sites.

I’m not knocking OS but reducing this diversity greatly increases the need to make the most commonly used programs *very* secure. That is where the most effective pressure can be applied IMHO.

For example, I’m surprised that none of the third-party plugins that provide extra security have not already been integrated into the core WP code. Although it is good that they have forced users to adopt a more secure password.

Reply

July 2, 2008 at 4:44pm

The tip is much useful thanks for your valuable ideas!!!

Reply

July 3, 2008 at 9:07pm

We agree – we believe SEO and spam will fully collide this year as well as we keep seeing an increased number of good sites effected by this. This tip is an awesome one!

Reply

July 3, 2008 at 11:35pm

Great tip-have set it up. Will have a read of the rest of your site ASAP.

Reply

July 4, 2008 at 12:23am

This is awesome Patrick. I’ve just started using the service 2 days ago, after I got *cough again *cough hacked.
@Robbert: thanks for letting me know about the issue. problem is I never got your e-mail, another reader told me all about it. I just sent you an e-mail via your website’s contact form. Cheers

-Tibi

Reply

July 4, 2008 at 2:56pm

Interesting post! Just found your site and am very impressed with it.

I fear that Hacking is (as Matt Cutts says) going to be a major problem. I think perhaps a post on what should be done to Hackers if they get caught should be an interesting topic for future posts.

Reply

July 4, 2008 at 4:57pm

Good advice and I have added several word alerts. I understand this isn’t foolproof but every like thing helps. Thank you for post this.

Reply

July 4, 2008 at 5:15pm

Okay I’m confused now, Google Alerts Page says “Google Alerts are email updates of the latest relevant Google results (web, news, etc.) based on your choice of query or topic.”

But your postabove states “you will get an email whenever Google spots one of your chosen spam words on your site”. So now I’m getting an email on all post around the Internet on the words I entered so I can go and look at the posts. The post aren’t at my site though? Could you explain this further? Thanks

Reply

July 5, 2008 at 11:48pm

I was recently hacked, so this is a great tip.

Many thanks.

Reply

July 8, 2008 at 3:40pm

thx for the great stuff

Reply

July 19, 2008 at 10:13pm

Good gravy, this is an awesome tip. Whomever you are: “Patrick”? Tip jar is missing.

Reply

J. Scott
July 22, 2008 at 10:08pm

Excellent tip Patrick. I use Google Alerts for all sorts of things and this will surely become one of them. This not the most thorough way to defeat these types of attacks, however it is an easy, cost effective way of monitoring the potential clandestine on-goings of your site. Happy SEOing everyone.

Reply

July 24, 2008 at 5:20pm

Brilliant tip Patrick. So simple and elegant a solution.

Reply

July 24, 2008 at 8:01pm

This is how I found out that my blog had been hacked. Now I just need to figure out how to get Google to let me back in!

Reply

July 27, 2008 at 12:58pm

Very good tip. I never knew this. Thanks for your information.
Google Alerts can save you a lot of time, and also keep you up to date on what’s going on in your niche.

Reply

luboff
July 28, 2008 at 1:38pm

A very basic question on this as I am a newbie:

If I use WordPress to build my site, how does it get hacked if I have a unique ID and password for the admin page?

Reply

August 2, 2008 at 9:49pm

This is scary stuff. I hope all Webhosting providers improve their security and logging. This way any potential breaches can be thwarted and investigated.

Reply

August 3, 2008 at 9:33am

thank for sharing

Reply

August 3, 2008 at 12:52pm

Thanks very much, Patrick. Just initiated my own alert.

I hope you’re well.

Reply

August 15, 2008 at 11:59am

There certainly are some interesting ideas here which I will be adding to my toolset.

Google also provides notification to webmasters when it detects that a webpage is a danger to visitors due to malware. Make sure you have Google Webmaster Tools set up for your site to ensure you will get this notification.

Reply

August 21, 2008 at 1:47am

thanks for me it great :P

Reply

October 13, 2008 at 6:55pm

A very good tip, hopefully it won’t happen, but it’s a great way of getting a notification should it occur! Cheers Patrick!

Reply

November 21, 2008 at 8:32pm

Wow, great tip! I may incorporate that for my site!

Thanks!

Reply

January 23, 2009 at 1:00pm

Great tips, I’ve been in the industry for 5 years and still learn something new everyday

Reply

February 21, 2009 at 8:30pm

This is a very interesting and informative blog post, thanks for the info.

Reply

Tony
February 24, 2009 at 4:00pm

Is there a list of the latest spam words/phrases doing the rounds?

Would be good to use this with Google Alert.

Good article!

Reply

February 26, 2009 at 11:52pm

Wish I had taken this advice sooner, Patrick. They’re getting very devious with their attacks now: http://www.askshane.org/daily-tips/devious-wordpress-hack-using-wp_remote_fopen.php

Reply

March 10, 2009 at 3:18pm

This is real useful information and ” A Must Use Thing”

10 + for this

Reply

April 6, 2009 at 2:33pm

But how to use it, I am not clear of.

Reply

April 8, 2009 at 7:42pm

Google is developing more than I can follow. Thanks for the things who are most important.

Reply

April 13, 2009 at 5:52pm

You are right to warn people about this, but it looks like some of your readers could learn more about how to use Google Alerts correctly. Here is a free Google Alerts tutorial:
http://www.alertrank.com/google-alerts-tutorial.html

I hope this helps.

Reply

April 22, 2009 at 11:28am

Very good editorial pieces on this site. Is anyone out there really up on their affiliation marketing? I would like to ask some questions.

Reply

May 12, 2009 at 3:42pm

Thanks for the post Patrick as have been seeing a massive increase in spam replies on my blog, off to set up an alert now.

Reply

May 13, 2009 at 2:43am

Another type of hack that webmasters should watch for is a phishing scam using URLs meant to resemble your site. I’ve written up a complete procedure for this on my blog:
http://www.alertrank.com/mrgooglealerts/2009/05/12/protect-against-phishing-scam/

The basic idea is to set up Google Alerts for two patterns:
site:yourbrand.*
site:yourbrand.*.*

Reply

May 17, 2009 at 12:20pm

I am using google alerts to knwo about my blog posts mentioning somewhere are .

Reply

dd
June 30, 2009 at 8:58pm

That’s very hackish method and will only catch this kind of spam. If you want comprehensive monitoring, I suggest using a real app for that…

For example sucuri.net offers free real time monitoring of any web site (and domain) against defacement, hacking, blacklisting, etc…

Reply

September 27, 2009 at 11:17am

Thank you for great post!

Reply

November 1, 2009 at 2:58am

This is a great tip and so easy to follow. I know if I can do it anyone can. Thanks for making it so simple.

Reply

November 6, 2009 at 10:31pm

This is flat out genius! I had never thought of using the alerts this way.

Reply

RTW
November 6, 2009 at 10:32pm

I may be coding challenged but I never really understood how someone could inject links etc onto another site through hacking. Don’t hosts provide better security than that?

Reply

November 7, 2009 at 9:47am

RTW there are plenty of ways to inject links into other sites. Search for XSS for example.

Reply

November 25, 2009 at 11:33am

Thanks, very useful tip

Reply

Jim
December 2, 2009 at 9:38pm

An excellent explanation. Thanks!
I’m linking to this from my site as well (nice Google karma).
Best Wishes,
Jim
http://hackrepair.com

Reply

December 22, 2009 at 10:47pm

google alerts is a great wat for linkbuilding as well..

Reply

henry
December 30, 2009 at 8:11am

thanks for your article

Reply

December 30, 2009 at 8:12am

good article for all sites owners.

Reply

February 25, 2010 at 4:37pm

I found this when trying to protect my sites from further attack as I have just had my first experience of a virus taking down all my sites for over a week :-( . Thanks for sharing as its a great way to prevent, not cure!

Reply

March 20, 2010 at 3:40am

I must need Google Alert. I will use it.

Reply

May 15, 2010 at 7:56pm

Google alerts offer many useful features, but this is by far and away one of the more practical as a real world solution. Hackers are a problem that are not going to go away, as their desire to destroy is almost a strong as our desire to create and build. Be vigilant people and we will beat them

Reply

May 23, 2010 at 8:37am

blogsearch function of Google is great as well for linkbuilding.

Reply

June 16, 2010 at 6:25pm

This is a great tip – many thanks for passing this on ….

Reply

August 5, 2010 at 9:23am

I find Google alerts to be adequate for what it is, however have found your post highly insightful. @ RTW They do provide a lot of security, especially ones who put a Codex on.

Reply

August 17, 2010 at 12:08pm

Love it!

Reply

October 7, 2010 at 5:04am

But what if the hacker is using millions of other spammy keywords.

The better option is to always alert and have all the security updates in place and change the passwords frequently.

Reply

December 7, 2010 at 2:25am

Those links usually happen when people download pirated themes or scripts . Same things is valid for open source programs and tools which can contain hidden link-backs or back-doors if not downloaded from their official web sites. Thank you for the tip.

Reply

Jay
April 13, 2011 at 1:56pm

Good tips. Sadly this also happens when downloading templates for wordpress. The programmers often hide links back to their sites in div’s that are 900px to the left or right of the screen, so although the link is not seen by the user, it is seen by Google, and without taking the time to look at the source code of each webpage to see if this is happening, it was virtually impossible to quickly find these…until now :)

Reply

May 27, 2011 at 4:13am

Well, finally I have found the solution. At least some keywords don’t show up Cialis no more.
You should go to webftp and find the files that contain Drugstore and eval (gzinflate(base64_decode(.
Delete the files if the files are not wordpress file and remove the virus line in wordpress file such as wp-config.php.

You could read the detail here:
http://agusnizami.wordpress.com/2011/05/27/cialis-found-on-wordpress-google-search-and-the-solution-to-remove-the-virus/

Reply

July 9, 2011 at 3:25pm

Now, THAT is an interesting tip! Obviously the best is to make sure that your security is flawless, but as a last line of defense this is really excellent.

Reply

October 17, 2011 at 6:07pm

Better late than never – appreciate the tip Patrick. Just setup the Google alert now. Just one question – After entering the search query do you enter site:(site) or insite:(site) ?

Reply

36 trackbacks

Leave a comment

Your email address will not be published. Fields marked with an asterisk are required.
 

  *

  *

You can use one of the following tags:
<a href=""><blockquote><code><em><strike><strong>