Hello, and welcome to Deciphering Captcha. My name is Michael Brooks, and in this talk I'll be discussing two of my automated captcha solvers' work. These two attacks have been identified by CVE-2008-2020 and CVE-2008-2019. The name of this talk is Deciphering Captcha, but I do not consider captcha to be a cryptographic primitive. Although there are similarities between the two, I'm using the word decipher as to make out the meaning of despite the indistinctness or obscurity. My biggest motivation for giving this talk is in reaction to how poorly documented captcha solvers are. I can think of no other widely used security system with so much misinformation associated with it. One of the effects of this misinformation is the widespread use of weak captchas on the Internet today. Before making my research public, I could only find a single CVE that was actually solving a Turing test. This is CVE-2007-3308. Instead, the clear majority of CVEs against captcha have been taking advantage of implementation. The first captcha we'll be looking at is CVE-2008-2020. This captcha is the one used by phpnuke. If you want, you can go to phpnuke.org and see it. They're still vulnerable to this day, even though I reported this flaw back in April. Computers are great at performing lots of permutations. And they're only going to... The number of the possible permutations for this captcha is 10 to the sixth, which is exactly 1 million. As an attacker, we want to inverse the captcha function. To do this, we must utilize the very code used to build the captcha to build a lookup table of all possible corresponding outputs. The input to this capture is the answer and the output is the challenge image. It needs to be executed as a one-time phone call and a one-time call at the same time. Instead of storing the entire image outputted from the CAPTCHA function, I'm storing just the message digest. Using this method, I'm able to use less disk space for building a very large lookup table. And also, lookup time is considerably less for storing the entire image. The ability to use MD5 allows me to use Rainbow Crack. But this is key. You can't use Rainbow Crack on breaking all CAPTCHAs. Only this specific CAPTCHA, because it is a one-to-one function in the mathematical sense of the word. If you start introducing more randomized data to the CAPTCHA, it no longer becomes a function. And that one answer will have many challenge images relating to it. However, even though you're adding randomized data, no matter how much randomized data you're adding, it can still be reversed. You can iterate through all of the random call functions, producing every possible combination. In fact, the phrase completely automated Turing test to tell computers and humans apart is a logic error. If you have code to build a completely automated test, then you can use that code to build a table of all possible solutions. Now, this is a laborious process. However, it doesn't mean that it's a good idea to build a table of all possible solutions. It doesn't require much technical ability. Now, in the case where you don't have the source code, in fact, paypal.com, right now, if you go to sign up for a PayPal account, they're using a very similar CAPTCHA. It doesn't contain randomized data other than the actual message. Unfortunately, I'm unable to show it to you. But using a CAPTCHA like this, the largest number of calculations is 36 to the 5, which is 60,466,176 possible combinations. Now, it's taken many man hours to complete this. But PayPal suffers from another issue. By refreshing the login page, a new CAPTCHA will be given. So, by building a smaller table, you can still break them by asking for another challenge, another CAPTCHA challenge. Instumation. Every open source CAPTCHA is vulnerable to a permutation attack. Permutation attack against CAPTCHAs are recognized by my CVE 2008-2020. To protect my company, I had to implement reCAPTCHA, reCAPTCHA.net, which is a free service. It's a closed source CAPTCHA that is developed by Louis von Ahn, who conducts very provocative research. A large number of man hours are wasted solving CAPTCHAs each year. reCAPTCHA harnesses the power of human computation to digitize books, which betters all of humanity. I feel privileged to live in a time where organized book burnings such that of the Nazis and extremist religious groups can no longer cause harm. The next CAPTCHA is more interesting. The CAPTCHA attack is more interesting. The attack is much more complex. This attack is 2008-2019. It is an audio CAPTCHA built for the simple machines, but it is not a CAPTCHA built for machines. A CAPTCHA solver was created for an earlier version of this CAPTCHA, and it is identified by CVE 2008-3308, which is the only other CVE regarding CAPTCHAs. To address this security issue, simple machine form developers added noise to the audio file. Two major components to decipher the signal are... I used two major components in order to decipher the signal despite the noise. The first component is a Hamming distance. This is named after Bell Labs researcher Richard Hamming. Hamming distance was introduced in the fundamental paper entitled Error Detecting and Error Correcting Codes in 1950. A Hamming distance measures the noise between two signals that should otherwise be identical. Hamming weight analysis of bits is used in several disciplines, including information theory, cryptography, bioinformatics, and genetics. It is the fundamental algorithm used to compare fingerprints and iris scanners for authentication. It is also used in optical character recognition software like Tesseract. I obtained the Hamming distance function implemented in PHP from the open source project PHP for Bioinformatics. This project is performing Hamming distance calculations on sequences of DNA. The other component in this capture attack is fuzzy logic, which is a tool used in artificial intelligence. In short, fuzzy logic is a range of truth between 0 and 1. Fuzzy logic is being used today in places such as washing machines to tell you how dirty your laundry is and in dryers to tell you how dry it is. Using these two elements together alone, just by performing a Hamming distance calculation on the very beginning of a file, I was able to find the first letter. At this point, I was absolutely ecstatic. I was jumping up and down, and I had broken. I had broken a capture using these systems. It was only the first letter. In order to find the other letters, it was proving to be more difficult. The ability to find the spaces between letters was difficult. There are methods, but it was very heavy. Very heavy calculations. I did find, however, a problem with the capture. After each letter, there is 5600 bytes minimum space between each letter. After finding the first letter, I would skip ahead 5600 bytes. There is a problem with Hamming distances, or at least it's an implementation issue. In order to perform a Hamming distance calculation, both strings must be of the exact same size. In order to identify a letter, I must know exactly where it is, where it starts. And even where it ends. The solution I came was to run a whole lot of Hamming distance calculations. I'm running literally thousands of them. In order to solve about one capture, it takes about 14,000 Hamming distance calculations. Luckily, these are very cheap. Very cheap calculations. There are other tools for performing fuzzy comparisons on strings. One of them is called the Livingston distance. It doesn't suffer from the same shortcomings as Hamming. You can perform Livingston distance calculations on two strings of different sizes. It's able to identify comparisons despite transpositions of data, or moving data around, or injections of large data. Unfortunately, Livingston distance calculations are extremely heavy. Performing a calculation on only a few kilobytes of data will require gigabytes of memory. Livingston distances are being used in audio processing. As an example, there is U.S. patent 6073099 entitled Predicting Auditory Confusions Using Weighted Livingston Distances. The great Alan Turing is the creator of the Turing test, and where CAPTCHA gets its name. Turing himself believed this test would eventually become obsolete. In 30 years, it would be as easy to ask a computer a question Excuse me. In 30 years, it will be as easy to ask a computer a question as to ask a person. This is Alan Turing in 1946. Well, clearly, that is not the case. However, I believe that this eventually will happen. The CAPTCHA CAPTCHAs will eventually become obsolete. Many attacks in software are becoming obsolete, and so are defenses. Information security is an ever-changing landscape, and I don't believe it will ever come to an end. After 3.5 billion years of evolution, organisms have become incredibly adept at defending themselves from viral attack. Even with the incredible capability of the human immune system, we still suffer from many methods of code execution. These virons are in the room, pumping through your bloodstream as I speak. New methods of attacking software are developed constantly. Software that was once believed to be secure can in fact be extremely vulnerable to new attacks. For instance, the format string vulnerability was discovered less than a decade ago, and more recently, the dangling pointer attack presented at Black Hat only last year. Programmers are human, and we must make assumptions about how our code will be used. We cannot foresee every condition that our code will encounter. I enjoy that journey into the unknown and the fruits of my labor of love. Unfortunately... My talk would have ran a bit longer due to my presentation materials. I'll try and get them working. Or the visuals. I'll try and get that working. The code I have for both of these captures are available on my website. The X-Play code is available for both of these. I encourage you to download them. Particularly, the code is not very complex. I think you'll be surprised on how simple it took to break some of these systems. I think that's a sign of elegance. I encourage more research in the area of captures and people to be open. I find it unfortunate that many people keep these methods secretive, and that they're... Yeah, it's unfortunate. Oh, yeah. My materials are on my website, rookssecurity.com. I'll have updated materials as well. Oh, X-Play code is also available on the DEF CON CD for both of these attacks. Um... Let's see it in action. Aha! All right. Okay, okay. Sorry. I do apologize. All right. This is the PHP new captcha. As you can see... Very simple, right? Very simple. I can't... But you would be surprised. The CVE for this captcha... People using this captcha was over a half a dozen software packages, and there are more. This... This is... Oh. Oh. Here, wait a bit. Hold on. Now, to build up the lookup table, I start iterating. I start at 0, 0, 0. In the far column, you see that that is the MD5 hash of the actual image. I continue on from 0, 0, 0 all the way to 9, 9, 9. It's very simple. Backwards. All right. This is actually a one-to-one function, similar to f of x equals x to the 3. For every one input of the answer, there is exactly one output. Now, so when the function is inverse, it is still a function. It is f of x to the... Well, one-third. Anyway. Which is shown by the graph. Now, if you... If you inverse a non-one-to-one function, it no longer becomes a function in terms of... For one value of x, there are now... Yeah. For one value of x, there are now two values of y. So... Rainbow crack is able to... Is able to break specifically this capture because of its one-to-one nature. Okay. This is the audio capture. The first... This is one of the main slides I wanted to show you. Okay. The picture you see at the top is the raw audio file being put together. This is without the noise. It runs through a noise subroutine as the patch. And you see at the bottom. Actually, picking out... I mean, at the top slide, picking out that black space is pretty easy. I mean, you can do it with a string compare. But doing it... It becomes more difficult later on. Not only... Not only are the black spaces changed, but also the wav file... Each letter themselves are changed. And we can measure this change using a hemming distance. And I can show you the exploits. Right here. Okay. Um... It looks like... It looks... It's very simple. Basically, I just upload the .wav file. At least the interface is very simple. It's a PHP file. I upload the .wav file produced from the image. Attack. Attack. It'll take a while. This is on a different system. On my personal machine, I have, like, a dual-core 2.4 gigahertz. It'll take around about 14 seconds or so. To break it. Um... The server that I'm using right now isn't as beefy. Um... But here... Oh. A bit out of order. This is the captcha used on PayPal's sign-up site right now. What are you doing? Why? Why are you doing that, PayPal? Like... It... It is disconcerting to me that a financial institution would be using such a weak captcha. Um... I... And then, also, phpnuke.org. Here's phpnuke.org. It has been downloaded by, um... It says 8.35 million downloads. And look. And if you see the captcha in the corner, security code, they're still using my... And this was... This exploit code has been available since April. Yet they have not patched. I... Uh... I'm not sure... I'm not sure I can't explain that one. Anyway. Um... Okay. So in this hack, um... Um... A total of, uh... A total of 5,527 hamming distances were used in this attack. Um... Uh... And I... Here. I'll pop the code. I don't know how many of you are programmers. But, um... I like the code. Uh... In essence... I don't know. Two minutes? Two minutes left? Hmm. Oh, well. So... Uh... If you see the code... I start by loading all of the... Um... All of the clean letters into the... Into, um... Into memory. Uh... And then I began, uh... On this line here. Um... I know that I'm searching for five letters. And that's what I'm saying right here. I'm looking for, uh... After finding five characters, I would like to... I'd like to, um... Stop. I know I've reached the end. Uh... Here I'm performing... Uh... On this line over here, I'm performing the hamming distance. Uh... With... I found a way to, uh... Save resources by actually not performing a hamming distance on the entire letter, but only, uh... The, um... First... Uh... First three characters. In this case, the first 512 bytes of the... Of the file. Um... Here. Um... Hamming distance... Hamming distance... Hamming distance is actually, uh... A fairly simple calculation. Um... Here, uh... I'll show you... This is, uh... Hamming distance... Shown on, uh... Just regular words. For instance, the hamming distance between toned and roses is three. Where, uh... Three characters are... Are different. And then, uh... Again, the hamming distance shown between, uh... Two sequences of binary. Um... Um... So... Uh... How the CAPTCHA... Oh. This is... Uh... Another thing. If you're... If you were to use this... Uh... A similar attack on another... On another CAPTCHA... You must make sure... That you're comparing... The, uh... The raw pulse code modulation. Uh... What this means is that... Uh... I... Uh... The CAPTCHA they're giving to me is a wave. So it is a raw stream of, uh... Uh... Uh... A digital representation of... This, uh... Analog... Of... Of... This analog wave. Uh... If you've taken calculus... Uh... This looks very similar to a... Uh... An integral. Uh... Now... Uh... Uh... Um... So... Okay. So if... If you were to give... Uh... Get a challenge response in an... An MP3, for instance... You would have to change it to a dot wave before, uh... Before, uh... Performing it. Uh... Anyway. My time is done. I, uh... I... I wish the best. I hope... I hope that there will be more research in the area of CAPTCHAs. And people will be open with their research. Thank you very much. And have a wonderful day.