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

by Patrick Altoft on June 26, 2008

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.

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 Leeds based digital & SEO agency Branded3. Patrick also runs Blogstorm.

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

Read some similar posts

{ 81 comments… read them below or add one }

Richard Baxter 26 Jun 2008 at 10:35 am

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

Patrick Altoft 26 Jun 2008 at 10:40 am
Find me on Twitter

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

More comments from Patrick Altoft
Chris Angus 26 Jun 2008 at 11:22 am

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

Robbert 26 Jun 2008 at 12:15 pm

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.

rishil 26 Jun 2008 at 3:11 pm

Awesome tip. Wish I had thought of it first!

Nick Wilsdon 26 Jun 2008 at 4:10 pm

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

sunny beach 26 Jun 2008 at 4:19 pm

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

Navin Poeran 26 Jun 2008 at 4:44 pm

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

Matt 26 Jun 2008 at 4:51 pm

Great idea!

Tom 26 Jun 2008 at 5:25 pm

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” ;-)

Leslie 26 Jun 2008 at 10:12 pm

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.

Buy Business Note 27 Jun 2008 at 12:14 am

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!

Adam Pieniazek 27 Jun 2008 at 12:58 am

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!

Judd Exley 27 Jun 2008 at 3:34 am

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?

Creativecaravan 27 Jun 2008 at 1:38 pm

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.

JIm Jones 27 Jun 2008 at 2:05 pm

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

JT

tt 27 Jun 2008 at 7:53 pm

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.

Diane 27 Jun 2008 at 9:02 pm

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

Mark 27 Jun 2008 at 10:47 pm

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?

Patrick Altoft 28 Jun 2008 at 12:19 am
Find me on Twitter

Maybe not, you should submit a reinclusion request.

More comments from Patrick Altoft
Adam Pieniazek 28 Jun 2008 at 3:30 am

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…

Sumesh 28 Jun 2008 at 9:30 am

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 :)

Ruth 28 Jun 2008 at 4:29 pm

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

Gunnar Andreassen 29 Jun 2008 at 12:10 pm

This actually was a good tip. Thanks!

Rhea - Google Fan 30 Jun 2008 at 12:40 pm

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

Doug Davidson 01 Jul 2008 at 8:11 am

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

Nick Wilsdon 01 Jul 2008 at 9:26 am

@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.

tkada.com 02 Jul 2008 at 4:44 pm

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

Search Engine Optimization Journal 03 Jul 2008 at 9:07 pm

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!

Richard Brennan 03 Jul 2008 at 11:35 pm

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

Tibi Puiu 04 Jul 2008 at 12:23 am

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

Drabdesign 04 Jul 2008 at 2:56 pm

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.

RecycleCindy 04 Jul 2008 at 4:57 pm

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.

RecycleCindy 04 Jul 2008 at 5:15 pm

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

Dan H 05 Jul 2008 at 11:48 pm

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

Many thanks.

Christian 08 Jul 2008 at 3:40 pm

thx for the great stuff

Sir Nitti 09 Jul 2008 at 5:28 pm

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!

Patrick Altoft 09 Jul 2008 at 5:56 pm
Find me on Twitter

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

Please think before you make sarcastic comments.

More comments from Patrick Altoft
tony dee 19 Jul 2008 at 10:13 pm

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

J. Scott 22 Jul 2008 at 10:08 pm

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.

Jonk 24 Jul 2008 at 5:20 pm

Brilliant tip Patrick. So simple and elegant a solution.

Isabel 24 Jul 2008 at 8:01 pm

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!

Louis 27 Jul 2008 at 12:58 pm

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.

luboff 28 Jul 2008 at 1:38 pm

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?

VMOptions 02 Aug 2008 at 9:49 pm

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

Cfr-Cluj 03 Aug 2008 at 9:33 am

thank for sharing

David Airey 03 Aug 2008 at 12:52 pm

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

I hope you’re well.

Liam 15 Aug 2008 at 11:59 am

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.

naz.net 21 Aug 2008 at 1:47 am

thanks for me it great :P

Zath 13 Oct 2008 at 6:55 pm

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

Jonathan Woodruff 21 Nov 2008 at 8:32 pm

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

Thanks!

Acai Berry Reviews 23 Jan 2009 at 1:00 pm

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

DVD authoring 21 Feb 2009 at 8:30 pm

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

Tony 24 Feb 2009 at 4:00 pm

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

Would be good to use this with Google Alert.

Good article!

Shane 26 Feb 2009 at 11:52 pm

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

Daniel Pile 10 Mar 2009 at 3:18 pm

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

10 + for this

Chinese Translation 06 Apr 2009 at 2:33 pm

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

Zadelkruk 08 Apr 2009 at 7:42 pm

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

Adam Green 13 Apr 2009 at 5:52 pm

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.

Top Dog 22 Apr 2009 at 11:28 am

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

Jason 12 May 2009 at 3:42 pm

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.

Adam Green 13 May 2009 at 2:43 am

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.*.*

venkat 17 May 2009 at 12:20 pm

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

dd 30 Jun 2009 at 8:58 pm

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…

