Showing posts with label captcha. Show all posts
Showing posts with label captcha. Show all posts

Wednesday, April 18, 2007

Breaking the phpBB CAPTCHA

This article has been originally published on the old phpBB.cc site on April 10, 2006. As of today, the phpBB 2.0.x visual confirmation remains the same.

The recently released phpBB version 2.0.20 comes with the “Visual Confirmation” enabled by default. Too little, too late. The phpBB CAPTCHA has been successfully broken. Moreover, it is unbearably easy to break. A small desktop application which demonstrates this vulnerability is presented below.

This article is not intended at encouraging spambot development. The described application or the underlying algorithm will not be offered for sale. The author merely hopes to raise the phpBB users’ and developers’ awareness of the need to replace the CAPTCHA with a better one ASAP. He has already been contacted by a member of the phpBB development team after the first draft has been published. The developer refused to identify him/herself, but promised that efforts of solving the problem are being made.

The author provides phpBB customization services. If you want to make your board more secure, you may send him an email.



First, the path to the CAPTCHA image has to be specified. It typically looks like:

http://domain.com/profile.php?mode=confirm&id=$id

Depending on the cookie settings, it may be succeeded by an additional sid parameter.



The phpBB script produces a Portable Network Graphics image. It performs no check whatsoever for repeated requests, so unlimited number of variations may be produced, allowing for elimination of ambiguous OCR results.



The first step of the algorithm eliminates the background noise, leaving distinct character shapes. This step is trivial due to the critically simple noise nature.



The second step allows for cleaner character images by running a 3×3 convolution on the intermideate image matrix.

If performance is critical, this step should be preceded by border detection. The particular order in which the steps are presented in this article has been chosen for better clarity.



In this step, a bounding box for each character is detected.

As it has been noted already, border detection prior to foreground enhancement would be more efficient.



Each of the sub-images extracted in the previous step is compared to well-known font images. A character corresponding to the best match is selected for each.



The algorithm successfully recognizes most characters. One variation may occasionally mistake S for B, another 3 for 8. Combining the two variations, however, eliminates this problem.

As noted previously, unlimited queries with the same id may be made, producing different images for the same string. In addition, two retries are allowed. Repeated queries combined with retries make recognition mistakes negligible.

http://blog.phpbb.cc/articles/captcha

You Can Stop Spam Bots on a phpBB 2.x.x Forum

Is your phpBB forum being overridden by spam-bots? Standart recommendation is "go to their support forums and install modifications or hacks", but they don’t work! It`s simple. All common solutions will not work. If someone public a common solution, the spam bots will adapt to it very soon. Robots have adapted to captacha images, email verification, and other common defenses. Solution is simple, all you have to do is be unique. One simple tip on how you can do that and keep the spam bots at bay.

It is my best guess that the image verifications are the hardest to crack, so in theory, if you tweak that, the bots will not be able to adapt to it.
Make sure you have the latest version of phpBB installed (given)
Enable image verification, and user activation
Open up phpbb/includes/usercp_confirm.php
Find tweakable values. Some examples are $total_width, $total_height, $img_width, $img_height, $width, (you get the idea)
Preview as you tweak to make sure the images are still readable, yet make sure you are making noticeable changes.

I tweaked the $width variable on line 87 to the point where some of the letters were getting squished together and getting cut off by a few pixels, and that was enough for me.

I tried this method on a board that was getting 10-15 spam registrations a day. It’s been spam free for almost a month now.

If you find a method that woks, post it, but generalize it. If you get too many people start copying you exactly, it will make it work the spammer’s time to adapt to it. Remember, the key is to make your board different from all the others.

http://www.pr0gr4mm3r.com/entry/25/How_to_Stop_Spam_on_a_phpBB_2x/