{"id":906,"date":"2009-04-17T19:10:54","date_gmt":"2009-04-17T17:10:54","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=906"},"modified":"2009-09-21T16:54:50","modified_gmt":"2009-09-21T14:54:50","slug":"an-easy-tweak-with-phpbb-forums-to-avoid-automated-registration-of-spambot-users","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/906","title":{"rendered":"An easy tweak with PHPBB forums to avoid automated registration of spambot users"},"content":{"rendered":"<p>Spammers\u00a0 finally reached <a href=\"http:\/\/www.phpbb.com\/downloads\/olympus.php\">PHPBB version 3 &#8220;Olympus&#8221;<\/a> default <a href=\"http:\/\/en.wikipedia.org\/wiki\/Captcha\">CAPTCHA<\/a> automated <a href=\"http:\/\/en.wikipedia.org\/wiki\/Optical_character_recognition\">OCR<\/a> task in their development schedule and recently started registering bot users passing the provided CAPTCHA confirmation code.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-907\" title=\"PHPBB3 CAPTCHA Sample\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/04\/17-captcha.jpg\" alt=\"PHPBB3 CAPTCHA Sample\" width=\"320\" height=\"50\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/04\/17-captcha.jpg 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/04\/17-captcha-300x46.jpg 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/p>\n<p>Luckily to them, PHPBB3 default CAPTCHA code is ridiculously easy to OCR, os basically this was rather expected. It does not however mean that there is no way to effectively stop automated registrations without spending too much time on forum engine update.<\/p>\n<p>Automated registration spider sends HTTP POST with the code it OCR&#8217;red from the image and we can leave the same code querstion in place and just ask the interactive user to type some extra information into input field. For example, it is possible to instruct him\/her to type an extra asterisk before the code, so that the following is expected to be typed in: *25K9RGS. This makes the only thing important: to put a proper not for the user so that he\/she is aware that he needs this character to be also entered. PHP code update is relatively simple:<\/p>\n<p><strong>includes\\ucp\\ucp_register.php<\/strong>, near line 235:<\/p>\n<pre><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #a65700;\">&lt;?php<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #696969;\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #696969;\">\/\/ NOTE: Checking extra asterisk in front of CAPCTCHA code to prevent from automated CAPTCHA readers<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$confirm_code<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$data<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">[<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #0000e6;\">'confirm_code'<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">]<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #800080;\">;<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$confirm_code<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">(<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #400000;\">substr<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">(<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$confirm_code<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">,<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #008c00;\">0<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">,<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #008c00;\">1<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">)<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #0000e6;\">\"*\"<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">)<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #800080;\">?<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #400000;\">substr<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">(<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$confirm_code<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">,<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #008c00;\">1<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">)<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #800080;\">:<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #0000e6;\">\"\"<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #800080;\">;<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #800000; font-weight: bold;\">if<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">(<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #400000;\">strcasecmp<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">(<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$row<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">[<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #0000e6;\">'code'<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">]<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">,<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\">$confirm_code<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">)<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">=<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #000000;\"> <\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #008c00;\">0<\/span><span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #808030;\">)<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #696969;\">\/\/ original:<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #696969;\">\/\/if (strcasecmp($row['code'], $data['confirm_code']) === 0)<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #696969;\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n<span style=\"background: #ffffe8 none repeat scroll 0% 0%; color: #a65700;\">?&gt;<\/span><\/pre>\n<p>then default style (e.g. subsilver2) HTML tempalte needs to have an extra character (9 instead of 8) space in the input field, <strong>styles\\subsilver2\\template\\ucp_register.html<\/strong>, line 92:<\/p>\n<pre><span style=\"color: #a65700;\">&lt;<\/span><span style=\"color: #800000; font-weight: bold;\">td<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">class<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"row2\"<\/span><span style=\"color: #a65700;\">&gt;<\/span><span style=\"color: #a65700;\">&lt;<\/span><span style=\"color: #800000; font-weight: bold;\">input<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">class<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"post\"<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">type<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"text\"<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">name<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"confirm_code\"<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">size<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"9\"<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #074726;\">maxlength<\/span><span style=\"color: #808030;\">=<\/span><span style=\"color: #0000e6;\">\"9\"<\/span><span style=\"color: #274796;\"> <\/span><span style=\"color: #a65700;\">\/&gt;<\/span><span style=\"color: #a65700;\">&lt;\/<\/span><span style=\"color: #800000; font-weight: bold;\">td<\/span><span style=\"color: #a65700;\">&gt;<\/span><\/pre>\n<p>And finally the CONFIRM_CODE_EXPLAIN comment needs to be updated to instruct user to type the extra asterisk in <strong>language\\en\\common.php<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spammers\u00a0 finally reached PHPBB version 3 &#8220;Olympus&#8221; default CAPTCHA automated OCR task in their development schedule and recently started registering bot users passing the provided CAPTCHA confirmation code. Luckily to them, PHPBB3 default CAPTCHA code is ridiculously easy to OCR, os basically this was rather expected. It does not however mean that there is no&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/906\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[198,105,27,126,28,197,258,34],"class_list":["post-906","post","type-post","status-publish","format-standard","hentry","category-technology","tag-automation","tag-bot","tag-captcha","tag-forum","tag-ocr","tag-php","tag-phpbb","tag-spam"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=906"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/906\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}