APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
->
-> Detecting Comment Spam, Part 3


Detecting Comment Spam, Part 3



This is a continuation of Detecting Comment Spam, Part 2

In the previous posts in this series, I've said that spammers habits allow us to detect their attempts to leave inappropriate comments. I use these techniques here and am able to send most spam comments directly to the bit-bucket without ever having to examine them myself. When I suspect spam but am not sure, I just send the comment to moderation. In practice, very few spam attempts get by the automatic filters.

The code I use is a hodgepodge I developed over many years of fighting spam comments. I need to rewrite it and my thought is to move toward a scoring system similar to that used by Spamassassin for mail spam: each "bad habit" increases an overall spam score and the final judgement is made based on the total score accumulated. To that end, I have been pulling out the various tests I use now and examining them. Some always cause the comment to be treated as spam; those would add enough points to ensure that would still happen. Other habits now cause moderation, but in my new design each of those will increase the spam score. Any spam score at all is cause for moderation, but if the post accumulates enough minor points, I can skip that and just throw it away.

By the way, there is an effort to create a BlogBlogSpamAssassin.

Seven (or more) habits of ineffective spammers

I'll be reviewing things covered in the previous two posts and will introduce some new ideas. Items covered in the previous posts are marked with a "*".

* Known spam links: Reusing links we already know are spam. This would carry enough points to always be spam.

* High link to text ratio: Sometimes nothing but links. This could be legitimate, but it's a strong indicator. In my current code, this always treats the comment as spam, but I think I will change it so that at least one other spam point is required.

* Nonsense words: The higher the ratio of nonsense to total word count, the more likely this is spam.

* Many quick posts: Legitimate commenters may post more than once per day, but there will be some time delay between comments as they read the articles they are commenting on. I simply enforce a "posting too frequently" policy.

* Direct posts: Some spammers bypass your forms and send direct POST requests. That's definite spam.

* Typed too fast: Legitimate commenters MAY use cut and paste, but moving from form load to POST too quickly needs to carry some weight.

Multiple posts to same article: Legitimate commenters almost never post more than one comment without some other comment intervening. Sure, someone may have an afterthought and add a second comment, but more usually this indicates a spammer, so we should add points.

Same comment at another article: As always, spammers are lazy. They sometimes post exactly the same text to different articles. The posts may not come from the same IP address, but the content is the same. This should probably carry enough points for flat rejection. It does mean that you need to maintain a database, but you only need to store 100 characters or so (spam comments are usually short) and you can clean it out after 24 or 48 hours.

Text and link have same word: This is a minor spam indicator, but if the word "Horrivea" appears as "Buy Horrivea: http://someaddress/horivea", it may be spam.

Failure to reload: I require clicking on a link to reload the original page after submitting a comment. A legitimate poster will almost always click, a spammer almost never will. Again, this is not an absolute indicator, but is worth a point or two.

External tests

Akismet is a popular comment checker. I have found it to be less effective than my own tests, but it can't hurt to have another opinion, can it?

Captcha tests: See Creating a blog... with anti-spam measures for an example of incorporating Captcha. As this technology is annoying, you might consider adding it as a confirmation only when some other conditions have raised suspicion. Similar tests involve solving simple math or providing answers to obvious questions. Spammers are in a hurry; they are usually using bots and if not they just don't want to spend time thinking, however small that time is.

Legitimate Commenters Habits

There are a few things that spammers don't usually do. Legitimate comments almost always use punctuation, so the presence of punctuation could decrease a spam count. Legitimate posters sometimes quote text from the article or from a previous comment; spammers almost never do that, so again we might decrease a spam score if we see this.

Conclusion

We can control spam comments. Not all of it, but we can limit the amount that has to be checked manually and we don't need to annoy our visitors with required registration or automatic "human reader" testing.

I'd love to hear your thoughts, comments and ideas.




If this page was useful to you, please help others find it:  





3 comments




More Articles by - Find me on Google+



Click here to add your comments
- no registration needed!




Thu Dec 31 00:24:49 2009: 7838   DaleReagan
http://webtech.gausa.com/
gravatar


Greetings,

As usual some good info. :)

I would suggest adding web log checks for:

a) referral links (where is the BSpammer coming from) and/or
b) search links (how is the BSpammer finding you)

I am seeing patterns which leads me to create new rules Using Apache + Mod_Security (a WAF - web application firewall.) I also do some auto-scanning of web server logs to auto-create IP bans for bots... I then aggregate abuses and ban entire subnets based on my very low threshold for any type of SPAM. I am sure that Bot-abuse will vary depending upon the size of a given web site (as well as geo-location) and IP-banning may not be a good solution for all but it works well for me since I do not typically have business concerns for the locations from which Bot/Spammers seem to be operating from (i.e. currently mostly from Europe and Asia.)

This AM I had 43 'comment posts' (Blog SPAM, of course) that managed to get by the CAPTCHA tool - the IPs are now banned. My guess is that bots reported the CAPTCHA and a human returned to create the SPAM.

There are also additional benefits from using Mod_Security - worth exploring for anyone interested in keeping a web site online and relatively secure.

Of course, your mileage should vary. :)

Dale



Thu Dec 31 01:49:13 2009: 7839   TonyLawrence

gravatar


I hadn't thought of looking back for referral/search - thanks!

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar

Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

pavatar.jpg

This post tagged:

       - Blogging
       - Perl
       - Web/HTML














My Hard Truths about Easy Money on the Internet will show you how to make money on the Internet!

book graphic Internet Income guide


Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals



Click and enter your name and phone number to call me about Kerio® products right now (Flash required)