Breaking CAPTCHA Using Machine Learning in 0.05 Seconds
Machine learning model breaks CAPTCHA systems on 33 highly visited websites, concept is based on GANs.
December 19, 2018 by Roberto Iriondo
Everyone despises CAPTCHAs (humans, since bots do not have emotions) — Those annoying images containing hard to read text, which you have to type in before you can access or do “something” online. CAPTCHAs (Completely Automated Public Turing tests to tell Computers and Humans Apart) were developed to prevent automatized programs from being mischievous (filling out online forms, accessing restricted files, accessing a website an incredible amount of times, etc.) on the world wide web, by verifying that the end-user is in fact “human” and not a bot. Nevertheless, several attacks on CAPTCHAs have been proposed in the past, but none has been as accurate and fast as the machine learning algorithm presented by a group of researchers from Lancaster University, Northwest University and Peking University showed below.
One of the first known people to break CAPTCHAs was Adrian Rosebrock, whom in his book “Deep Learning for Computer Vision with Python,”  Adrian goes through how he bypassed the CAPTCHA systems on the E-ZPass New York website using machine learning. Where he used deep learning to train his model by downloading a large image dataset of CAPTCHA examples in order to break the CAPTCHA systems.
The main difference between Adrian’s solution and the solution from the research scientists from Lancaster, Northwest and Peking, is that the researchers did not have a need to download a large dataset of images in order to break the CAPTCHAs system, au contraire, they used the concept of a generative adversarial network (GAN) in order to create synthesized CAPTCHAs, along a small dataset of real CAPTCHAs in order to create an extremely fast and accurate CAPTCHA solver.
Generative adversarial networks, introduced by Ian Goodfellow along other researchers , are deep neural net architectures comprised of two neural networks, which compete against the other in a zero-sum game  in order to synthesize superficially authentic samples. These are especially useful in scenarios where the model does not have access to a large dataset.
The researchers evaluated their approach by applying 33 text-based CAPTCHA schemes, 11 which are currently being used by 32 of the world’s most popular websites ranked by Alexa. Including CAPTCHA schemes being used by Google, Microsoft, eBay, Wikipedia, Baidu and many others. The machine learning model used to attack these CAPTCHA systems only needed 500 non-synthesized CAPTCHAs instead of millions of examples as other attacks before this one (such as Adrian’s) have proposed.
Once the model was initialized with the CAPTCHAs security parameters in mind shown in Figure 2, it was used to generate a batch of synthetic CAPTCHAs in order to train the synthesizer with the 500 real CAPTCHAs obtained from the diverse CAPTCHA schemes shown in Figure 3. The researchers used 20,000 CAPTCHAs to train the pre-processing model along 200,000 synthetic CAPTCHAs to train the base solver.
The machine learning prototype was implemented using Python, the pre-processing model is built using the Pix2Pix framework, which was implemented using Tensorflow. The fine-tuned solver was coded using Keras. 
After the generative adversarial networks were trained by using the synthesized and real CAPTCHA samples, the CAPTCHA solver was used then to solve CAPTCHAs from highly visited websites, such as Megaupload, Blizzard, Authorize, Captcha.net, Baidu, QQ, reCaptcha, Wikipedia, etc. The impressive approach of this method is that most of the sites CAPTCHAs were solved with over 80% success rate, exceeding 100% on sites like Blizzard, Megaupload and Authorize.net, an attack method that has proven to have better accuracy on all other prior methods to solve CAPTCHAs, which used large non-synthesized training datasets.
Other than enhanced accuracy, the researchers mentioned on their paper that their approach was not only more accurate, but also more efficient, and less expensive to implement that other methodologies proposed . Besides from being the first GAN based solved for text-based CAPTCHAs, it is an open door for attackers to use, hence their effectiveness and inexpensiveness to implement.
Nevertheless, the approach has some limitations, such as the use of CAPTCHAs with variable numbers of characters, the current approach uses a fixed number of characters — if it’s extended the prototype would break. Another, is the use of variable characters on the CAPTCHA, while the prototype can be trained to support this change, it currently does not as is.
It is important for highly visited websites to use more robust ways to protect their systems, such as bot-detection measures, cyber-security diagnoses and analytics, along multiple layers of security such as device location, types, browsers, etc. — as they are now, an even easier target to attack.
Don’t forget to checkout:
Unfortunately, some tech organizations are deceiving customers by proclaiming using AI on their technologies while not…medium.com
Artificial intelligence would not be what it is today, if not for the contribution of these remarkable researchers.towardsdatascience.com
What are some open datasets for machine learning? After scrapping the web for hours after hours, we have created a…medium.com
Figure 1: Hyperparameter tuning problem with a 2D search space. Each point represents a specific hyperparameter…blog.ml.cmu.edu
 Yet Another Text Captcha Solver: A Generative Adversarial Network Based Approach | Guixin Ye, Zhanyong Tang, Dingyi Fang, Zhanxing Zhu, Yansong Feng, Pengfei Xu, Xiaojiang Chen, Zheng Wang | Lancaster University, Northwest University, Peking University | https://www.lancaster.ac.uk/staff/wangz3/publications/ccs18.pdf
 Generative Adversarial Networks | Ian J. Goodfellow, Jean Pouget-Abadie , Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair , Aaron Courville, Yoshua Bengio | Department of Computer Science and Operations Research, University of Montreal | https://arxiv.org/pdf/1406.2661.pdf
 Zero-Sum Games | Game Theory | Stanford University | https://cs.stanford.edu/people/eroberts/courses/soco/projects/1998-99/game-theory/zero.html
 Deep Learning for Computer Vision with Python | Adrian Rosebrock | https://www.pyimagesearch.com/deep-learning-computer-vision-python-book/
 Gao, H., Tang, M., Liu, Y., Zhang, P., and Liu, X. Research on the security of Microsoft’s two-layer captcha. IEEE Transactions on Information Forensics & Security 12, 7 (2017), 1671–1685
 Gao, H., Wei, W., Wang, X., Liu, X., and Yan, J. The robustness of hollow captchas. In ACM Sig | https://www.lancaster.ac.uk/staff/yanj2/ccs13.pdf
 Mohamed, M., Sachdeva, N., Georgescu, M., Gao, S., Saxena, N., Zhang, C., Kumaraguru, P., Oorschot, P. C. V., and Chen, W. B. A three-way investigation of a game-captcha:automated attacks, relay attacks and usability. In ACM Symposium on Information, Computer and Communications Security (2014), pp. 195–206
 Yan, J., and Ahmad, A. S. E. A low-cost attack on a microsoft captcha. In ACM Conference on Computer and Communications | http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.295.9469&rep=rep1&type=pdf