Scaltyfault 27 Sep 2009 at 11:17 am

Thank you for great post!

Bruce 01 Nov 2009 at 2:58 am

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.

Auth 06 Nov 2009 at 10:31 pm

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

RTW 06 Nov 2009 at 10:32 pm

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?

Patrick Altoft 07 Nov 2009 at 9:47 am
Find me on Twitter

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

More comments from Patrick Altoft
wordpressseo 25 Nov 2009 at 11:33 am

Thanks, very useful tip

Jim 02 Dec 2009 at 9:38 pm

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

aannemer 22 Dec 2009 at 10:47 pm

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

henry 30 Dec 2009 at 8:11 am

thanks for your article

henry 30 Dec 2009 at 8:12 am

good article for all sites owners.

Wii Accessories 25 Feb 2010 at 4:37 pm

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!

forlan 20 Mar 2010 at 3:40 am

I must need Google Alert. I will use it.

Deeho SEO 15 May 2010 at 7:56 pm

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

Presa di finica 23 May 2010 at 8:37 am

blogsearch function of Google is great as well for linkbuilding.

mark carter 16 Jun 2010 at 6:25 pm

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

Technology Jakk 05 Aug 2010 at 9:23 am

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.

Jonathan 17 Aug 2010 at 12:08 pm

Love it!

{ 35 trackbacks }

News About Tech from all around the world » SearchCap: The Day In Search, June 26, 2008
06.26.08 at 10:19 pm
PPC Blog » 123 Reg Hacked
06.26.08 at 11:35 pm
How-to automatically discover your site has been hacked using Google Alerts
06.27.08 at 1:39 am
Site Upgrade
06.27.08 at 1:40 pm
Weekly Round up » Self Made Minds
06.27.08 at 2:43 pm
links for 2008-06-27 « Sigidisig
06.28.08 at 12:31 am
Link-Fest for Friday June 27th 2008 | SEOpsCentre
06.28.08 at 1:37 am
antonolsen.com » Blog Archive » links for 2008-06-28
06.28.08 at 1:32 pm
How to use Google Alerts to watch for your site being hacked | The Wardman Wire
07.03.08 at 9:26 pm
Warning webmasters ! Possible new virus - Bloggeries Blog Forum
07.04.08 at 8:08 pm
Ways to Find Out if Your Site Has Been Hacked or Hijacked
07.30.08 at 1:20 pm
How to Migrate Blogger Powered Blogs to Wordpress | Shaun Low
07.30.08 at 2:45 pm
Blogs Are Growing Target for Malware and Phishing Attacks
08.14.08 at 7:20 pm
Let Google keep an eye on hackers (from Business Marketing Online)
08.22.08 at 10:31 am
How to Migrate Blogger Powered Blogs to Wordpress
09.01.08 at 12:53 pm
The DaveN Blog Hack Raises Important Questions For Google
09.19.08 at 2:16 pm
Keep an eye on your site with Google Alerts | EveryDayTutor
09.21.08 at 8:35 am
Why WP Needs a Compare Cache Against Post Plugin « SEO - Yack Yack SEO
09.28.08 at 3:26 pm
5 Questions You Can Answer with Google Webmaster Tools
11.10.08 at 12:55 pm
FUD about hacked WordPress blogs
11.11.08 at 8:42 pm
HearVox News » Google Alert for Hacked Site
11.19.08 at 7:30 am
7 SEO blogs and 21 useful articles | David Airey » graphic designer, logo designer
01.13.09 at 12:06 am
Test A Domain For Hidden Hacked Spam With JavaScript Bookmarklet | Online Sales
01.28.09 at 2:49 am
Comments Using Google Alerts For The Internet Marketer | Rob Malon [dot] Com
03.19.09 at 3:10 pm
12 Defensive Steps To Secure Your Sites & Income
04.08.09 at 11:46 pm
Ebiquity Google alert tripwires triggered
05.21.09 at 3:47 pm
Google alert setting to find if your site is hacked
07.13.09 at 2:55 am
Wordpress SEO: Wordpress Security Why it Matters to SEO
09.15.09 at 10:09 am
Christian Traffic Exchange » Comments Using Google Alerts For The Internet Marketer
09.30.09 at 9:17 pm
Wordpress SEO: Wordpress Security Why it Matters to SEO | Internet, Marketing, Enterprenuership
10.17.09 at 7:58 am
7 Things to Keep in Mind When Assessing the Security Risk of Using WordPress as a CMS | Free WordPress Website Help | Ask WP Girl | Boulder, Colorado
11.25.09 at 8:56 pm
SEO ROI » How In-House SEOs Can Add Value Beyond Search
01.18.10 at 2:50 pm
New Wordpress Hacking Strategy Using Cloaking to Target Google IP Addresses : Beginning Network
02.02.10 at 6:54 am
Google finally adds hacking notifications to Webmaster Tools
03.02.10 at 1:37 pm
Google Alerts « IT stuff 4 u
03.07.10 at 1:27 am

Leave a Comment (registration is optional)

Registration is free, takes about 5 seconds and is worth doing.

You can use these HTML tags and attributes:
<a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>