Javascript CAPTCHA decoder

ocr_20090125.jpg

Shaun Friedle created an impressive piece of Javascript which can automatically defeat CAPTCHAs used by the Megaupload file hosting service. While their CAPTCHAs are particularly weak, it's an impressive Javascript feat that breaks into some new territory, namely Javascript-based optical character recognition. John Resig posted a breakdown of how the software works. Here's the quick summary:

  1. The HTML 5 Canvas getImageData API is used to get at the pixel data from the Captcha image. Canvas gives you the ability to embed an image into a canvas (from which you can later extract the pixel data back out again).
  2. The script includes an implementation of a neural network, written in pure JavaScript.
  3. The pixel data, extracted from the image using Canvas, is fed into the neural network in an attempt to divine the exact characters being used - in a sort of crude form of Optical Character Recognition (OCR).

Shaun designed the software as a Greasemonkey script that will break CAPTCHAs for Megaupload and automatically trigger a download. The code is designed specifically for this CAPTCHA style, but there's no reason why the getImageData trick combined with a alternate OCR implementation couldn't be used to solve for other systems. This is pretty fascinating stuff.

Is there a better (more convenient, harder to cheat) way to prove humanness? What else could you make in Javascript using OCR, neural nets, or per-pixel image processing?

Megaupload Auto-fill CAPTCHA
MuCaptcha Online Demo
OCR and Neural Nets in JavaScript - John Resig


Recent Entries

Comments

Oldest comments listed first.

Posted by: MakeFan on January 25, 2009 at 4:33 PM

Impractical

Cool coding, however a neural network is simply a memorization table. Even them changing the CAPTCHA letters to lowercase will break this code. And things get real messy when they introduce funny letters and random lines.


Posted by: Anonymous on January 26, 2009 at 12:10 AM

Neural networks have the ability to resist some noise, allowing them to see through any funny letters and random lines. You can also teach them lower case letters.


Posted by: Brian on January 26, 2009 at 1:37 AM

Is there a better (more convenient, harder to cheat) way to prove humanness?

This probably requires two different checks. Something like a questions 'Which of the following is a Rabbit'. Then show several images of various animals. The software would need to be able to do two things, firstly parse the English sentence as a question and understand what it means. Then be able to decode several images and determine the match.


Posted by: Stephen on January 26, 2009 at 5:28 AM

I think this is uncharitable on MegaUpload

While MegaUpload uses a remarkably uncomplicated three letter CAPTCHA to validate genuine downloads I think this is extremely nice of them and calling it weak, while true, is somewhat the point.

Who here has stared in incomprehension at the "pay to make this go away" cats and dogs CAPTCHA on Rapidshare? That's the other end of the scale for "security". Being able to punch in three letters and get your speedy, bulk download is wonderful in a world where the CAPTCHA has become a tool to generate revenue.


Posted by: selfSilent on January 26, 2009 at 10:31 AM

why would you ?

Captcha and other identical ideas are there to stop spambots from entering areas like forums. Why the hell would you want to help bypass this? It's just gonna help the spammer.


Posted by: Shaun Friedle on January 28, 2009 at 11:50 AM

Stephen, Rapidshare has no captcha at all anymore, they have seen the light - both rapidshare and megaupload restrict free users to one download at a time and limit the amount they can download in a day and that is enough to prevent anyone overusing their service anyway.

selfSilent, I don't know how a script that breaks the captcha on a download site will help anyone get into a forum, spammers already have much more sophisticated software capable of breaking captchas on forums, the only thing that's new about my script is it uses javascript.


Leave a comment


Subscribe to MAKE!Subscribe to MAKE Magazine!

Subscribe today, save 42% and get web access to MAKE free. MAKE Digital Edition is available only to subscribers.

$34.95 / 1 year
(4 Quarterly Issues)

Subscribe now


Void your warranty, violate a user agreement, fry a circuit, blow a fuse, poke an eye out. Make: The risk-takers, the doers, the makers of things... Welcome to Make: Online!


CRAFT Maker Shed Maker Faire MAKE television
Holiday Gift Guides from MAKE
Gifts for Dads
Science and Chemistry
Gifts Under $20
More guides: Santa Claus Machines, Geek Toys for Grown Up Girls & Boys


Check out all of the episodes of Make: television

Alex Rider Dream Gadget Contest
Make: Science Room

Connect with MAKE

Be a MAKE fan on Facebook MAKE on Facebook
Visit our Facebook page and become a fan of MAKE!
MAKE on Twitter MAKE on Twitter
Follow our MAKE tweets!
MAKE Flickr Pool MAKE on Flickr
Join our MAKE Flickr Pool!
    make_tips on Twitter




    Maker SHED

    Advertise here with FM.

    Why advertise on MAKE?
    Read what folks are saying about us!

    Click here to advertise on MAKE!



    Subscribe to MAKE Magazine!

    Make: Online authors!

    Gareth BranwynGareth Branwyn
    Senior Editor


    Phillip TorronePhillip Torrone
    Senior Editor
    | AIM | Twitter


    Becky SternBecky Stern
    Associate Editor
    | AIM | Twitter


    Marc de VinckMarc de Vinck
    Contributing Writer
    | AIM | Twitter


    John ParkJohn Park
    Contributing Writer
    | Twitter


    Sean RaganSean Ragan
    Contributing Writer
    | Twitter


    Matt MetsMatt Mets
    Contributing Writer
    | AIM | Twitter


    Dale DoughertyDale Dougherty
    Editor & Publisher
    | Twitter


    Shawn ConnallyShawn Connally
    Managing Editor
    | Twitter


    Goli MohammadiGoli Mohammadi
    Associate Managing Editor

    Kip KayKip Kay
    Weekend Projects
    | AIM | Twitter


    Collin CunninghamCollin Cunningham
    Contributing Writer
    | AIM | Twitter

    Adam FlahertyAdam Flaherty
    Contributing Writer
    | AIM | Twitter



    More contributors: Mark Frauenfelder (Editor-in-Chief, MAKE magazine), Kipp Bradford (Technical Consultant/Writer), Chris Connors (Education), Diana Eng (Guest Author), Peter Horvath (Intern), Brian Jepson (O'Reilly Media), Robert Bruce Thompson (Science Room)

    Suggest a Site!

    Current Podcast

    itunesdl.gif Weekend Project: Beetlebot Simple robot from your parts bin that avoids obstacles. Thanks go to Jerome Demers for the original article in MAKE, Volume 12. To download the Beetlebot video, click here or subscribe in iTunes. Check out the complete Beetlebot article... More...

    Get the Make: Online sent via email
    Enter your email to receive Make: Online each day:



    MAKE Fascination video series brought to you by Dow

    Make: Education
    MAKE: en EspaƱol MAKE: Japan
    Important please read


    Subscribe to MAKE Magazine!

    Recent Posts from the Craft: Blog