All right, thank you for coming to this presentation, Embedded Reverse Engineering Cracking Mobile Binaries. In short, I'll be showing you how to crack a mobile binary or an EXE on the Pocket PC platform. Although it is targeted more for the Microsoft side of things, the information I am presenting is also geared toward the ARM processor, which is multi-platform and multi-device. So you can use some of this knowledge with other things, too. Before I actually get started, I have some swag to give away. And this is kind of a self-promotional thing, too. I co-authored this. If you don't win, you can buy it. It's available. As I look around, I see a lot of people. I see a lot of people. I see a lot of people. I look around. This isn't as black of a crowd with the shirts as I expected. I've heard this referred to as an oil pit by some people with the number of black shirts in here. Anyway, I want to give this first book to the person wearing the brightest, most obnoxious shirt. And I think I can spot him from here, the tie-dye man right here. So I'll give you the first one. The second one, picking on another stereotype, most of us are probably 35 or under. So I want to give this to the oldest person in the crowd. So is there anybody 65 or older? Yeah. Is anybody going to admit to 55 or older? Come on up. Come on up. Very good. I want to be coming to DEF CON at your age. Now, the third one is kind of funny because I received two of these in the mail a couple of weeks ago. I don't know why they sent me two. It's in traditional Chinese. I can't read one of them. So why they sent me two is beyond me. Does anybody know traditional Chinese? Come on up. It's yours. And if you haven't seen one of these yet, you probably haven't been in a talk. Let's see. I'll just give it to the first person who can make it. Okay. Come on up. He's coming behind you, man. He beat you. There you go. All right. Now to get started on this. Who am I? What am I doing here? How many people got their way paid? Yeah. I had to basically come up here and speak to get my way paid. So for the rest of you, this is one way to get a free ticket to DEF CON if you can find a company to sponsor you. And Air Scanner is a company that sponsored me. They do mobile security software. And if you forget, there are little logos in the upper left-hand corner of every slide. So I don't think you'll forget very easily. Anyway, I have always been attracted to reverse engineering since I was a kid at the toaster and remote-controlled cars and whatever else. I'm sure many of you can share that. It's that same kind of feeling. To me, it's a tool, not a weapon. And with computers, it's all about knowing your computer. So this is why I targeted this particular subject. There is a darker side to reverse engineering. Most of us are familiar with cracking software. Payer programmers, especially in the US, programmers are already seeing a lot of their jobs outsourced. So they're losing money. And that's about all I'll say. Have to cover the legal issues. This is reverse engineering. And in some contents, it's illegal. I'll just read this verbatim. No person shall circumvent a technological measure that effectively controls access to a work protected under this title. And this title is the law it pertains to. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . It's just that it's not effective. What? If you're telling me it's not effective, it's not effective. It's not effective? Right. Okay. Yeah, I'll take questions again. Anyway, I've got to move on. This takes 50 minutes. I am going to show a serial protection. I'm going to show that basically you want to program your stuff right. If you program it simply and you look at the upper level languages, and you think your serial protection is secure, you're probably misled because at the bottom level, when you're dealing with an assembler, it's probably going to be flawed. Most serial protections are flawed. Okay, now get into it. I'm going to skip these because I don't have time. There are some memory issues. If you own one of these devices and you ever let the power run out on it, you'll know that you probably lost all your files, except for the stuff stored on the compact flash. That's because it's stored in RAM. We all know RAM needs power to survive. The OS files are stored on the ROM, so they don't get lost. There's a unique issue with the way the files are on here. The OS files are executable in place, so that means they don't need to be dumped to RAM to run, so it saves your RAM resources. Unless they're compressed, then they have to be decompressed to the RAM, which adds a little kind of an issue when you're debugging software because you can't debug it straight from the RAM. Something to keep in mind. We won't really see that here, but if you move on and run with this, keep that in mind. Moving on, there are some prerequisites to being able to reverse engineer. You've got to understand where assembly fits in the broad scheme of things, that it's a lower-level language, it's not an upper-level language. It's simply one step up from the machine code, the binary, that the actual processor reads. It's a way for us humans to understand it more easily. You've got to understand the conversions between hex to binary, ASCII to decimal. Enough said there. I hope you all know that, or at least are able to figure that out. However, the ARM processor has a lot of problems. It has a lot of specifics in it that you do need to understand. That is the registers and the opcodes, and how the registers work, and what the opcodes are, and how they work. We're going to be covering some of those here, not all of them because there will be more time than I'm allotted. To start, the registers. There are 37 total registers. The registers are used by the processor, so it doesn't have to keep writing back and forth in RAM. It basically speeds the process up. The register purpose changes depending on mode. You'll read about this. This is more of an upload. This is a level thing. However, there are some registers that we need to definitely pay attention to. Register 15 is the program counter. This is important to watch because it lets you know where in the program you are actually executing at. Register 14 is the link register. That's if a program is executing through and needs to go to a subroutine. It'll continue executing, but it has to know where to bounce back. That's what the link register is for. It points back to where you need to continue executing at. Register 13 points to the stack. Now, the stack, most of you are probably familiar with. The idea of a stack is simply is used to hold the temporary values and the variables that are used by your program, including register values when a subroutine is called. Those values will have to be put aside, so the subroutine can then use the registers, how the stack is used. There are four registers, 31 through 28, which are used as status flags. These control how your program flows. We'll get into that more. In particular, if you're starting out, you need to pay a lot of attention to register 31, and register 30. And these are used to, register 31 is a negative, or it's the less than. So these status flags can mean more than one thing. And you got to keep that in mind as you're watching the program execute. What am I actually using the status flag for at this point? And you'll understand as we get into how the status flags work, and we'll show this. The same thing about register 30. And this is a little bit confusing if you're new at this, because if a value is zero and it's checked, the zero flag will be updated to one. If the value is equal, it'll be updated to one. So, basically, just watch how the zero is working. You might kind of get confused. If it's zero, then it should be zero, and it's not really works that way. Here is a screenshot of the register window and the Microsoft debugger, which I will show you. I just want you to see how these, while we're talking about registers, you have registers zero through register 12 that are listed as they are. Now, the stack pointer is registered. Register 13, link register 14, program counter is 15. Here you can also see the negative, the status flags basically right listed here. Jumping on to the opcodes now, I'm going to touch on like eight of them or something like that that we'll be using. The first one is the move opcode. It simply moves a value from a register into another register or from a hard-coded value in the program into a register. And if you note over here, on the right where the hex is, I included that so you can kind of get a feeling for, you have to pay a lot of attention to detail when you're working with this. Because this, if you wanted to change a value, you have to make sure that you pay attention to all the characters in your hex. The compare opcode, this again, it'll just compare a value in a register to another register or a hard-coded value to a register. And again, I included the hex just so you can see that there's just a slight variation between the two, but it makes a big difference. If you forget that, your program, and you try and change something in your program, you'll probably get confused, you'll forget what you changed, and then you might as well start over. All right, status flags, talked a little bit about this. Here you can see how the status flags work. I have the compare status flag, the compare opcode comparing R1 to R0. Now the negative, the end status flag is updated according to which value is greater. If R0 is greater than R1, then the status flag will remain zero. If R1 is greater than R0, the status flag will be updated to one. The Z status flag with the compare opcode basically looks to see if the values are the same. The result determines whether or not the Z is set to one or the Z is set to zero. And the carry kind of works opposite of the negative. Now if you note, down here at the moves, that S, if you're familiar with x86 debugging, that does not mean move string. That means perform the move and then update the status flag. And here, the same thing with the ands opcode. Basically, when flags are updated, they're updated based on the resultant value. Now in the case of the move, both values are going to be the same, so it doesn't really make a difference which value you use. And the ands opcode, if you use, well, if you and R1 and FF together, then R0 is where the resultant value is written to. Your status flags are updated based on that value in R0. Here you can see how it works. The Z status flag isn't really updated with these two. Here are a list. This is a good reference. You need to be familiar with at least recognizing what they are and how they control the program flow. Here's a list of all the status flags. Primarily, we'll be looking at the equal, not equal, and greater than and less than. Pretty straightforward. Most people understand basic math. Moving on. Now the status flags are used by the opcodes to determine program flow. Now here I have the branch opcode. Which runs down through a program. If the branch opcode is in there, it'll bounce it out to another address. The branch of the link is used for subroutines. If you run that program through the program, you have a subroutine, it bounces out, and then it bounces back. Now the branch will only be executed in the case of the branch equal if the Z status flag is updated to one. And the not equal if the Z status flag is updated to zero. So you can see here again, I listed a part of the hex that you can see that changes. The load register and store register. These two are used to write values either to the memory from a register or pull memory into a register. And the load loads the value from the memory into the register and the store stores it into memory. Here you can see variations in how it's used. There are numerous ways that they can be combined. Values can be added, registers can be added, it can be stored back to itself or not stored back to itself. This is kind of like a second level if you want to continue looking at reverse engineering. However, at the bottom here, the load multiple and the store multiple, they are used particularly when there's a subroutine called. They said the program executes down through, the subroutine is called out, the values in the main program that are being used have to be stored on the stack, and that's what this is used for. You'll see this a lot. And it's important to recognize that. because that means there's probably a subroutine being called. And the load will then load the values back off the stack into your registers again. And I'll talk about logical shift right, logical shift left. These are just used to move, basically it moves the binary value of, or the binary representation padded left or right with zeros. They can be, you can also have arithmetic, which will keep your sign bit, which keeps things flowing right. This is kind of a second level, we won't use it here. But it's important to be able to recognize what they're used for, if you see them. Now there are three main tools that we use for reverse engineering. The hex editor, disassembler, and debugger. The hex editor basically is just used to look at a file in hex, and you can then update that file with the values that you need to make it do what you want. I use UltraEdit32 in this demonstration. You're probably all familiar with the hex editor, and you probably have your own preference. This one just works in Windows and works in a presentation. Disassembler, this converts your program file into its assembly code, so you can actually understand what's going on, and you can basically read it. I use IDA Pro, there again, there's numerous ones, but IDA is pretty much the industry recognized, especially with people like us. Then the debugger. Now the debugger, you don't really have too much choice, especially on the Windows platform. However, Microsoft does provide a free debugger, which is nice of them. If you use one of these devices, you probably are familiar with the active sync and connecting up to your laptop or whatever with a USB connection. You can debug over USB, but it's painstakingly slow. You will crawl, and you'll get frustrated. I recommend that you connect it up with a regular wired network or a wireless network. I wasn't going to use wireless here because, well, I don't want to get kicked off my own wireless demonstration or whatever. So I have a crossover cable plugged right into my computer, full 10 megabit connection, it works beautifully. And it's practically instantaneous debugging. So you will need a program called Pocket Hosts for this, which is basically just a host file for the Pocket PC platform. Okay, now I debated whether or not to use two laptops at this point, but I went with one so we can see the screens. I'm going to jump out. At this point, we're going to go into IDA and we're going to load the file in. And before you do anything, any reversing, you have to have the actual executable file on your local computer. So you can't reverse it directly from here as easily. IDA has a special, well, it works better as a reverser than the debugger, although you can reverse with a debugger. It's kind of difficult to follow what's going on sometimes. So when we pull, when we load up, IDA, we need a place to hook into the program. We've got to figure out where it's going or what it's doing and basically try and find some place that we can just figure out what's going on. And there are some options. The more you do this, the more you learn to recognize what these functions are for and how they're used. One of the primary ones that are used in serial protection is the string compare because it basically compares a serial string with another serial string. This is one of the, one of the biggest taboos that you should not do is use a string compare, but people are still doing it. You can also use a message box because what's the first thing that happens if you enter the wrong serial string? It's going to get a message box saying you entered the wrong serial string. And that's just another way to hook right into the program and figure out what's going on. Let's see, I'm going to escape out of here. Jump into IDA. And here you can see the best way to do this is with the names window. Now, I know my string compare is right here. And IDA makes it really easy. It points right to the address. All I have to do is double click on it and I'm right there. I'll close this window. Let's see, open up this. Go to this next screen. This is an illustration of what you do not do. I give you one guess what these functions will actually point you to. A registration check perhaps or maybe an invalid registration. So if you're programming, you kind of want to, I mean, obsecurity is not security, but if you don't want to make it too easy, don't use something obvious like this. Here is a screenshot of IDA. And this is where we're at in the program. You can see the circle points. This is where it references it to inside the program. If there are two points of reference, like the function is used twice, it will have two listings. If there are three or more, it will have a dot, dot, dot. You simply click on it and it will open up a nice window. This is where you want to go to. And you double click it again and you're there. You may have to hunt and peck for a while before you find the place that you actually are looking for. For our illustration though, we are, we only have one, so here we are. This is the point in our program that our serial check is being performed. I'm going to start up here at the top. Back over here. The point in the program. This is the code that we're looking at. I don't know if any of you have laptops and you're following along, but if you did, then you can see this. Or if you go through the presentation later, you can see this is the entire, basically the serial validation check that we're looking at. I use IDA. One important thing to keep in mind, well, a tip for you, is if you're using IDA Pro less than 4.5, you'll have some issues trying to figure out what's going on because your function calls will be labeled with some really cryptic stuff like MCE300 underscore 2445. You kind of have to figure out what's going on and how it's being used and it can get frustrating. Now, Data Worm, if you're familiar with him, he does a lot of work with reversing and he actually came up with the IDT files that convert those cryptic into something you can understand. And he has them available at his website and I hereby give him a public note of gratitude because he helped save me a lot of time working out some of what was going on. Jump back over to here. Now here is the program. You can see right here, we're setting up some strings and we're starting to load some values into the string. Now, because this is a simple illustration, my serial number is not really hidden. Here it is. 1, 2, 3, 4, 5, 6, 7, 8. And I kind of start out giving you it but it shows you that we're working toward a goal. Now, this is a really sloppy code but it still happens to work. It happens quite a lot where the serial number is actually included right in the program. You can see it in the hex editor. We have another string being loaded. This is correct serial number. Thanks for registering. There it is, right in memory. And that happens a lot. That happens more often than it doesn't. Incorrect serial number. Please contact technical support. And we have a final value right here being loaded into the register. And correct serial number. It says, please verify something or another. Incorrect serial number. Please verify it was typed correctly. So we have two incorrect messages and a correct message and our serial are loaded into the memory and placed on the stack. Now, at this point, many of you might recognize this update data if you program in C++. It's the function that basically loads the value on the screen into your program so you can use it. Now, at this point, we're going to jump into the debugger side of it. Because this is at the point where we want to see what's going on. So, I'm in embedded Visual C++. Let me open up my file. Here it is, serial.exe. It's open. Now, as we get into here, the first thing you're going to want to do is again, copy the file over to your PC if you haven't already done so. And you're going to hit F11. And this basically just prompts the debugger to the first line of execution in the program. And you're going to want to set breakpoints. Breakpoints are very handy because especially if you're in a huge program with thousands and tens of thousands of lines of code, you want to be able to stop it at a point where you know what's going on. Now, we already determined in IDEA that we want to stop it right here. So, I'm going to stop it at 11280. And you can see another little tip is that you see 00011280 because it doesn't, it's a relative address not using a base address. So, you need to keep that in mind because in your debugger, you're going to have you hit F11 and it goes through a bunch of connections it'll ask you for some DLLs if you have a more complex program. And it'll also take about 30 seconds longer if you're using a USB connection. Right here, you can see back on the addressing we have 18. And this is just because it is the absolute address. It is looking at the real address inside the program. Now, I'm going to set my it's already pretty much set up. Alt F9. It's already set. It's already checked. I'm ready to go. Hit OK. Let me take a moment and talk about these screens here. These are probably two of your best buddies. This one shows you the register values that are currently in use. And this one shows you the memory address that you can then look up and see what's going on in your memory. Back to IDEA. Sorry, back to back to our program. Let me hit F5. The breakpoint set. I expect it to actually break. And it did. Well, I actually know the program is running. Now, this debugger includes a really nice tool that you can see what's going on on my Pocket PC. So, you don't get kept in the dark. Here's what my serial program looks like. Now, I'm going to enter a value. I hit submit and again, I'll update the screen. So, you can follow along. Here we go. This is the serial number I entered. If I have no clue what it is, I'm just going to enter a value and see what happens. My breakpoint is hit and it stops the program. Here we are at 11288. If we look in IDEA, 11288 is the update data. So, let's start at that point and watch and see what happens in the program. And I move step by step. You hit F11. This will just move it to the next line of code. It's the best way to work through a program. One thing I should also mention is that you can see, I hope, that these are red. If it's red, then the value has just been changed. It's another important thing to keep an eye on so you can watch and see what's going on. I'm going to hit F11 here and it's going to load a value right into R1, the register 1. Now, you can take this value, copy it out of here, drop it right into your memory, hit enter, and there we go. My serial number is in the memory. It's part of the program. It's being used. We're watching what's going on. Now, here at the next line, basically what we're having is a string compare. It's checking the value of R0 which, let me hit F11. It's checking the value of R0 with the value 8. Now, anybody give me a guess what the value in register 0 is? Just yell it out. It's the length of our string. Four characters? We have a four character string right here. Alright? Now, let's see a little bit what's going on. And you'll get the idea of what's going on here the more you work with it. Here we have a compare opcode. We talked about this. It compares the value in R0 with the hardcoded value of number 8. R0 is 4, 8 is 8. If we hit F11, our flags down here should be updated accordingly. Which is not equal. So our 0 status flag is updated to the not equal status. And it's less than. So our negative status flag will be updated to 1. I'll hit F11. And you can see that that is what actually happened. I hope. Now we have a branch of less than and a branch of greater than. Now, the condition is met with a less than. So if I hit F11, it should bypass the rest of my serial validation. And I'm just going to hit F5 here. And I'm going to update the screen. And you can see that it gave us an error message right off the bat. So it's not long enough. Something's going on. Let's go back into the program. And start again. Now we know we want to come down to this point to compare. And the nice thing about a debugger is you can change the values in your register. So you can change the flow of the program as it is executing. It's a very useful tool to try and figure out how a program works. I'm going to change this value to 8. So now we have R0 equal to 8. And the value 8 being compared is going to come out in our favor. I hit F11. You can see the equal status flag is set. So these next two lines are going to be jumped right over. Now we have another load register. And this is loading a value into R0 from the stack. I hit the F11. And I check my memory. 1, 2, 3, 4, 5, 6, 7, 8. So here's our value. Even if I didn't catch it in the IDA, I can now catch it. There's my serial number. It's right in memory. Now this next line, 2A4, just so you can see what's going on, is right here. This is our string compare. 1, 1, 2, A4. I hit F11. And you can see that our status flags are updated. Now 1 equals fail. 0 equals 1 in this case. Here we have a value. Another memory value. 1, 1, 2, 2. So it's part of our serial number. If you work through this enough, you would see that this R1 equals the address of the character that failed. And then R2 equals the character that did fail. And R3 equals the character it should have been. So we don't use the string compare in any kind of serial check. Because I could simply work through this one character at a time, learning the serial number as I went and simply loop through it. And I have the serial number. Then it ends up on deluxe serials or something like that and not everybody has a serial number. Moving on, we overwrite R2 with a 0. Now we're moving R0 value, which is the 1, it's the status that was passed back from the string compare into R3. But we're updating the status flag after we do this. To control the rest of our program's flow. I hit F11. You can see that the value is 1. So the 0 flag is set to 0 because it did not equal 0. And the negative was left alone. Now the next two lines of code here are interesting because if you look at them, you can see that regardless of what happens, the value 1 or 0 is going to end up in R0. Now we've got to work through it and figure out what is controlling the program flow and why this R0 is so important. We hit F11. Hit F11 again. You can see now that R0 is used in the AND instruction. FF is being ANDed with the value in R0, which in this case is 0. So if it fails, if the string compare fails, the value 0 will end up in R0. That result ends up in R3. R3 equals 0. The status flags are updated because of that little S on the end to update the status flag. Hit F11 again. Now it's doing a load if the non-equal status is set. Our status flag is set because the equal status flag is set. So it's going to bypass this line. Hit F11, hit F5 just for convenience sake. Update the screen and now we have a different error message. So it looks like if we enter the wrong length serial number, we get one error message. If we enter the wrong serial number and it's the right length, we get a different error message. So that's a variation in the program. Hit OK. Hit submit. Now we're back into the beginning of the program again. Now I'm going to jump immediately down to compare. Except this time I'm going to show you something else that we can do. I'm going to let the compare update the status flags with the failed basically it's going to say less than. So I can overwrite these status flags too. I overwrite my negative status flag. I overwrite my 0 status flag. Now I have an equal status. So the next line of code to execute is going to look at oh it's equal, I don't need to execute. Hit F11, hit F11 and you can see it didn't jump. So again I just redirected the program flow on the fly. I'm going to bounce down to this point. As I discussed, the value in R0 controls what's going to happen here at the ands instruction. So since R0, I don't want it to equal 0 I want it to equal 1 because I want FF to be anded to 1 and then the resultant value 1 be written in R3 the status flags will be updated based on the 1 value. I hit F11 and that happens. Now the non-equal status is set. So I know that the value on the stack is going to be loaded into R1. I hit F11 again. Let's see what R1 well, you know what, I'll just hit F5. And you can see what R1 says. Correct serial number. Thank you for registering. So I just manually bypassed my serial check. And I could stop here because I just wanted to do it for myself. But now comes the point of a cracker where they're going to write a program and they're just going to automate this or they're just going to patch the program in the first place and just distribute that as the patched serial check. So let me see where I'm at here quick, catch you up. Here we do this is slides talking about what we just went through. The first crack, I'm just labeling it the sleight of hand because we're just going to trick the program because it's not true. And you can see that back in the compare in IDA right here right in this line we're comparing a value. Now how can we make this permanently in our favor? Well, R0, R0. Correct, here you go. Come up and get a CD. And I have a couple more things up here too if you do answer. Right, R0, R0. So you're comparing a value with itself. It's always going to be in our favor. That's the point of the code right here. I know you can't answer again. I'm only giving you one thing. We know that the value R0 if it's a 0 will end up basically controlling the program against our favor at this point. I'm sorry, if it's a 1 it will control the program against our favor at this point. So, we want to control this value right here. We want 1 to be moved into R0. And it's moved in here and it can be moved in here if we simply change this value to a 1. So to do that, let's start with the compare. We need to load up our hex editor. Here's the serial program. Load it up in UltraEdit. Page down. Now the point in IDA that we need to go to 294 This is the address in IDA. Now in the file itself it points to a different location. This is the value we actually need to This is the address line we need to locate. So 694, we need to change this compare from an 8 to an R0. And also change that one last hex character on the end because now we're moving a register into a register, not a hard-coded into a register. Open up UltraEdit and I think it was 694 694 is this line right here. You can see 8 once you get familiar with how the hex looks. You can kind of even figure you can read through a program like this. But 8's moved into R0 and this is to compare. So we need to change this 8 to a 0. And we need to change the fact that it's moving a hard-coded value into a register from a register into a register, so that's a 1. It takes care of our first point. Come down to this point in the program 2B4. We want to make this a 1. So at 2B4 or 6B4 right at this point this is a the move not equal. Make this value a 1. File, save as. I'm going to say this is serial number 1. Hit save. Copy it from my local file directory. Over to the start menu on my Pocket PC. Open it up on my Pocket PC so you know I'm not full of crap. Hit submit and update the screen. No serial number entered. Thank you for registering. So here's one way that you can crack a program. Now just like there are many ways to program there are many weaknesses in a program that can be exploited. And I'm going to show you a couple more. Right here we have the compare. We already looked at that. How about these two lines right here? Let's simply overwrite those lines so we don't have to worry about what happens at the compare. I'm going to jump back into this point. Here you updated the hex. This is kind of like a slide. You're basically nopping it. You're basically putting a non-operation in there. However, there is no nop instruction on the ARM processor. You have to kind of do a virtual nop. So to do that we simply just move a value into itself. Move a register value into itself. It won't do anything. It won't update the status flags. It's the perfect way to do it. Just for curiosity I put the 9-0 in there to see what happened. Because that's how you do a nop on an x86. And it came up with probably the opposite of a nop. Umololol's s blah blah blah. And that basically stands for unsigned multiple long if the LS status flag is set and then it updates the status flags with the result and value. Not a nop. So what do we have to do? Here we are. We're going to overwrite these values right here with our basically our virtual nop. So I'm going to jump over to my hex editor. I'm going to go to that point in the program which is 298 and that's 698. And right here we are. These two lines right here need to be changed. I'm going to make this a 0110 a 0 e 1 and that next line is the same thing. 10 a 0 e 1. Now I still need to patch this point down here. So I still need to go to 6 b 4 and change this 0 to a 1. 6 b Ah crud. You know what? I got to start with a fresh one. 6 9 4. Here we go. 0110 a 0 e 1 0 1 1 0 a 0 e 1 Come down to 6 b 4 and change this value right here to a 1. File Save as Sale number 2. Save. Copy it from our local over to our other side. And somebody's car alarm is going off. Update the screen so you can see it worked. Here we are. Sale number 2. Thank you for registering. Third one I'm going to show you. Since the rest of these have been kind of like after the fact, so if we could actually find the correct sale number before and use it for our validation without knowing it, that would be really handy. It's kind of like preventative maintenance so you don't have to patch anything else. And you can do that because right here at the string compare, we know that our correct sale is loaded into R0 and Okay. Okay, so here we are. We know our correct sale is loaded into R0. We know our value is loaded into R1, so why don't we just take this value right off the stack and load it right into register 1. That'll save us all the trouble of trying to patch anything because we'll have the correct sale number right from the get-go. To do that, that's at 68C. Open up my blank serial again. Jump down to 68C. Right here we are. Now we're loading the value C into our loading it from our stack pointer. Now this is register 4. I'm changing to the stack pointer or the rank, yeah the stack pointer which is actually 13 and that's represented by hex character D. So you don't have to change two characters. Hit file, save as, sale number 3. Save. From local. Update the screen. And there we go. Three different ways to crack the program in what? A whole ten minutes. I'm going to jump back to my slides now. Catch this up. Here is the actual code that I used. And I just included this so you can understand what not to do. The string is simply dumped into a string character. The serial number is dumped into a variable and so are the error messages. The update data is performed like we saw. And we have our little get length. And it just basically compares that value to 8 and that compare instruction where we're comparing our 0 to 8. The incorrect message length box is shown. If the serial is at least 8 characters, it's then validated. And you have another set of boxes that are shown depending on what you entered. There are again, the tools that we need to use are the disassembler, debugger, and hex editor. You've got to understand the ARM processor and the opcodes and registers. And to reverse it, you've got to find a point in. You've got to be able to watch execution, figure out what's going on, and then patch it if you prefer. Now, the spin on this is not always something like cracking a program. Earlier this week, I wanted to use my terminal services client on my Dell and I wanted to connect to a port other than the default 3389. If you ever looked that up on the internet, I don't think anybody really cared, you can't supposedly do it. And I'm like, that's bogus. I've got to be able to do it. So I went in, I found a point in the program where 3389 is actually hard coded into the terminal services client. I changed it to the port I wanted to, at which point I then discovered that the program actually writes a register key in and then through that, it's just as simple as adding a register key into your pocket PC and you can connect to any port. It's undocumented, I haven't found any other place online that it can be done, but you can use reverse engineering for things like that. Make a program better, change something that you don't like, get rid of timers, get rid of various things that you may not like to see in a program. Lots of sites, not a whole lot, but there are several sites out there. Chaos.net is one of the it's more the cracking side of things, but that's usually where technology is innovated and people start figuring stuff out as if they're the hackers. They get a lot of the stuff moving. DataWorm, again, he's got a lot of information and he did the IDT files, so he knows this stuff. The third line here, this is a great PDF. If you want a great intro and an understanding of how the op codes work, read this PDF because it has a lot of valid information in it. The rest of these have various importance. The armref.pdf that's a great reference sheet that gives you a list of the op codes and some of their hex comparisons and so on. And, of course, Arm has a lot of manuals and AirScanner. Anyway, I guess I am done early. I'm opposed to tell you that you have to clear out because the next line is already really long and that's really all I have to say. If you have questions, I'm going to go out by the pool so the next crowd can get in here a while. So, thank you for your time.