The Invisible Captcha Mechanism (ICM) against Form Spam
Par Ploum, jeudi 10 mai 2007 à 01:30 :: hacker vaillant, spam :: #150 :: rss
Today's web suffers of a terrible plague of spam. Each form is a way for spammers to send their content : blog comments, forums, wiki, ... I call this "Form Spam".
To fight this, most of webmasters out there use a "captcha" : a picture with text inside that people must copy. It's annoying, it's boring, it's hard to read (see some examples) and it's the worst thing ever for people with bad sight. Worst of all : some robots can now read them !
For almost a year now, I've been using a hand-made solution called "Invisible Captha Mechanism" that works perfectly : I have approximately one spam/month in my comments. (I had more than 200/day before ! I also solved completely the trackbacks spam problem) No captcha, no known false positive, no annoyance and easy to implement. For me, it was perfect but I was just to lazy to document it for you before today (and you know how much I like to fight spam).
How do they spam your website ?
I discovered that there are two types of form spambots. Let's call them Dumb and Dumber. Dumber will simply browse the web, looking for forms. If it finds one, it fill it with its crap then submit it.
The easiest way to get rid of Dumber is to implement an invisible field in your form. You can easily hide this field with the CSS (bots don't read the CSS). The invisible field has an initial value. If this value is changed, then we have a spammer and the content of the form is discarded.
I thought that it was enough. Unfortunatly, it was enough only for a few weeks. I discovered that changing the name of the regular fields and the name of the invisible one will save me a few more day. It's because all bots are not "Dumber". Some of them are actually just "Dumb".
By looking carefully at the logs I discovered that I was firstly spammed by a human ! Yes, a real human. He would browse the site and send a comment just like a regular reader. The "Dumb" bot will simply copy the same behaviour. As a consequence, unlike Dumber, Dumb will not trigger the invisible field.
ICM : how it works ?
You probably guessed it : ICM will reuse the principle of invisible field but, as a captcha, will regularly change its name. That's why I call it "Invisible Captcha".
Of course, in order to be effective, you also have to change the name of all fields in your form. That's not a big deal. The problem is "how will I recognise good names from bad names if I change them all the time" ?
To answer that, one would probably keep somewhere the current "good fields" and the current "bad fields". The other problem is that you cannot change too often : if an user load your page then post a comment after one hour, if the fields have changed, he would be considered as a spam !
ICM : a basic implementation
Because I'm very lazy, I did a very basic implementation of that idea in PHP. As it works perfectly for now, I didn't see the point to make a better one
First of all, we will generate the name of one good and one bad field. Those names will simply be the obfuscated date (Year, Month, Week). This will allow the name to change automatically every week !
$true_field='blabla'.'97'.date("YmW").'5';
$false_field='blabla'.'6'.date("Y").7.date("mW").'3';
As you can see, the names will change every week. It's also very easy to recognise : the true one always ends with "5", the false one with "3". It's dumb but it works. Then, the form looks like this :
<p class="invisible"><label for="<? echo($false_field); ?>">This field must keep his initial value: </label>
<input name="<? echo($false_field); ?>" id="<? echo($false_field); ?>" type="text" size="30" maxlength="255"
value="<?php dcCommentFormValue('ze_nom'); ?>" /></p>
<p class="field"><label for="<? echo($true_field); ?>">Name :</label>
<input name="<? echo($true_field); ?>" id="<? echo($true_field); ?>" type="text" size="30" maxlength="255"
value="<?php dcCommentFormValue('spam_nom'); ?>" />
</p>
<p class="invisible"><label for="site">This field must keep his initial value: </label>
<input name="site" id="site" value="http://" /></p>
<p class="field"><label for="spam_site">Website :</label>
<input name="spam_site" id="spam_site" type="text" size="30" maxlength="255"
value="<?php dcCommentFormValue('spam_site'); ?>" />
</p>
<p class="field"><label for="c_content">Commentaire :</label>
<textarea name="c_content" id="c_content" cols="35" rows="7"><?php
dcCommentFormValue('c_content');
?></textarea>
</p>
As you can see, the first field of all is my spam trap. I don't know if it's important to put it first but it seems to work. I also added another simple invisible field called "site". The trick here is that the normal field is called "spam_site" and the false one is called "site". Simple obfuscation, more funny than useful but I still keep it because I will not change something that works. Of course, the fields are invisible thanks to the CSS (you can make them invisible or, better, put them 2billion pixels above the page). The label is a reminder for the people who browse the site without CSS.
Then, I just have to discard all comments which contain something in an IC.
if (($_POST['site']=="http://") && ($_POST[$false_field]==""))
{
post the comment...
}
Last thing : as any normal field, IC are also saved in the cookies. I did this because I thought it might be a way to identify which fields were important.
ICM : ameliorations
Of course, for now my simple obfuscation works but it might not be enough if this method becomes widespread. The solution is obvious : don't simply obfuscate the date but generate real random strings that you keep somewhere. You can add multiple IC in your forms and change randomly the order of the fields.
Another problem of my implementation is if someone request the page Sunday at 11:59PM and post at 00:01. I'm not sure of what would happen in this case. The solution is pretty straightforward : keep the previous random string in memory and accept both the old and the new one for a short amount of time.
Conclusion
Voilà ! It's done. I have no idea whether or not this solution will work for you. As I repeat, it works incredibly well for me. And nobody never complained about a real comment that was rejected. I hope it will be the same for you so you can get rid of those awful captchas.
Digg this
- Send to friend -




Commentaires
1. Le jeudi 10 mai 2007 à 05:01, par lt
2. Le jeudi 10 mai 2007 à 08:40, par fonji :: site
3. Le jeudi 10 mai 2007 à 09:47, par splitsch :: site
4. Le jeudi 10 mai 2007 à 15:25, par Agal :: site
5. Le jeudi 10 mai 2007 à 17:35, par Milouse :: site
6. Le jeudi 10 mai 2007 à 21:42, par bulgroz
7. Le jeudi 10 mai 2007 à 21:49, par Oleastre
8. Le jeudi 10 mai 2007 à 21:49, par fsck222
9. Le vendredi 11 mai 2007 à 13:12, par k-ny :: site
10. Le dimanche 13 mai 2007 à 09:43, par Li-An
11. Le lundi 14 mai 2007 à 19:05, par António
12. Le mercredi 16 mai 2007 à 10:53, par Ombre :: site
13. Le vendredi 25 mai 2007 à 21:44, par Ralph :: site
14. Le dimanche 27 mai 2007 à 06:52, par jhr
15. Le mardi 29 mai 2007 à 17:22, par Oleastre
16. Le mercredi 30 mai 2007 à 12:11, par Ombre :: site
17. Le jeudi 31 mai 2007 à 09:54, par Vian
18. Le samedi 16 juin 2007 à 20:10, par Brurbu
19. Le mercredi 4 juillet 2007 à 10:05, par Sacha :: site
20. Le mardi 14 août 2007 à 12:12, par Nitin
21. Le dimanche 23 septembre 2007 à 13:21, par Sven Fuchs :: site
22. Le vendredi 12 octobre 2007 à 20:18, par Zepher
23. Le jeudi 5 juin 2008 à 16:32, par Thomas Landauer :: site
24. Le mercredi 16 juillet 2008 à 15:52, par is using french equal to captcha
25. Le dimanche 3 août 2008 à 08:03, par Johan :: site
26. Le jeudi 21 août 2008 à 22:01, par Martin
27. Le lundi 27 octobre 2008 à 21:44, par dumper :: site
28. Le vendredi 5 juin 2009 à 19:50, par Mike Griffiths :: site
29. Le vendredi 19 mars 2010 à 00:16, par Bob
30. Le mardi 6 juillet 2010 à 02:47, par ed hardy caps :: site
31. Le mardi 6 juillet 2010 à 02:47, par ed hardy caps :: site
32. Le mardi 6 juillet 2010 à 11:31, par Twins jerseys :: site
33. Le mardi 6 juillet 2010 à 11:44, par nike air max shoes :: site
34. Le mercredi 7 juillet 2010 à 04:02, par miami seo :: site
35. Le jeudi 8 juillet 2010 à 05:52, par share trading :: site
36. Le samedi 10 juillet 2010 à 11:02, par injury lawyer :: site
37. Le dimanche 11 juillet 2010 à 10:40, par wholesale gucci handbags :: site
38. Le lundi 12 juillet 2010 à 12:03, par Search Engine Optimization :: site
39. Le jeudi 15 juillet 2010 à 10:35, par Web Design Company :: site
40. Le jeudi 15 juillet 2010 à 10:36, par research papers :: site
41. Le vendredi 16 juillet 2010 à 14:01, par location automobile :: site
42. Le samedi 17 juillet 2010 à 05:17, par ipad converter :: site
43. Le lundi 19 juillet 2010 à 03:47, par simulation assurance auto :: site
44. Le mardi 20 juillet 2010 à 05:25, par Polaris Caretaker :: site
45. Le mardi 20 juillet 2010 à 18:46, par Pool Plastering :: site
46. Le jeudi 22 juillet 2010 à 03:23, par Ecomatic :: site
47. Le jeudi 22 juillet 2010 à 08:23, par vertu phones :: site
48. Le vendredi 23 juillet 2010 à 04:58, par online casino :: site
49. Le samedi 24 juillet 2010 à 10:21, par mortgage calculator with taxes :: site
50. Le lundi 26 juillet 2010 à 10:06, par personal loans :: site
51. Le lundi 26 juillet 2010 à 14:02, par flex chat :: site
52. Le mardi 27 juillet 2010 à 04:56, par coach outlet :: site
53. Le mardi 27 juillet 2010 à 05:41, par autolening :: site
54. Le mercredi 28 juillet 2010 à 12:27, par residential property management :: site
55. Le mercredi 28 juillet 2010 à 18:40, par Ecomatic Salt Cells :: site
56. Le vendredi 30 juillet 2010 à 10:02, par Pool Remodel :: site
57. Le vendredi 30 juillet 2010 à 11:17, par Vacuum Spares :: site
58. Le vendredi 30 juillet 2010 à 12:10, par SEO Packages :: site
59. Le vendredi 30 juillet 2010 à 19:08, par form builder :: site
60. Le dimanche 1 août 2010 à 05:24, par replica watches Rolex watches omega watches breitling watches :: site
61. Le dimanche 1 août 2010 à 09:29, par pool maintenance :: site
62. Le dimanche 1 août 2010 à 19:16, par seo company
63. Le dimanche 1 août 2010 à 19:17, par Seo company :: site
64. Le lundi 2 août 2010 à 03:12, par Coach Outlet :: site
65. Le lundi 2 août 2010 à 08:32, par Canada flower shops :: site
66. Le mardi 3 août 2010 à 04:25, par Opad :: site
67. Le mardi 3 août 2010 à 12:06, par Payday Loans :: site
68. Le mardi 3 août 2010 à 20:39, par Fat Burning Furnace :: site
69. Le mercredi 4 août 2010 à 13:21, par cheap eminem tickets :: site
70. Le mercredi 4 août 2010 à 14:25, par billy elliot saint louis :: site
71. Le jeudi 5 août 2010 à 09:46, par Machu Picchu trekking tours :: site
72. Le jeudi 5 août 2010 à 18:45, par Pastposting :: site
73. Le jeudi 5 août 2010 à 18:46, par los angeles seo company :: site
74. Le vendredi 6 août 2010 à 01:37, par video games :: site
75. Le vendredi 6 août 2010 à 10:11, par E-commerce development London :: site
76. Le vendredi 6 août 2010 à 10:33, par yeast infection :: site
77. Le vendredi 6 août 2010 à 15:09, par Dubai Property :: site
78. Le vendredi 6 août 2010 à 22:19, par travel agency :: site
79. Le vendredi 6 août 2010 à 22:19, par discount cruises :: site
80. Le vendredi 6 août 2010 à 22:20, par flight center :: site
81. Le samedi 7 août 2010 à 05:05, par gucci outlet :: site
82. Le dimanche 8 août 2010 à 17:01, par link building services :: site
83. Le dimanche 8 août 2010 à 20:15, par search engine marketing company :: site
84. Le dimanche 8 août 2010 à 20:16, par link building service :: site
85. Le lundi 9 août 2010 à 10:09, par Beach Wedding Dresses :: site
86. Le lundi 9 août 2010 à 13:27, par Форекс :: site
87. Le lundi 9 août 2010 à 13:53, par Phil Walbridge :: site
88. Le lundi 9 août 2010 à 21:09, par Ben 10 Games :: site
89. Le mardi 10 août 2010 à 16:36, par Poker Doctor :: site
90. Le mercredi 11 août 2010 à 08:41, par Проститутки :: site
91. Le mercredi 11 août 2010 à 10:12, par Ladies military boots :: site
92. Le mercredi 11 août 2010 à 10:28, par Motorcycle Clothing :: site
93. Le mercredi 11 août 2010 à 11:01, par quality control in china :: site
94. Le mercredi 11 août 2010 à 11:04, par handbags :: site
95. Le mercredi 11 août 2010 à 12:27, par wicked london :: site
96. Le mercredi 11 août 2010 à 13:18, par Medical Alert :: site
97. Le mercredi 11 août 2010 à 13:19, par Telephone Answering Service :: site
98. Le mercredi 11 août 2010 à 13:20, par Real Estate in Provo Utah :: site
99. Le mercredi 11 août 2010 à 13:21, par california sexual harassment lawyers :: site
100. Le mercredi 11 août 2010 à 13:21, par buenos aires apartment rentals :: site
101. Le mercredi 11 août 2010 à 13:26, par cheap eminem tickets :: site
102. Le mercredi 11 août 2010 à 13:28, par custom folders :: site
103. Le mercredi 11 août 2010 à 14:12, par Independence Day SMS :: site
104. Le mercredi 11 août 2010 à 18:15, par travel :: site
105. Le mercredi 11 août 2010 à 18:40, par букмекерские ставки :: site
106. Le mercredi 11 août 2010 à 21:52, par planning jobs :: site
107. Le jeudi 12 août 2010 à 03:52, par Arizona Pool Companies :: site
108. Le jeudi 12 août 2010 à 04:44, par Moroccan furniture :: site
109. Le jeudi 12 août 2010 à 09:03, par Networking Hardware :: site
110. Le jeudi 12 août 2010 à 13:27, par Aşık Etme Büyüsü :: site
111. Le jeudi 12 août 2010 à 19:11, par Point of sale software :: site
112. Le vendredi 13 août 2010 à 13:42, par Coach Bags :: site
113. Le vendredi 13 août 2010 à 17:35, par Jade :: site
114. Le samedi 14 août 2010 à 07:22, par Gucci handbags :: site
115. Le samedi 14 août 2010 à 12:47, par Luxury car rental Miami :: site
116. Le samedi 14 août 2010 à 15:02, par karate kid download :: site
117. Le samedi 14 août 2010 à 19:29, par 5 S :: site
118. Le dimanche 15 août 2010 à 16:37, par Kortingen :: site
119. Le dimanche 15 août 2010 à 17:37, par Youtube Videos :: site
120. Le dimanche 15 août 2010 à 19:26, par Bahamas Air Charter :: site
121. Le lundi 16 août 2010 à 05:03, par chinahandys :: site
122. Le lundi 16 août 2010 à 09:35, par sample essay :: site
123. Le lundi 16 août 2010 à 10:16, par Love eid poems :: site
124. Le mardi 17 août 2010 à 08:58, par ugg
125. Le mardi 17 août 2010 à 11:34, par cheap tom petty tickets :: site
126. Le mardi 17 août 2010 à 12:02, par custom presentation folders :: site
127. Le mardi 17 août 2010 à 17:44, par yeast infection :: site
128. Le mercredi 18 août 2010 à 04:30, par nike22 :: site
129. Le mercredi 18 août 2010 à 06:07, par Auto insurance quotes
130. Le mercredi 18 août 2010 à 07:01, par boomschors :: site
131. Le mercredi 18 août 2010 à 11:32, par payday loans Canada :: site
132. Le mercredi 18 août 2010 à 13:10, par Cheap Minnesota Twins Tickets :: site
133. Le mercredi 18 août 2010 à 15:27, par Bed :: site
134. Le mercredi 18 août 2010 à 18:11, par louis vuitton neverfull :: site
135. Le mercredi 18 août 2010 à 20:08, par pariuri sportive online :: site
136. Le jeudi 19 août 2010 à 03:45, par coach handbags :: site
137. Le jeudi 19 août 2010 à 15:06, par Wireless Security Cameras :: site
138. Le vendredi 20 août 2010 à 04:18, par ac adapter :: site
139. Le vendredi 20 août 2010 à 07:45, par spiritual healers :: site
140. Le samedi 21 août 2010 à 08:03, par assignment help :: site
141. Le samedi 21 août 2010 à 08:05, par assignment writing :: site
142. Le samedi 21 août 2010 à 12:09, par Credit for People with Bad Credit :: site
143. Le samedi 21 août 2010 à 13:38, par Liver Disease :: site
144. Le samedi 21 août 2010 à 15:16, par phentermine no prescription :: site
145. Le samedi 21 août 2010 à 17:51, par steroids :: site
146. Le samedi 21 août 2010 à 22:53, par Insurance :: site
147. Le dimanche 22 août 2010 à 05:28, par LV SPEEDY 25 :: site
148. Le dimanche 22 août 2010 à 05:30, par louis vuitton musette :: site
149. Le dimanche 22 août 2010 à 05:31, par Sac Bosphore :: site
150. Le dimanche 22 août 2010 à 12:44, par Ryan :: site
151. Le dimanche 22 août 2010 à 16:12, par sikiş :: site
152. Le dimanche 22 août 2010 à 16:14, par porno izle :: site
153. Le dimanche 22 août 2010 à 16:19, par pornolar :: site
154. Le dimanche 22 août 2010 à 19:18, par Payday Loans :: site
155. Le lundi 23 août 2010 à 03:33, par payday loans :: site
156. Le lundi 23 août 2010 à 06:40, par Samurai Swords :: site
157. Le lundi 23 août 2010 à 07:00, par seo newcastle :: site
158. Le lundi 23 août 2010 à 07:58, par Cotton Yarn :: site
159. Le lundi 23 août 2010 à 08:36, par omega watches :: site
160. Le lundi 23 août 2010 à 10:18, par coach handbags :: site
161. Le lundi 23 août 2010 à 11:43, par gucci handbag :: site
162. Le mardi 24 août 2010 à 01:40, par ps3 network card :: site
163. Le mercredi 25 août 2010 à 09:13, par cheap jordans :: site
164. Le mercredi 25 août 2010 à 09:13, par gucci outlet :: site
165. Le mercredi 25 août 2010 à 16:59, par Fashion Handbags
166. Le mercredi 25 août 2010 à 17:00, par [url=http://www.bagselling.com/][b]Fashion Handbags[/b][/url]
167. Le mercredi 25 août 2010 à 18:56, par Off road lights :: site
168. Le jeudi 26 août 2010 à 00:20, par Startpagina :: site
169. Le jeudi 26 août 2010 à 04:32, par Moscow hotels :: site
170. Le jeudi 26 août 2010 à 05:47, par poolen closures :: site
171. Le jeudi 26 août 2010 à 10:42, par qwe :: site
172. Le jeudi 26 août 2010 à 11:48, par Cheap Green Bay Packers Tickets :: site
173. Le jeudi 26 août 2010 à 14:30, par Mutterwitze :: site
174. Le jeudi 26 août 2010 à 16:31, par online forex trading brokers :: site
175. Le jeudi 26 août 2010 à 16:33, par Alejandro Alivares :: site
176. Le vendredi 27 août 2010 à 00:54, par expert seo services :: site
177. Le vendredi 27 août 2010 à 00:55, par cheap laptops deals :: site
178. Le vendredi 27 août 2010 à 13:17, par cheap wicked tickets :: site
179. Le vendredi 27 août 2010 à 14:48, par payday loans :: site
180. Le vendredi 27 août 2010 à 20:27, par pariloto meciuri :: site
181. Le vendredi 27 août 2010 à 23:17, par sports jerseys :: site
182. Le samedi 28 août 2010 à 03:03, par Astalavista Hacking :: site
183. Le samedi 28 août 2010 à 04:58, par Arizona Pool Companies :: site
184. Le samedi 28 août 2010 à 10:27, par Lists :: site
185. Le samedi 28 août 2010 à 12:42, par Las Vegas Domestic Violence Lawyer :: site
186. Le samedi 28 août 2010 à 14:44, par Bristol SEO Expert :: site
187. Le samedi 28 août 2010 à 16:55, par Suicide Shifter :: site
188. Le samedi 28 août 2010 à 17:45, par beds :: site
189. Le dimanche 29 août 2010 à 00:05, par no medical life insurance :: site
190. Le dimanche 29 août 2010 à 20:44, par natural cholesterol remedies :: site
191. Le lundi 30 août 2010 à 05:34, par free articles :: site
192. Le lundi 30 août 2010 à 12:20, par Buy Windows 7 :: site
193. Le lundi 30 août 2010 à 13:42, par JackWolf :: site
194. Le mardi 31 août 2010 à 05:35, par Writer Job :: site
195. Le mardi 31 août 2010 à 05:38, par poker tables :: site
196. Le mardi 31 août 2010 à 05:42, par halloween contacts :: site
197. Le mardi 31 août 2010 à 23:26, par sell jewelry Houston :: site
198. Le mercredi 1 septembre 2010 à 08:24, par GPS :: site
199. Le mercredi 1 septembre 2010 à 10:31, par air jordan shoes :: site
200. Le mercredi 1 septembre 2010 à 11:04, par suprashoes :: site
201. Le jeudi 2 septembre 2010 à 04:10, par Foulard :: site
202. Le jeudi 2 septembre 2010 à 09:00, par ugg boots london :: site
203. Le jeudi 2 septembre 2010 à 09:41, par Jerry :: site
204. Le jeudi 2 septembre 2010 à 10:49, par vertu :: site
205. Le jeudi 2 septembre 2010 à 17:04, par 5s :: site
Ajouter un commentaire
Poster un commentaire n'est pas une obligation. Rappelez-vous de tourner 7 fois votre clavier dans votre bouche avant de poster (oui, il m'a fallu des années de streching pour y arriver).
Si votre commentaire a été effacé, c'est sans doute pour une de ces raisons.