1 00:00:00,000 --> 00:00:06,040 So, uh, welcome. Thank you for coming. Uh, this is, uh, a talk on reversing and exploiting 2 00:00:06,040 --> 00:00:09,940 embedded devices. You know, just in case that wasn't obvious. So, let's just get going. Let's 3 00:00:09,940 --> 00:00:12,960 just get started with this. But, actually, before I get started, I have one question. Who 4 00:00:12,960 --> 00:00:19,940 here has actually done exploitation on embedded devices, either MIPS or ARM? Awesome. Did 5 00:00:19,940 --> 00:00:26,260 you take that POC all the way to Code Exact? Awesome. Cool. So, that's what we'll be 6 00:00:26,260 --> 00:00:30,900 talking about here, too, as well. Like, uh, so, anyways, let's get started. So, this is the 7 00:00:30,900 --> 00:00:34,740 outline for my talk. It's a little hour, it's about an hour long or so, but I'm going to go 8 00:00:34,740 --> 00:00:38,480 through it a little bit quickly. Um, I've, I've done this talk before, but kind of, like, 9 00:00:38,520 --> 00:00:42,200 scaled it back on the technicalities, but since this is DEF CON, we're going to go full 10 00:00:42,200 --> 00:00:45,540 technical for a little bit. So, this is the outline. I'm not going to go through it, but 11 00:00:45,540 --> 00:00:48,840 let's just say we're going to get a little technical, and after this, we're going to go on 12 00:00:48,840 --> 00:00:53,400 an adventure to actually take the stuff that's in this talk and find our own ODays and 13 00:00:53,400 --> 00:00:56,240 products in today, and that's what we'll be doing tomorrow. But, who here has actually 14 00:00:56,260 --> 00:00:59,760 joined us? Who am I, right? Like, who's this kid up there wearing all black? So, my name's 15 00:00:59,760 --> 00:01:03,360 Elvis, real name, and I love how everyone's cell phones started going out and taking 16 00:01:03,360 --> 00:01:08,180 pictures when I, when I said that. I'm a senior security researcher at a local pen testing 17 00:01:08,180 --> 00:01:13,420 firm in Austin, Texas called Praetorian. I got into IoT research completely by accident, 18 00:01:13,580 --> 00:01:18,540 right? I started off in desktop space, and this whole IoT embedded device, device stuff got 19 00:01:18,540 --> 00:01:22,940 just completely by accident. The long, the long story that's short was that I had a 20 00:01:22,940 --> 00:01:26,220 coworker who found a vuln, a really nasty vuln. It took him three seconds to find it with 21 00:01:26,260 --> 00:01:31,020 a really dumb fuzzer, and I said, if you can do it, why can't I? And, now I'm in this trap. 22 00:01:31,220 --> 00:01:36,120 So, um, I'm also known as Black Owl on Twitter. That's cool. So, let's get started. So, like I 23 00:01:36,120 --> 00:01:39,900 said, I found some bugs, because I got competitive with a co, a former coworker of mine who 24 00:01:39,900 --> 00:01:43,280 found bugs really, really easily, high impact bugs that was affecting the entire SDK of the 25 00:01:43,280 --> 00:01:48,880 manufacturer. So, I just did the same thing. I was fuzzing, HP daemon, everything I think of, 26 00:01:48,940 --> 00:01:54,980 the method, the URI path, HP 1.0, 1.1, 0.9, host with long everything, maybe tons of new 27 00:01:54,980 --> 00:01:55,920 lines, no new lines. 28 00:01:56,260 --> 00:02:00,660 Everything I could think of. The UPnP interface was so, all the methods I could think of. 29 00:02:00,680 --> 00:02:05,040 Anything that takes a string. Let's put command injection. Let's put 3000 A's. Nothing was 30 00:02:05,040 --> 00:02:10,380 happening. My device was all happy dory going, no problem, man. We got this. So, then I started 31 00:02:10,380 --> 00:02:14,220 taking it further. I was like, well, what about, like, directory traversal, maybe pull some files. 32 00:02:14,360 --> 00:02:19,180 We do double percent encoding, next characters. So, we can do, like, percent 25, uh, 41 for, 33 00:02:19,200 --> 00:02:22,560 like, capital A. Or, let's just do all these crazy things, or command, let's just fuzz 34 00:02:22,560 --> 00:02:26,240 everything. But, nothing was working. So, what did work was, I had to, I had to, I had to, I had 35 00:02:26,240 --> 00:02:33,300 to sit down. I took the firmware completely apart with binwalk, which is fantastic. And, I 36 00:02:33,300 --> 00:02:38,760 found hidden APIs that you would never find on the front end by fuzzing, by disassembling this, 37 00:02:38,860 --> 00:02:42,960 that was inside the binary itself. You would not find it in the file system, it was inside the 38 00:02:42,960 --> 00:02:47,980 binary itself. And this particular one was, it would take the, the value from submit URL and 39 00:02:47,980 --> 00:02:54,400 pass it straight to system. Pretty dope. So, digging into firmware. So, like I said, 40 00:02:54,460 --> 00:02:55,860 fuzzing stuff on the outside. 41 00:02:56,340 --> 00:03:00,520 May just only get you on the surface. Some of the nasty stuff that you want to get into is going to 42 00:03:00,520 --> 00:03:04,620 be deep. You're going to have to dig for it. So, extracting firmware binaries. Who here has heard 43 00:03:04,620 --> 00:03:12,400 of binwalk? Yes! Awesome! Binwalk is an amazing tool. It's long, like, a very, very high level 44 00:03:12,400 --> 00:03:17,500 what binwalk is. It's a magic byte parser and extractor. That's all it does. If you look at the 45 00:03:17,500 --> 00:03:22,960 configuration files for binwalk, it is just using libmagic. Offset this, this is the byte, like, 46 00:03:22,960 --> 00:03:27,320 cafe bay for, like, Java, right? And it just goes through the entire structure. It's supposed to be 47 00:03:27,320 --> 00:03:31,520 matching the entire structure up before doing any kind of extraction. If there's any kind of 48 00:03:31,520 --> 00:03:34,980 false positives inside of that and when you see the word invalid for this kind of stuff, it's 49 00:03:34,980 --> 00:03:39,300 supposed to be reducing false positives. So, that's binwalk in a nutshell. Very, very simple, 50 00:03:39,440 --> 00:03:44,320 straightforward, but it's super powerful. But it can also be annoying if you're dealing with dumps 51 00:03:44,320 --> 00:03:48,920 that are not particularly organized properly and binwalk just goes crazy and just says 52 00:03:48,920 --> 00:03:52,940 everything's an LZMA block. So, great. So, we can extract, we can extract, we can extract, we can 53 00:03:52,960 --> 00:03:55,420 extract firmware that we can download off the internet that's not encoded or anything like 54 00:03:55,420 --> 00:03:59,560 that. Fun fact, a lot of encoding stuff is usually, like, single byte or multi-byte XORs, so 55 00:03:59,560 --> 00:04:05,700 don't worry there. Um, so, when I got into embedded devices, wow, that's a lot of people. 56 00:04:05,860 --> 00:04:11,580 What's up, guys? Um, the one thing I didn't know was the assembly for it. I started off in 57 00:04:11,580 --> 00:04:17,300 x86, 64 land. I didn't know MIPS assembly, like, what the hell's a branch, what the hell's all 58 00:04:17,300 --> 00:04:21,740 this stuff? But what I did know was C. And I was like, well, let me just do exactly what I did in 59 00:04:21,740 --> 00:04:22,940 x86. All right. So, I was like, well, let me just do exactly what I did in x86. All right. So, I 60 00:04:22,960 --> 00:04:24,960 was like, well, let me just do exactly what I did in x86. All right. So, I'll just create C, compile 61 00:04:24,960 --> 00:04:30,100 it, maybe with some different flags, see what else comes out, and then just step through it. So, 62 00:04:30,140 --> 00:04:36,200 this is exactly what I did. So, right here, I have a local, uh, integer called red, red val. And 63 00:04:36,200 --> 00:04:40,660 it is initialized to zero. And in MIPS, we have a dedicated register called zero. It's just 64 00:04:40,660 --> 00:04:45,620 always null. So, right here, I know that we have something called store word, zero to offset 65 00:04:45,620 --> 00:04:51,720 24 of S8. 24 S8, S8 is also known as a frame pointer, also known as EBP, if you want to say. So, 66 00:04:51,760 --> 00:04:52,940 we are now, we, we know we're in the middle of something. So, we're in the middle of something. 67 00:04:52,940 --> 00:04:57,740 So, we're in the local, uh, local variable for this function. Great. So, I know S8, and I know 68 00:04:57,740 --> 00:05:04,340 the, the offset for that, uh, for that value. So, we go further. What about calling functions? How 69 00:05:04,340 --> 00:05:09,220 do arguments get passed in this, uh, in this, uh, in this architecture? So, the very first one, 70 00:05:09,240 --> 00:05:17,240 I pass hex 44, which in base 10, would be 68. And then second, uh, argument, which is A1, which 71 00:05:17,240 --> 00:05:22,320 is hex 65 or 101 in decimal, which is A1. Great. So, now we know when we're calling a function, 72 00:05:22,420 --> 00:05:22,920 those A1s, those A1s, those A1s, those A1s, those A1s, those A1s, those A1s, those A1s, those A1s, 73 00:05:22,920 --> 00:05:24,960 those A1s, those A1s, those A1s, those A1s, those A1s, 0, A1, A2, 3, I'm 74 00:05:24,960 --> 00:05:28,080 going to be pointing to the arguments I'm going to pass to this function. Great. This is super 75 00:05:28,080 --> 00:05:32,360 simple. So, now we know, like we're, you know, initializing happens. I know where arguments get 76 00:05:32,360 --> 00:05:37,160 passed. What about return values, right? So, I have this function called test. And I do a 77 00:05:37,160 --> 00:05:42,300 ret sixty-six or whatever it is, right? Well, remember that same offset, 24, that we solved 78 00:05:42,300 --> 00:05:46,840 for the beginning. That's ret val. So, now we know v zero whenever a function returns. It's 79 00:05:46,840 --> 00:05:52,120 gonna contain a value return from the previous function. Cool. And then we do it again, printf. 80 00:05:52,120 --> 00:05:56,300 second argument is going to be an A1 because the first argument is the format string right? 81 00:05:57,240 --> 00:06:02,240 And then we just keep going and then it's the final one where we finally return from main and 82 00:06:02,240 --> 00:06:10,280 I put a D word in there 43 all capital C's right? So we have an LUI of 2 bytes and an ORI of 83 00:06:10,280 --> 00:06:16,080 2 bytes and I was like alright that's kind of cool but what is actually ORI doing because I 84 00:06:16,080 --> 00:06:18,460 don't feel like reading the assembly manual right now and I just kind of want to see what's 85 00:06:18,460 --> 00:06:23,100 going on. So it's everything we've always done when we're trying to learn new assembly stuff, 86 00:06:23,220 --> 00:06:27,520 we just set the breakpoint, we make sure step mode is on, we step one to make sure that 87 00:06:27,520 --> 00:06:32,400 instruction was executed, we double check to make sure the execution happened, we check the 88 00:06:32,400 --> 00:06:37,620 value. So now we know when LUI 2 bytes happen the greatest significant 2 bytes of that 89 00:06:37,620 --> 00:06:45,460 register will be that value. And then the lowest significant bytes, this is an ORI so it's an 90 00:06:45,460 --> 00:06:47,820 OR integer but the lowest significant since it was null, 91 00:06:48,580 --> 00:06:52,660 4343 gets populated and the whole D word gets populated into that register. Why did it have to 92 00:06:52,660 --> 00:06:57,460 do 2 instructions? Some people in there if you don't know I just want to say it, this is MIPS 32 93 00:06:57,460 --> 00:07:02,200 bits MIPS 1 it's 4 byte instructions. So every single 4 bytes is going to be a different 94 00:07:02,200 --> 00:07:07,980 instruction so that's why you can put 4 bytes for your operands to the opcode. Cool. So this is 95 00:07:07,980 --> 00:07:12,860 kind of, you know, kind of like annoying you can say it takes time, you're going to sit down, 96 00:07:13,040 --> 00:07:18,280 make some coffee, not get distracted by Mr. Robot or whatever you're watching. So what about, 97 00:07:18,460 --> 00:07:23,100 making our lives easier? We want to find vulns, right? It's our jobs, it's what we want to do, we 98 00:07:23,100 --> 00:07:27,360 want to pop shells, we just, that's all we want to do. So I learned about something called GPL, 99 00:07:27,480 --> 00:07:32,280 the General Public License, right? So when I was reading from it at a high level I was like if 100 00:07:32,280 --> 00:07:37,440 you license your binary in your source everything on a GPL you have to publish it. The source has 101 00:07:37,440 --> 00:07:40,140 to be out there. If it's on a GPL and you're like no I'm not going to give you the source, 102 00:07:40,240 --> 00:07:47,280 that's a violation. So what if I take, I don't know, vendor A into Google and type in source code? 103 00:07:48,040 --> 00:07:48,440 Cool. So I'm going to take vendor A into Google and type in source code. Cool. So I'm going to take 104 00:07:48,440 --> 00:07:51,960 vendor A into Google and type in source code. Cool. This is all the tar balls for that device. 105 00:07:52,100 --> 00:07:57,820 If you download this tar ball and if you modify a little bit with the symbolic links inside it 106 00:07:57,820 --> 00:08:02,620 because sometimes they break, you can compile your own binary for that device. It will upload and 107 00:08:02,620 --> 00:08:09,180 all that good stuff which is what I did on this one. What about smart TVs? Complete source code is 108 00:08:09,180 --> 00:08:14,140 on there too. No need to take it apart and probe the flash chip on the SPI interface. Don't do 109 00:08:14,140 --> 00:08:18,380 that. Complete source code is in there. And you may find some old libraries, maybe web 110 00:08:18,380 --> 00:08:26,880 kit is old on there. I don't know. And last vendor. Again, GPL. It's vendor name. All there. 111 00:08:27,380 --> 00:08:33,500 Very, very straight forward and everything is documented beautifully. I love these guys. So it 112 00:08:33,500 --> 00:08:38,320 goes on and on, right? It goes on and on and on and you'll run into two different types of like 113 00:08:38,320 --> 00:08:43,540 GPL codes with this type of devices. You'll have your Linux boxes and then your RTOS boxes and 114 00:08:43,540 --> 00:08:48,180 they're completely different and I'll talk about that a little bit more on but yeah. So I 115 00:08:48,180 --> 00:08:52,740 talked a little bit about software, how to get into it, how I taught myself how to like you know, go 116 00:08:52,740 --> 00:08:56,940 over the hurdles of learning assembly so I can actually read this stuff and interpret what I'm 117 00:08:56,940 --> 00:09:01,520 reading. What about the hardware, right? It's like when I started getting into it, I exhausted 118 00:09:01,520 --> 00:09:06,000 the software stack completely at one point. I'm, I'm completely stuck. I have to start opening 119 00:09:06,000 --> 00:09:11,700 this stuff up. So the thing is though, you have different levels of like, I don't know, you can 120 00:09:11,700 --> 00:09:18,160 say uh, advancedness. You can build a super dream of your lab, you know, super lab of your dreams and you're 121 00:09:18,180 --> 00:09:23,100 dropping acid on chips and doing all this crazy stuff. You don't really need that. Majority of 122 00:09:23,100 --> 00:09:30,160 the things that I do use this, maybe some of these, and that's about it. Hold on, let me go 123 00:09:30,160 --> 00:09:39,180 back. Sorry. And maybe some of those. Yeah, cool. So, what I wanted to say is that the barebone 124 00:09:39,180 --> 00:09:43,940 stuff, it says $95 to $100 or whatever, but that's the biggest chunks from the multimeter and 125 00:09:43,940 --> 00:09:48,240 the soldering iron itself, right? If you have friends or just have them laying around, that's 126 00:09:48,240 --> 00:09:52,340 your biggest chunk that's going to go away. The JTAGulator, that's a controversial topic in my 127 00:09:52,340 --> 00:10:00,520 opinion because if you go under the JTAG Enum project for the Arduino Nanos, which is, in my 128 00:10:00,520 --> 00:10:09,360 bag, which I have, you can build yourself a JTAGulator basically for about five bucks. So, 129 00:10:09,440 --> 00:10:13,760 these things, right? Have you ever seen like an Arduino, these little five, three 130 00:10:13,760 --> 00:10:13,920 dollars, you can build yourself a JTAGulator basically for about five bucks. So, these things, 131 00:10:13,940 --> 00:10:18,680 all the cheapy things from eBay, right? Um, if you look at the JTAGulator source, you can see that 132 00:10:18,680 --> 00:10:23,360 there's a comment saying that the, the logic from it was actually pulled from the JTAG Enum project 133 00:10:23,360 --> 00:10:28,140 for the Arduino Nano. Cool. So, the same logic is in there too. What's the difference though? Like, 134 00:10:28,160 --> 00:10:31,820 why is that so expensive and you can do this whole thing? You can't do voltage control on 135 00:10:31,820 --> 00:10:35,180 this. I can't say, alright, give me 1.8 logic for your software. It's not going to work like 136 00:10:35,180 --> 00:10:39,440 that. This is 3.3. So, I would have to make my own like, like logic converter or like some sort of 137 00:10:39,440 --> 00:10:43,140 shield. So, that's where the other thing comes into play. So, that's where the JTAGulator comes 138 00:10:43,140 --> 00:10:43,920 more like friendly and stuff like that. So, that's where the other thing comes into play. So, that's 139 00:10:43,920 --> 00:10:44,780 where the other thing comes into play. So, that's where the other thing comes into play. So, 140 00:10:44,780 --> 00:10:49,500 I'll talk, I'll talk about that another time we're offline. And then the logic analyzer is 141 00:10:49,500 --> 00:10:54,700 fantastic because I've seen so many boards where I go, what the hell does this test point do? 142 00:10:54,940 --> 00:10:59,700 Where does it go? I can't figure it out. Hook up the logic analyzer, do a quick sample, 143 00:10:59,840 --> 00:11:03,900 analyze what you see and just go forward from there. So, guessing, probing stuff with a 144 00:11:03,900 --> 00:11:09,540 multimedia at a very low sample rate. You're going to go crazy because I did. So, finding UART. 145 00:11:10,520 --> 00:11:13,900 So, UART in a nutshell, right? Most people in here most know UART. You know, UART is 146 00:11:13,900 --> 00:11:18,240 basically, just think of it like telnet RSH. You got a command line or it's just a serial 147 00:11:18,240 --> 00:11:22,620 output from the device. So, what about finding this kind of stuff without opening the device? 148 00:11:22,780 --> 00:11:26,060 What if I bought some $300 device and I go, I don't want to open it up. So, what if I break it? 149 00:11:26,180 --> 00:11:31,620 Because I will, right? So, every single wireless device, at least in the states, has to go 150 00:11:31,620 --> 00:11:35,380 through something called FCC qualifications. Has to be tested. If it's wireless, does radio, has 151 00:11:35,380 --> 00:11:42,640 to be qualified. So, you take this number called the FCC ID. You go on FCC's website. Click a 152 00:11:42,640 --> 00:11:48,880 little button called internal photos, which is great. And you get the complete PCB, front and 153 00:11:48,880 --> 00:11:54,960 back, up and down, left, right, Konami code. Awesome. And right there, like this is, like not 154 00:11:54,960 --> 00:11:59,400 all the time, but this is a very good hunch. When you see a rows of pins like that, like those 155 00:11:59,400 --> 00:12:03,560 five pins I highlight right there, it looks like something that may be useful for development or 156 00:12:03,560 --> 00:12:07,020 testing. I don't know, it kind of looks like a shell interface and the one below that may be 157 00:12:07,020 --> 00:12:11,840 some sort of JTAG interface to test like the processor or anything that's in the JTAG chain. But 158 00:12:12,640 --> 00:12:16,460 it's efficient. So, I go, that's UART maybe, so let me go probe and test it out. Uh, and 159 00:12:16,460 --> 00:12:22,500 spoiler alert, it was. Cool. So, that was some easy ways. But, one thing I really want to 160 00:12:22,500 --> 00:12:31,000 stress. Don't make the same mistakes I did. Find your ground first. I have had too many 161 00:12:31,000 --> 00:12:36,460 smoke shows or too many, ugh, moments when I'm just like, uh, yeah, that should be fine. 162 00:12:38,980 --> 00:12:42,580 Shit. So, find your ground first. The one, the one thing that I like to do, uh, is 163 00:12:42,640 --> 00:12:45,940 like, I find common grounds. Like, this is like a, a shield, there was a shielding over it and I 164 00:12:45,940 --> 00:12:49,940 took it off. I found it to be a common ground. But, like, USB casings on the outside, they're 165 00:12:49,940 --> 00:12:54,140 usually grounded. Just find yourself a common ground point. Uh, if you'll flip on the back, 166 00:12:54,240 --> 00:12:58,680 you'll see also casing groundings for like, uh, anything, any kind of ports. Find a ground and 167 00:12:58,680 --> 00:13:06,420 then don't use continuity mode. I used to say that and I was dead wrong. And this is why. When 168 00:13:06,420 --> 00:13:10,980 you use continuity mode, you know, the one where you say, alright, is A connected to B and it makes 169 00:13:10,980 --> 00:13:16,500 a noise, right? That's pumping voltage through it. And I hooked up my logic analyzer and this 170 00:13:16,500 --> 00:13:22,120 was me moving the dial. So, we got some noise. And the multimeter in continuity mode pumps out 171 00:13:22,120 --> 00:13:28,200 1.6 volts. Continuous. So, if we have any kind of fuses that are very, very sensitive or 172 00:13:28,200 --> 00:13:32,140 anything else that may blow that's over 1.6, I don't really see anything that's, you know, says 173 00:13:32,140 --> 00:13:38,080 I can't handle anything over 1.6. But, we just want to be careful. So, instead, we use 174 00:13:38,080 --> 00:13:40,960 resistance mode. Resistance doesn't do voltage, uh, resistance doesn't do, uh, resistance mode. 175 00:13:40,980 --> 00:13:46,160 It doesn't pump out 1.6 volts like we saw before. So, all we need to do is to say if A connects to 176 00:13:46,160 --> 00:13:50,680 B, we look through resistance. If it's absolute zero, they're connected. Awesome. Or have no 177 00:13:50,680 --> 00:13:54,300 resistance in the middle. So, yes, they're connected. Great. So, that's how I find ground now 178 00:13:54,300 --> 00:13:59,580 is by using resistance because I did, I was using the wrong way and, um, learned that I could blow 179 00:13:59,580 --> 00:14:05,020 stuff up. But you are in a nutshell, right? We got transmit to receive and a common ground. 180 00:14:05,200 --> 00:14:08,500 There's no clock. It's going to be like some sort of like, I think it's like asynchronous or 181 00:14:08,500 --> 00:14:10,960 something like that where you have to like tell it. Um, so, I'm going to show you how to do it. 182 00:14:10,980 --> 00:14:14,160 So, basically, think of it like a phone call. You talk to somebody and you hear it. The end. But 183 00:14:14,160 --> 00:14:19,600 now you have to figure out how tall, how fast it's talking. So, there's methods of finding the 184 00:14:19,600 --> 00:14:25,900 baud rate for these UART devices and it's annoying. I don't like brute forcing UART 185 00:14:25,900 --> 00:14:33,320 interfaces. Is it 9600? No. Do you attach 33, 400 or something like that? No. So, instead, we 186 00:14:33,320 --> 00:14:39,080 take a 20-second digital capture and if anyone's used a logic analyzer, you'll know that digital 187 00:14:39,080 --> 00:14:40,960 captures are very, very, very tiny. So, instead, we take a 20-second digital capture and if anyone's 188 00:14:40,980 --> 00:14:42,400 used a logic, you'll know that they're very small. So, if this was an analog capture, it'd 189 00:14:42,400 --> 00:14:49,200 probably be in the gigs. But this is like a 20K file, right? So, this is ambiguous so, uh, let's 190 00:14:49,200 --> 00:14:53,780 just use our CSI cyber skills and we enhance this photo really well. And what I'm looking for 191 00:14:53,780 --> 00:14:57,720 here is something called the shortest width bit. Doesn't have to be the exact one but I'm 192 00:14:57,720 --> 00:15:01,100 looking for when the falling edge and the rising edge happen again. What's the distance between 193 00:15:01,100 --> 00:15:07,960 that? So, this one is 8.8 microseconds. So, okay. Cool. You found that. What can we do with 194 00:15:07,960 --> 00:15:10,960 that? So, if we take that 8.8. Will that catch me? Well, looks like we used it the last time. Прек utilización 195 00:15:10,960 --> 00:15:14,300 point eight and we take one second over eight point eight divided by a million whatever 196 00:15:14,300 --> 00:15:18,920 the uh measurement for that is. We get eleven three six three six three six three six. We're 197 00:15:18,920 --> 00:15:24,300 gonna round it to our uh standards which is eleven five two hundred. But just for fun I'm 198 00:15:24,300 --> 00:15:28,620 like you know the logic uh the SLA logic analyzer comes with a uh different kind of 199 00:15:28,620 --> 00:15:32,140 analyzers that come in with it. This is called the serial one. So I said this is the baud rate. 200 00:15:32,280 --> 00:15:35,980 I want you to analyze this signal and see if anything comes out. And it comes back saying 201 00:15:35,980 --> 00:15:41,480 this particular segment is the word start and there's a space. Cool. So now I know the 202 00:15:41,480 --> 00:15:46,820 transmit pin on the device. I know the ground and I know the baud rate. The receive. Don't 203 00:15:46,820 --> 00:15:51,840 hate me but I brute force my way around. Until something clicks. Click here. Enter enter 204 00:15:51,840 --> 00:15:58,200 enter. Nope. Next one. Alright. Talked about UART. So how about JTAG? So what the hell is 205 00:15:58,200 --> 00:16:02,000 JTAG? What is it for? I've heard JTAG. I've heard people use JTAG blah blah. What can you do 206 00:16:02,000 --> 00:16:05,960 with it? It's literally a testing like it's a what was it? It's a test. It's a test. It's a 207 00:16:05,960 --> 00:16:10,680 testing suite. It's supposed to be made for quick easy ways to diagnose hardware problems 208 00:16:10,680 --> 00:16:16,000 without sitting down and probing everything. So this is great. But it has a lot of 209 00:16:16,000 --> 00:16:20,480 functionality. So what we have here is something called a tap interface. The tap 210 00:16:20,480 --> 00:16:26,780 interface connects to the insides of the actual logic of the chip. It's a little bit 211 00:16:27,260 --> 00:16:31,020 complex. I'm not 100% there so I'm not going to try to BS my way around. But I do understand 212 00:16:31,020 --> 00:16:35,900 this which is the state machine of JTAG. So basically when we have lines the lines 213 00:16:35,960 --> 00:16:42,340 here are going to represent our mode select TMS and then the TCK, the clock is going to 214 00:16:42,340 --> 00:16:50,440 indicate when we go from next step to next step to next step. Right? So let's say that I'm at run 215 00:16:50,440 --> 00:16:57,260 test idle. If TMS is high and the clock happens one more time the TMS will move over there. So 216 00:16:57,260 --> 00:17:03,540 now I'm at select DR scan or data register. So this is how the state machine works. And if I 217 00:17:03,540 --> 00:17:12,400 keep TMS high it will go all the way up to test logic reset and correct me if I'm wrong 218 00:17:12,400 --> 00:17:17,400 but based on what I've seen there's no TDI needed for this and you'll get the ID code. TDI 219 00:17:17,400 --> 00:17:21,380 stuff when you start doing bypass scans and you're filling every register up with I believe 220 00:17:21,380 --> 00:17:26,960 ones to put into a bypass state, that's a different thing. But we'll go into that, later sorry. 221 00:17:27,580 --> 00:17:33,180 So locating the flash chip. So what if you find UART and it's password protected and you can't brute 222 00:17:33,180 --> 00:17:36,340 brute force it because brute forcing the root password takes like 3 seconds for every 223 00:17:36,340 --> 00:17:40,680 attempt. That's slow right? So what if you also can't download the firmware when it's not 224 00:17:40,680 --> 00:17:45,480 public? It's some sort of like proprietary device right? So now this is where we start 225 00:17:45,480 --> 00:17:48,880 getting nitty gritty. So let's start comparing this to computers. This would be the hard 226 00:17:48,880 --> 00:17:55,880 drive. So we just find out what who makes this particular chip. We use Google cause you 227 00:17:55,880 --> 00:18:00,960 know I'm pretty smart like that. And then we pull up our chip. And the main things I'm 228 00:18:00,960 --> 00:18:05,860 looking for is basically where are the interfaces that I can talk to, the input and output and 229 00:18:05,860 --> 00:18:09,920 what commands can I send it in order to extract data. And also how can I put it in the right 230 00:18:09,920 --> 00:18:13,320 protect state so I don't erase something. Kind of like a floppy disk when you have that thing 231 00:18:13,320 --> 00:18:18,960 right? So the thing is though with this is that with chips, with these flash chips they are 232 00:18:19,480 --> 00:18:24,600 like a slave. When a master chip says I want to talk to you or mine I select you. That is 233 00:18:24,600 --> 00:18:30,040 it. You cannot have another probe into it and talk to your chip. It's 1 to 1. So what 234 00:18:30,960 --> 00:18:35,400 happens is when you're actually um pulling the chip off or you're actually trying to dump 235 00:18:35,400 --> 00:18:38,860 everything. So there's two ways right? Some people like to be non-instructive and want to keep 236 00:18:38,860 --> 00:18:42,900 the chip on the board. And that's a perfectly good way of doing it. And this is how you can do 237 00:18:42,900 --> 00:18:46,760 it. There's a, there's a thing called like a, it's an SOIC and then the number. Like this 238 00:18:46,760 --> 00:18:51,620 one's 8, there's 16. There's also like uh breakout boards that you can buy and put the chip in 239 00:18:51,620 --> 00:18:55,460 here and have a huge breakout you can put into a breadboard and do whatever you want. Um but 240 00:18:55,460 --> 00:18:58,960 this, also this way. But the problem with this one is that you have to provide power to the 241 00:18:58,960 --> 00:19:00,940 chip. Cause it's not going to turn on, on like the chip itself. It's not going to turn on like 242 00:19:00,960 --> 00:19:06,140 magic right? But you may turn on other devices around it and you may put the, the chip into a 243 00:19:06,140 --> 00:19:10,840 select mode. So that's not good. So what can we do without removing the chip? Find the reset 244 00:19:10,840 --> 00:19:15,880 pin on the, on the processor. Either ground it or put it high, whatever data set says. Then 245 00:19:15,880 --> 00:19:20,100 turn on the device fully. The device will not do anything at all. And you should be able to 246 00:19:20,100 --> 00:19:23,820 communicate with JTAG and everything else. Because if the dri- like there's been devices as 247 00:19:23,820 --> 00:19:27,060 well where you see JTAG for one second and then initialize everything goes away. This is 248 00:19:27,060 --> 00:19:30,880 because the driver's doing it. So if you put into reset state everything should be 249 00:19:30,880 --> 00:19:35,180 communicate, should communicate perfectly fine. So that's how you can do it without removing 250 00:19:35,180 --> 00:19:41,720 it. But I remove everything um just because I like to do that. So that was um a flash chip 251 00:19:41,720 --> 00:19:46,100 that's serial. I've been playing around with these things and I'm pretty sure these things 252 00:19:46,100 --> 00:19:51,800 were made by the devil. These, these are known as NAND flash chips and they do everything in 253 00:19:51,800 --> 00:19:56,540 parallel. And uh I have a dump here and I'll, it's offline, it's not on my, it's not on my 254 00:19:56,540 --> 00:20:00,800 slides. And I'll show you the, the hardships I've been having with this. With all the blocks, 255 00:20:00,800 --> 00:20:06,440 and organizing everything. And that arrow's not pointing anything. But this is basically how I 256 00:20:06,440 --> 00:20:11,300 hooked it up. This is a FT2232H and there's all these white papers, there's a black hat talk on 257 00:20:11,300 --> 00:20:16,120 it. You can look it up. It's super, super simple. And this is how it works. You hook it up, 258 00:20:16,140 --> 00:20:20,500 you turn it on and there's a tool out there called dump flash and you say give me the ID code 259 00:20:20,500 --> 00:20:25,320 and it gives you everything. Gives you the page count. And extracting this 2 gig thing took 12 260 00:20:25,320 --> 00:20:30,780 hours. Super fast. So this is the thing as well, what I was talking about BIM 261 00:20:30,800 --> 00:20:35,380 walk earlier. This thing, the blocks are all over the place so I'm trying to figure out how the 262 00:20:35,380 --> 00:20:39,600 microcontroller wrote to the NAND flash so I can reorganize everything. Running BIM walk against 263 00:20:39,600 --> 00:20:46,460 it goes that for about 5 minutes. LZMA, LZMA, LZMA. Yeah, no. So that's the only thing about 264 00:20:46,460 --> 00:20:50,740 NAND flash. With SPI flash running BIM walk on it, done. It's serial. But once you have started 265 00:20:50,740 --> 00:20:55,760 having parallel uh flash memory it starts getting really complicated cause it's not all nice and 266 00:20:55,760 --> 00:21:00,500 laid out. So exploitation. So all this software hardware stuff, alright cool we've heard a million 267 00:21:00,500 --> 00:21:05,620 times. Let's actually break some stuff right? That's what we're here for. So one thing I've 268 00:21:05,620 --> 00:21:11,260 noticed a lot. So a lot of red teamers will probably know this as well. Developers love to 269 00:21:11,260 --> 00:21:16,920 keep debug code in production stuff. Why? There's no TV, there's no monitor hooked up so who 270 00:21:16,920 --> 00:21:21,860 cares right? So when I first found a vuln and I you know made the crash, this came out out of 271 00:21:21,860 --> 00:21:27,260 UART. And it said your return address is 43-43-43 and your program counter is at 2. Cool, 272 00:21:27,300 --> 00:21:30,480 so now I know my offsets all off the bat. So, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, 273 00:21:31,060 --> 00:21:37,040 just to verify I did it again. So look for uh debug code for signal catchers. It's probably in 274 00:21:37,040 --> 00:21:41,780 there. So you don't have to like cross compile GDB and attach and all that good stuff. So analyze 275 00:21:41,780 --> 00:21:45,180 the crash. So like you know it's the same thing over and over again just like x86. Analyze the 276 00:21:45,180 --> 00:21:49,060 crash, find your offsets and put everything into place and everything will work. So analyzing 277 00:21:49,060 --> 00:21:53,880 function returns. This is how I taught myself all this stuff like I said before. So we have the 278 00:21:53,880 --> 00:21:59,080 same program, two architectures. We have x86. All this is doing is just calling stir copy, 279 00:21:59,080 --> 00:22:04,020 taking argument value 1 and just throwing it into like a stack buffer of like I don't know it's 280 00:22:04,020 --> 00:22:09,220 really really small. And then uh and then it prints out some stuff and then it returns right? 281 00:22:09,300 --> 00:22:15,460 But then we have leave and ret. So leave, so EBP and ESP should be switched I believe. And 282 00:22:15,460 --> 00:22:20,380 then we have ret. So then we have whatever ESP is pointing to it's going to pop those 4 bytes 283 00:22:20,380 --> 00:22:28,520 into EIP and move over plus 4. Cool. So MIPS. Same thing. Load word RA from some offstat or 284 00:22:28,520 --> 00:22:33,080 some offset from the stack. RA is return address. In MIPS we have a dedicated register for 285 00:22:33,080 --> 00:22:38,440 return addresses. Load word frame pointer from this thing. Same thing. It's like leave. So we 286 00:22:38,440 --> 00:22:45,380 have the same thing. Restore the frame pointer, restore the stack and then jump RA or ret. So 287 00:22:45,380 --> 00:22:50,780 it's then having the instructions and one thing is broken out. Load it and then jump. Cool. 288 00:22:52,520 --> 00:22:58,500 So x86 and now ARM. So let's see what we've got here. So we've got an x86 and an ARM. So 289 00:23:00,140 --> 00:23:07,580 ARM is a very special architecture. That's all I'm going to say. So going from MIPS to ARM is a 290 00:23:07,580 --> 00:23:11,700 little bit different. Um but basically the same thing is going to be the same. The same thing. 291 00:23:11,760 --> 00:23:17,540 Function return and entry and yada yada yada. We just uh return everything it was when we 292 00:23:17,540 --> 00:23:22,640 called it right? So the one thing also with ARM is that you have different modes and some MIPS 293 00:23:22,640 --> 00:23:27,580 architectures also have this where you have something called a thumb mode and an arm mode. Very 294 00:23:27,580 --> 00:23:28,500 very easy nutshell. So ARM is a very special architecture. So ARM is a very special architecture. So 295 00:23:29,420 --> 00:23:33,500 thumb mode is a 16 bit interpreter. So we have two byte interpretations for instructions. The 296 00:23:33,500 --> 00:23:37,360 way that happens. You have something called uh I think it's jump and link exchange or branch and 297 00:23:37,360 --> 00:23:41,480 link exchange. Sorry. And if that the address that it's going to if the least significant bit 298 00:23:41,480 --> 00:23:47,000 is set minus one go back to that memory. Yeah minus one of that memory and then put everything 299 00:23:47,000 --> 00:23:51,400 into 16 bit mode. That's how it works. So if we jump into a odd memory and it's jump and 300 00:23:51,400 --> 00:23:56,680 exchange 16 bit. If not then it's uh ARM mode. Cool. So like I said before if we just analyze 301 00:23:56,680 --> 00:23:58,500 everything we kind of know where everything is going to be. So we're going to go back to our 302 00:23:58,520 --> 00:24:03,880 game. We're going to play. We can predict things now. So I know this is a little boring. I 303 00:24:03,880 --> 00:24:09,280 apologize guys. So just like before we're just crashing, analyzing, crashing. Alright now we're 304 00:24:09,280 --> 00:24:12,600 starting to see everything coming into play. Everything is starting to really look at the same 305 00:24:12,600 --> 00:24:17,680 as x86. Just different instructions. That's all it is. Instruction hunting ellipse though is a 306 00:24:17,680 --> 00:24:24,100 different story. Especially in MIPS. x86 you guys are spoiled. Spoiled with instructions. 307 00:24:24,680 --> 00:24:28,500 Stackable forward flow. No NX. Jump ESP. Right? You know basically. So we're going to go back to 308 00:24:28,520 --> 00:24:32,640 T9. I'm not going to say that's every single situation. But basically right? Win. Simple. No NX. 309 00:24:32,660 --> 00:24:39,240 That's all we care about. MIPS. Jump register stack. Nope. Move stack into T9. Maybe we can call 310 00:24:39,240 --> 00:24:44,400 T9. Nope. Go screw yourself. So this one is more complicated. We have to ROP in order to do a 311 00:24:44,400 --> 00:24:49,600 basic stack execution. We don't care about NX. We're not calling any kind of APIs to modify 312 00:24:49,600 --> 00:24:56,360 memory uh uh attributes. So this one was a little bit more interesting. So what I had to do was I 313 00:24:56,360 --> 00:24:58,500 had to chain gadgets together. And then I had to do the same thing over and over and over and over 314 00:24:58,520 --> 00:25:04,020 and over. And I completely skipped that by accident. So sorry about that. So basically what I 315 00:25:04,020 --> 00:25:07,880 had to do from the very beginning. I only had a limited set of registers. So all first gadget get 316 00:25:07,880 --> 00:25:12,460 more registers. And then I sleep because when I was doing this at the time I was hearing about 317 00:25:12,460 --> 00:25:17,420 instruction cache flushing. Not every single MIPS device has that. This is an R3000 MIPS 1. It 318 00:25:17,420 --> 00:25:21,580 doesn't use instruction caching at all. There was no reason to go into sleep. But I did it 319 00:25:21,580 --> 00:25:28,500 anyways. And then from there it's to adjust uh put the stack at 80% of the stack. And then I 320 00:25:28,520 --> 00:25:35,900 put an A18 offset into it and put into A1. Move A1 into T9. Jump T9. That is how I did jump ESP 321 00:25:35,900 --> 00:25:43,020 on MIPS. So one thing that was a little annoying and just like we all have with x86 that we've 322 00:25:43,020 --> 00:25:47,780 done before. Are null bytes. So when I first came into this it seemed like every single 323 00:25:47,780 --> 00:25:51,000 instruction had null bytes. And I said you know what forget this router stuff. I'm going back to 324 00:25:51,000 --> 00:25:56,540 desktop space. GG. I'm done. You guys can have fun with this. But then I relaxed. I said alright. 325 00:25:56,700 --> 00:25:58,500 Let's actually relax. Whatever. I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. 326 00:25:58,500 --> 00:25:58,520 I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. I'm done. I'm 327 00:25:58,520 --> 00:26:01,300 done. I'm done. I'm done. What about X4? What if I just I don't know. X4 this and that. 328 00:26:02,520 --> 00:26:09,480 Dope. So we don't have null bytes. So we can just make an X4 encoder. So in a nutshell 329 00:26:09,480 --> 00:26:14,600 though the whole thing is still the same ideas and techniques that we've used with x86. It's 330 00:26:14,600 --> 00:26:28,480 just a different instruction set. That is it. So um before I go into this a little bit more the shellcode stuff that I done before and a little bit the ah the I don't know like the pre prelude or whatever to the ah shellcode. I did it. When I got to the program I got a new one. But that's all right. I did it. So I'm 331 00:26:28,480 --> 00:26:33,040 everything in RASM. I use uh, I use RASM2 to assemble all my opc- all my instructions into 332 00:26:33,040 --> 00:26:36,160 opcodes because I didn't feel like using an assembler and trying to get everything working 333 00:26:36,160 --> 00:26:39,780 correctly. No, screw it. I just want these instructions and I'm just going to copy these 334 00:26:39,780 --> 00:26:43,960 opcodes into my payload and that's going to be done with it. So this one, all I did there was 335 00:26:43,960 --> 00:26:50,320 I XORed S0 with S0 stored in S0. Why? In MIPS for nulls there's no op and when I was jumping 336 00:26:50,320 --> 00:26:54,300 back to the stack I had an address that was not resolving to an actual instruction. So I 337 00:26:54,300 --> 00:27:00,420 just overwrote it with nulls. It's a nop-slug. I know it's dirty but it worked. So, in a 338 00:27:00,420 --> 00:27:05,300 nutshell, grab your libc address, find your extraction offsets, crash your shellcode, test 339 00:27:05,300 --> 00:27:09,580 your exploit in QEMU or QMU, whatever you want to call it. I'm really bad with butchering 340 00:27:09,580 --> 00:27:14,760 these names. I test everything in emulation first and then from there all I had to do was 341 00:27:14,760 --> 00:27:20,320 replace the libc base address because a lot of these devices don't use ASLR even though 342 00:27:20,320 --> 00:27:24,280 uh, randomized VASpace is set to 2. Doesn't work. Crash the device, replace the libc base 343 00:27:24,700 --> 00:27:28,260 restart it many, many times. Libc and everything else, all the other libraries that it loads 344 00:27:28,260 --> 00:27:34,360 are going to be in the same place every time. So, this example is from something I've made. 345 00:27:34,460 --> 00:27:38,860 It's called the DVRF project or damn vulnerable router. Yeah, it's kind of funny but um, so 346 00:27:38,860 --> 00:27:42,960 this one, the, it's a, it's a very first level. It's just a stack buff overflow and I wanted to 347 00:27:42,960 --> 00:27:46,980 show that this is in QEMU and I took the same exact payload. The padding is different but 348 00:27:46,980 --> 00:27:53,820 still the same payload. Copied it to my device and it works beautifully. Great. So, going 349 00:27:54,280 --> 00:27:59,000 forward though, I'm talking about all this exploitation stuff and I was guilty of doing 350 00:27:59,000 --> 00:28:04,740 this. I was super guilty of doing this. I would find a vuln. I would say, yes, PC is 41, 41, 351 00:28:04,840 --> 00:28:11,280 41. I am done. Drop mic. But that doesn't do anything. I was limiting myself and I was 352 00:28:11,280 --> 00:28:19,040 limiting my growth. So, we need to get away from this. We need no more dos pox. And I vote 353 00:28:19,040 --> 00:28:24,200 that we, we make pox great again. But don't worry, I'm not going to build a Faraday wall 354 00:28:24,200 --> 00:28:30,860 around these devices and may the vendors pay for it. I guarantee you that. So, this is my demo 355 00:28:30,860 --> 00:28:39,320 now. So, um, yeah, so let's get started. But before I, I do this, I like to get, kind of like 356 00:28:39,320 --> 00:28:43,000 get into character. Kind of have fun with this. You know, we're, we sit here all day, we see 357 00:28:43,000 --> 00:28:50,000 talks. We need to have some fun, right? So, have you, have you guys ever seen stock photos of 358 00:28:50,000 --> 00:28:50,260 hackers? 359 00:29:04,160 --> 00:29:10,720 Hello. Okay. Uh, so before we get started, I'm going to set up the environment 360 00:29:10,720 --> 00:29:24,180 first. So, the application, I'll be, I'm going to be using, I'm going to be using, I'm going to be 361 00:29:24,200 --> 00:29:29,360 exploiting in this demo. It's called socket BOF. Um, the application, all it does, it's 362 00:29:29,360 --> 00:29:35,800 listed on a socket. And whatever data it gets, it just stir copies it. These, uh, these 363 00:29:35,800 --> 00:29:38,780 levels and stuff, I'll talk about towards the end, are supposed to be educational levels to 364 00:29:38,780 --> 00:29:54,140 help you learn about this kind of stuff. But, let's, let's just set this up. What? Hold on. Hold 365 00:29:54,200 --> 00:30:11,100 on. Huh. Yeah. Hold on. There we go. Yep. All right. Sorry about that. All right. Um, before 366 00:30:11,100 --> 00:30:12,380 we get started, can we kill the lights? 367 00:30:34,360 --> 00:30:41,320 All right. Awesome. So, what I'm going to do here, um, I forgot my own arguments for my own 368 00:30:41,320 --> 00:30:45,680 script. So, that's why I had to print out the help. So, we're going to set this whole thing up. 369 00:30:47,260 --> 00:30:49,940 And I'm going to get my microphone because my computer is going to do the rest of the talking. 370 00:31:06,600 --> 00:31:07,920 Sorry. I'm a little slow. 371 00:31:13,240 --> 00:31:13,680 Huh? 372 00:31:20,040 --> 00:31:20,680 Thank you. 373 00:31:24,960 --> 00:31:27,140 Uh, let me make sure that it's actually... 374 00:31:33,440 --> 00:31:37,020 All right. Cool. Just want to make sure, you know, I don't want the demigods to get mad at me. 375 00:31:38,400 --> 00:31:48,080 So, we did this on 8080, right? So, now, so, over here, uh, let's make a new tab. NC-L-V-P. 376 00:31:49,420 --> 00:31:54,180 So, now, we have a Netcat listener waiting. And, uh, we're going to, uh, we're going to, uh, we're 377 00:31:54,200 --> 00:31:59,140 going to, uh, load up some stuff. And I'm now going to make sure that's right. 8080. 378 00:31:59,360 --> 00:32:02,660 All right. Cool. So, uh, without further ado, let's get this going. 379 00:32:04,060 --> 00:32:06,180 Oh, no. Hold on. 380 00:32:08,960 --> 00:32:10,540 The sound's not working. 381 00:32:13,600 --> 00:32:14,560 No I don't. 382 00:32:16,360 --> 00:32:19,500 Aw man. No! 383 00:32:19,500 --> 00:32:19,740 No. 384 00:32:23,220 --> 00:32:24,120 Oh, it works. 385 00:32:25,770 --> 00:32:26,820 Front, left. 386 00:32:27,240 --> 00:32:27,680 All right, cool. 387 00:32:30,540 --> 00:32:32,140 Hello, IoT Village. 388 00:32:32,920 --> 00:32:36,240 Before we begin, I want to say that this will be 389 00:32:36,240 --> 00:32:38,340 my last performance of this demo. 390 00:32:38,990 --> 00:32:40,420 With that out of the way, 391 00:32:40,660 --> 00:32:43,240 let's corrupt this application stack. 392 00:32:43,740 --> 00:32:47,360 But first, we need some sick hacking music. 393 00:32:49,500 --> 00:32:50,040 That's better. 394 00:32:50,400 --> 00:32:53,820 Now we need to cover our tracks for that offset. 395 00:33:10,920 --> 00:33:11,800 Thank you. 396 00:33:12,280 --> 00:33:12,800 Thanks, guys. 397 00:33:22,520 --> 00:33:23,780 So we can also verify. 398 00:33:24,080 --> 00:33:26,220 So this application is still in this stuck state. 399 00:33:26,540 --> 00:33:29,600 So if I go back to Netcat and just kill it to just verify, 400 00:33:30,020 --> 00:33:31,240 then it's, you know, it returns. 401 00:33:31,400 --> 00:33:32,400 So that was an actual exploit. 402 00:33:32,600 --> 00:33:33,940 So thank you for bearing with me with that. 403 00:33:34,020 --> 00:33:34,740 Like I said, I just want to have fun. 404 00:33:34,780 --> 00:33:35,740 You can bring back the lights. 405 00:33:39,060 --> 00:33:40,460 So like I said, I just want to have fun with that. 406 00:33:40,600 --> 00:33:42,420 But like I said, I went from not knowing 407 00:33:42,420 --> 00:33:44,080 myths assembly to doing that. 408 00:33:44,220 --> 00:33:45,220 So it just takes some time. 409 00:33:45,300 --> 00:33:45,900 You guys can do it too. 410 00:33:45,980 --> 00:33:46,520 It's pretty straightforward. 411 00:33:46,780 --> 00:33:49,320 The differences that I learned, X86, based 412 00:33:49,500 --> 00:33:50,780 stack buffer flow is pretty simple, straightforward. 413 00:33:50,940 --> 00:33:51,800 Like I said, a thousand times. 414 00:33:51,900 --> 00:33:54,680 Ropping, just know where ESP is and where the 415 00:33:54,680 --> 00:33:56,380 RET's going to happen and everything falls into place. 416 00:33:56,660 --> 00:33:59,460 MIPS, base stack buffer flow is a little bit less 417 00:33:59,460 --> 00:34:01,520 straightforward because of the less instructions 418 00:34:01,520 --> 00:34:02,460 that you have than X86. 419 00:34:03,800 --> 00:34:06,060 But it's a little bit more fun, but it does require 420 00:34:06,060 --> 00:34:06,460 roping. 421 00:34:06,560 --> 00:34:08,340 So if you've never roped before in X86, you should 422 00:34:08,340 --> 00:34:09,920 probably do that first before coming over here. 423 00:34:10,260 --> 00:34:12,660 And then roping in MIPS, same thing. 424 00:34:12,820 --> 00:34:14,900 You're just calling different APIs and feeding it 425 00:34:14,900 --> 00:34:17,640 different arguments, same thing as X86. 426 00:34:19,660 --> 00:34:22,060 I haven't finished this one yet because I'm still learning 427 00:34:22,060 --> 00:34:24,060 the many, many, many, many, many, many, many different 428 00:34:24,060 --> 00:34:25,140 instructions that ARM provides. 429 00:34:25,560 --> 00:34:28,480 So this one, so far I've seen is that the gadgets can be found 430 00:34:28,480 --> 00:34:29,120 in different modes. 431 00:34:29,320 --> 00:34:31,920 The same function can represent two different types of 432 00:34:31,920 --> 00:34:33,220 instruction sets all at once. 433 00:34:33,420 --> 00:34:36,500 You can analyze a function in ARM mode and have different 434 00:34:36,500 --> 00:34:38,040 instructions that we have in thumb mode, right? 435 00:34:38,100 --> 00:34:42,120 Kind of as expected versus 32 versus 16 bit instruction sets. 436 00:34:42,780 --> 00:34:44,760 So and then at the very end, you also have something called 437 00:34:44,760 --> 00:34:46,960 pop PC which can be used for your ROP. 438 00:34:47,120 --> 00:34:49,300 So you just pop PC, pop PC, pop PC. 439 00:34:49,300 --> 00:34:50,340 Or RET, right? 440 00:34:52,040 --> 00:34:55,300 So interfacing with JTAG or interacting with JTAG. 441 00:34:55,380 --> 00:34:57,080 So this is an Arduino Zero that I bought. 442 00:34:57,560 --> 00:35:00,400 Um, I used it more because I had a Cortex processor and I 443 00:35:00,400 --> 00:35:02,480 wanted to play more with real, more real time devices. 444 00:35:03,040 --> 00:35:05,240 So this is the JTAG layer like I said in the beginning where, 445 00:35:05,320 --> 00:35:07,140 you know, you can use the, you know, Arduino, blah, blah, blah. 446 00:35:07,440 --> 00:35:09,640 But I just wanted to learn actually like how does this work? 447 00:35:09,780 --> 00:35:11,880 So on this device, JTAG is listed up. 448 00:35:11,900 --> 00:35:13,640 I was like let's brute force this and see what happens. 449 00:35:14,260 --> 00:35:15,960 So that's what, this is JTAG layer. 450 00:35:16,100 --> 00:35:19,180 You just hook up as many pins as you want, before I even do 451 00:35:19,300 --> 00:35:20,960 that, who here has heard of JTAGulator? 452 00:35:22,580 --> 00:35:24,880 I am not going further with what I was going to say about 453 00:35:24,880 --> 00:35:25,400 JTAGulator. 454 00:35:27,400 --> 00:35:28,500 Very, very straight forward, right? 455 00:35:30,020 --> 00:35:31,200 So, next step though. 456 00:35:31,480 --> 00:35:34,520 Alright, so I find TDI, I find, you know, I find data in, 457 00:35:34,620 --> 00:35:36,840 I find data out, I find mode select, I find everything I need, 458 00:35:36,900 --> 00:35:37,280 I find the clock. 459 00:35:37,600 --> 00:35:38,100 Now what? 460 00:35:38,960 --> 00:35:41,700 Now you have to actually interact with that interface, 461 00:35:41,880 --> 00:35:42,000 right? 462 00:35:42,100 --> 00:35:43,080 You have to actually talk to it. 463 00:35:43,460 --> 00:35:45,960 Um, the state machine will still be the same, but the instruction 464 00:35:45,960 --> 00:35:48,520 registers and data registers, think of it as operand and 465 00:35:48,520 --> 00:35:48,820 opcode. 466 00:35:49,300 --> 00:35:49,620 Same thing, right? 467 00:35:49,700 --> 00:35:51,720 You have a opcode and an operand to go with it. 468 00:35:51,840 --> 00:35:54,000 Same thing, but it's in JTAG and they're very small registers. 469 00:35:54,400 --> 00:35:57,600 So, there's an open source project that I use called OpenOCD 470 00:35:58,060 --> 00:36:01,900 and in this one, um, it's funny because one of the devices that's 471 00:36:01,900 --> 00:36:05,240 in the other room, um, I actually used OpenOCD to talk 472 00:36:05,240 --> 00:36:07,100 to JTAG, so it's actually pretty cool to see that in here. 473 00:36:07,800 --> 00:36:10,920 But, once you have JTAG open and you actually can talk to it, 474 00:36:10,980 --> 00:36:14,440 you can't just say OpenOCD, my FTDI chip that's connected to 475 00:36:14,440 --> 00:36:14,680 JTAG. 476 00:36:14,740 --> 00:36:15,980 No, it has to actually know the profile. 477 00:36:16,500 --> 00:36:18,680 So, if you go online, these things have many, many, 478 00:36:18,680 --> 00:36:21,740 many profiles already for a lot of chips and different 479 00:36:21,740 --> 00:36:23,300 manufacturers, you know, like ARM, right? 480 00:36:23,320 --> 00:36:24,460 ARM is not a chip maker, right? 481 00:36:24,520 --> 00:36:26,780 It's just, it just does its, uh, instruction sets and all that 482 00:36:26,780 --> 00:36:26,900 shit. 483 00:36:27,200 --> 00:36:30,940 So, but different manufacturers will implement the same JTAG 484 00:36:30,940 --> 00:36:32,700 state machine and all the instructions and everything 485 00:36:32,700 --> 00:36:33,260 else the same. 486 00:36:33,340 --> 00:36:35,240 So, different type of manufacturers will use the same 487 00:36:35,240 --> 00:36:36,260 OpenOCD configuration. 488 00:36:36,760 --> 00:36:40,500 Also, newer versions of the chip may also work on older versions 489 00:36:40,500 --> 00:36:41,760 for that JTAG as well and vice versa. 490 00:36:42,080 --> 00:36:44,340 So, don't get stuck when you can't find the configuration 491 00:36:44,340 --> 00:36:45,760 file for your exact processor. 492 00:36:45,980 --> 00:36:48,520 Find something around it or with the same architecture and it may 493 00:36:48,520 --> 00:36:48,660 be the same. 494 00:36:48,680 --> 00:36:51,920 So, when you open it up though, just, this is just for people 495 00:36:51,920 --> 00:36:52,840 that have never used it before. 496 00:36:52,920 --> 00:36:55,280 You have GDB server that opens up locally and you can start 497 00:36:55,280 --> 00:36:55,860 dumping memory. 498 00:36:55,940 --> 00:36:56,500 You can do whatever you want. 499 00:36:56,600 --> 00:36:57,200 It's GDB, right? 500 00:36:57,580 --> 00:37:00,040 So, what's great about this, this was on a Cortex processor 501 00:37:00,040 --> 00:37:02,780 and Cortex has a very specific memory layout. 502 00:37:03,060 --> 00:37:05,120 And with this one, there's a specific memory address. 503 00:37:05,220 --> 00:37:07,140 If you look at the data sheet, you could dump AES keys and all 504 00:37:07,140 --> 00:37:07,580 that good stuff. 505 00:37:07,920 --> 00:37:10,400 So, this is very powerful when we want to kind of extract 506 00:37:10,400 --> 00:37:13,480 information from it that we can't get to it normally. 507 00:37:13,680 --> 00:37:16,520 Like, maybe SPI, the flash chip's encrypted or all this 508 00:37:16,520 --> 00:37:16,920 other crap. 509 00:37:17,120 --> 00:37:18,540 So, this is our last resort. 510 00:37:18,680 --> 00:37:21,420 I always like to say that start with the software stack first, 511 00:37:21,880 --> 00:37:24,900 exhaust all your resources, then go to hardware and start from 512 00:37:24,900 --> 00:37:26,280 easy to, you know, easy to hard. 513 00:37:26,400 --> 00:37:28,080 It's the same thing that we always do in our everyday 514 00:37:28,080 --> 00:37:28,360 lives. 515 00:37:29,340 --> 00:37:32,380 So, once we have the JTAG, uh, connected and it's connected to 516 00:37:32,380 --> 00:37:34,700 it, we can say how fast is the clock going, I want to measure 517 00:37:34,700 --> 00:37:37,740 this, I want to reset the entire processor and then halt. 518 00:37:37,880 --> 00:37:41,300 I want to set a break point when, uh, like, you know, say at 519 00:37:41,300 --> 00:37:43,560 this memory, not memory address, when, uh, when memory address 520 00:37:43,560 --> 00:37:45,720 is being written to here or like when the kernel's being 521 00:37:45,720 --> 00:37:47,120 loaded, we can do whatever we want. 522 00:37:47,200 --> 00:37:48,660 So, like, for example, if there's URI, if there's a 523 00:37:48,660 --> 00:37:51,060 smart password, you can use this at a watch point when the 524 00:37:51,060 --> 00:37:53,900 kernel, uh, arguments are being loaded, set it to single user 525 00:37:53,900 --> 00:37:55,700 mode, let it load, done. 526 00:37:57,060 --> 00:37:58,160 So, wrapping up. 527 00:37:58,200 --> 00:38:00,980 So, I, I want to say thank you guys a lot for sitting through 528 00:38:00,980 --> 00:38:01,240 this. 529 00:38:01,700 --> 00:38:04,820 I know I've been a little repetitive, a little fast, but 530 00:38:04,820 --> 00:38:05,380 thank you guys. 531 00:38:05,540 --> 00:38:06,400 This is wrapping up now. 532 00:38:06,500 --> 00:38:07,340 So, this is my project. 533 00:38:07,420 --> 00:38:09,660 This is the, uh, demo that I gave you guys. 534 00:38:09,840 --> 00:38:11,940 Uh, this is called my damn vulnerable write-up firmware. 535 00:38:12,180 --> 00:38:12,900 Where'd it just come from? 536 00:38:13,180 --> 00:38:14,660 This is the literal story. 537 00:38:14,960 --> 00:38:18,100 I was in my shower thinking about damn vulnerable web app, 538 00:38:18,180 --> 00:38:18,640 damn vulnerable web app. 539 00:38:18,660 --> 00:38:18,800 It's called Linux. 540 00:38:19,000 --> 00:38:19,940 I was like, that's so silly. 541 00:38:19,980 --> 00:38:20,640 That's so many of those. 542 00:38:21,300 --> 00:38:22,520 There's not one for routers. 543 00:38:22,900 --> 00:38:23,740 So, I'm going to make one. 544 00:38:24,500 --> 00:38:25,500 So, that's what happened. 545 00:38:25,680 --> 00:38:26,760 But how did I do this? 546 00:38:26,820 --> 00:38:28,980 Remember that tarball thing I told you from a while ago? 547 00:38:29,200 --> 00:38:31,460 This device was sitting in my closet, not doing anything. 548 00:38:31,720 --> 00:38:33,300 It's a $10 device now. 549 00:38:33,400 --> 00:38:34,160 It's an AO211N. 550 00:38:34,900 --> 00:38:36,540 And I just picked up my thing. 551 00:38:36,620 --> 00:38:38,340 I was like, oh, let's start writing firmware for this. 552 00:38:38,360 --> 00:38:39,080 Let's actually do it. 553 00:38:39,380 --> 00:38:40,160 So, that's what I did. 554 00:38:40,220 --> 00:38:42,380 I downloaded tarball and just started ripping everything out. 555 00:38:42,520 --> 00:38:44,500 I started learning how they did everything and just made my own 556 00:38:44,500 --> 00:38:46,480 custom, uh, tarball for it. 557 00:38:46,580 --> 00:38:47,340 And that's on GitHub. 558 00:38:47,440 --> 00:38:47,980 You can download it. 559 00:38:48,020 --> 00:38:48,340 You can fork it. 560 00:38:48,340 --> 00:38:49,160 You can do whatever the hell you want with it. 561 00:38:49,360 --> 00:38:50,180 But this is how this works. 562 00:38:50,460 --> 00:38:52,240 So, I'm working on another device. 563 00:38:52,380 --> 00:38:55,380 The device is actually, actually, they actually have it in there as well. 564 00:38:55,500 --> 00:38:56,200 It's a trend net. 565 00:38:56,420 --> 00:38:58,040 It's an ARM device as well. 566 00:38:58,180 --> 00:39:00,200 I'm just having issues compiling the kernel. 567 00:39:00,520 --> 00:39:05,520 Um, it keeps bombing out for some reason saying that, uh, processor dot H is not found. 568 00:39:05,760 --> 00:39:10,420 So, uh, once I figure that out and kind of fix that, then I'll have another DVRF build for ARM. 569 00:39:10,860 --> 00:39:14,200 And what's good about this is that there's two ways to do this. 570 00:39:14,320 --> 00:39:16,300 You can put the firmware on your device. 571 00:39:16,460 --> 00:39:17,560 It can always revert back to. 572 00:39:17,760 --> 00:39:18,320 There's not a whole lot. 573 00:39:18,340 --> 00:39:18,800 It's a one-way street. 574 00:39:19,300 --> 00:39:25,240 And when you do that, the device, the, the ponables that I have on there are only accessible 575 00:39:25,240 --> 00:39:25,820 through UART. 576 00:39:25,900 --> 00:39:27,060 You have to start them through UART. 577 00:39:27,180 --> 00:39:31,480 So, this forces you to open up the device, plug through UART, find the directory, find 578 00:39:31,480 --> 00:39:32,600 the executable, run it, right? 579 00:39:33,100 --> 00:39:34,380 Or you can emulate it. 580 00:39:34,480 --> 00:39:36,320 I prefer both ways. 581 00:39:36,500 --> 00:39:37,840 Just do everything that you can. 582 00:39:37,960 --> 00:39:39,980 As long as you get the point B, who cares, right? 583 00:39:40,380 --> 00:39:45,260 But this, this idea was to learn, to help people dig into this, get the hands-on experience 584 00:39:45,260 --> 00:39:47,440 with exploiting stuff outside the x86 space. 585 00:39:47,440 --> 00:39:50,100 And also help IOT developers. 586 00:39:50,460 --> 00:39:54,020 I say IOT like this, just, it's a key word that's very stuck in my brain. 587 00:39:55,040 --> 00:40:01,400 So, help people learn this stuff as well because I've seen 90s programming code in today's 588 00:40:01,400 --> 00:40:01,900 architecture. 589 00:40:02,620 --> 00:40:07,360 When I was doing example codes of start copy and just, you know, funny stuff, that's actually 590 00:40:07,360 --> 00:40:08,340 happening today. 591 00:40:09,260 --> 00:40:13,880 I will be demoing an exploit tomorrow that's an actual one that I found that does this 592 00:40:13,880 --> 00:40:14,280 kind of stuff. 593 00:40:14,340 --> 00:40:17,100 And I'll be chaining four vulns together in order to get complete compromise. 594 00:40:17,560 --> 00:40:18,740 But that'll be for tomorrow. 595 00:40:18,880 --> 00:40:19,380 It's in the IOT Village. 596 00:40:19,540 --> 00:40:20,060 Same with plug. 597 00:40:20,420 --> 00:40:24,700 So, this is where you can download the damn vulnerable router firmware stuff on GitHub. 598 00:40:24,880 --> 00:40:26,000 That's the, the link. 599 00:40:26,140 --> 00:40:27,160 It's on Praetorians GitHub. 600 00:40:27,680 --> 00:40:28,940 I am updating it. 601 00:40:29,100 --> 00:40:32,320 I, you know, if, if you want to update it as well, more people, the better. 602 00:40:32,840 --> 00:40:33,920 This is for the community. 603 00:40:34,180 --> 00:40:36,960 I just wanted to see if I can teach what I've learned. 604 00:40:37,080 --> 00:40:38,680 That's all I want to do with all this stuff. 605 00:40:38,880 --> 00:40:40,460 If I can learn it, you can learn it as well. 606 00:40:40,580 --> 00:40:41,560 I'm not some amazing guy. 607 00:40:41,720 --> 00:40:43,000 I'm just some little kid from Texas. 608 00:40:44,220 --> 00:40:46,900 My future plans is to keep working on this stuff. 609 00:40:46,900 --> 00:40:47,920 Do the ARM one. 610 00:40:47,960 --> 00:40:48,620 Get that finished. 611 00:40:49,400 --> 00:40:55,500 I have a blog post that I've done on introductory to, uh, hardware exploit, uh, software exploitation. 612 00:40:55,820 --> 00:40:57,660 And then getting started with this project as well. 613 00:40:57,820 --> 00:41:01,380 And that code for this exploit that I demoed is on the blog as well. 614 00:41:02,080 --> 00:41:03,360 Fully documented as well. 615 00:41:03,400 --> 00:41:05,060 You can copy and paste it and do whatever the hell you want. 616 00:41:05,120 --> 00:41:06,900 The shellcode is in there as well from Bowcaster. 617 00:41:07,460 --> 00:41:08,760 And, yeah, take a look at it. 618 00:41:08,840 --> 00:41:09,220 Do whatever you want. 619 00:41:09,640 --> 00:41:11,020 I'm also available on Twitter. 620 00:41:11,420 --> 00:41:13,280 And I'm always available to help you guys out. 621 00:41:13,380 --> 00:41:15,560 There's no such thing as a dumb answer or a dumb question. 622 00:41:15,700 --> 00:41:16,740 There may be a dumb answer from me. 623 00:41:16,900 --> 00:41:18,080 No such thing as a dumb question. 624 00:41:18,220 --> 00:41:22,760 If you are confused, lost, need some help, or going, hey, man, I've been probing this thing for hours. 625 00:41:22,940 --> 00:41:23,940 Can't find anything. 626 00:41:24,020 --> 00:41:24,460 Can you help me out? 627 00:41:24,540 --> 00:41:25,860 I'm always here to help you guys. 628 00:41:26,060 --> 00:41:28,400 That's what I want to do is teach and help people grow. 629 00:41:28,700 --> 00:41:30,620 That's what we're all doing here is to grow, right? 630 00:41:30,740 --> 00:41:31,520 That's why we go to conferences. 631 00:41:33,160 --> 00:41:38,360 So, uh, before we wrap up, I'll be holding a workshop tomorrow at the IoT Village at 10 a.m. 632 00:41:38,620 --> 00:41:43,680 Uh, basically it's a bring your own device type thing or maybe take one or borrow one from IoT Village. 633 00:41:44,080 --> 00:41:45,600 Or just share one from a researcher. 634 00:41:46,140 --> 00:41:48,340 We're doing a zero-day hunting workshop. 635 00:41:49,120 --> 00:41:50,520 But we're not just finding vulns. 636 00:41:50,580 --> 00:41:52,040 We're going to take it all the way to Code Exact 2. 637 00:41:53,300 --> 00:41:57,720 So, attendees will be, uh, encouraged to craft exploits for the vulns that they find. 638 00:41:57,880 --> 00:42:07,300 All the vulns that are found just because of, you know, disclosure policies and stuff like that will be safely disclosed over PGP or whatever, uh, communication the vendor prefers, uh, to the vendor first. 639 00:42:07,480 --> 00:42:09,300 And then we'll do the exploitation and get that underway. 640 00:42:09,720 --> 00:42:12,440 And then you can go, you know, claim your prizes or whatever. 641 00:42:12,640 --> 00:42:15,180 But I just want to help people actually find this stuff and get the hands-on experience. 642 00:42:15,180 --> 00:42:17,640 We sit here and watch and watch and watch and watch. 643 00:42:17,720 --> 00:42:19,340 Let's actually do stuff and actually commit it, right? 644 00:42:19,680 --> 00:42:21,540 So that's tomorrow at 10 a.m., IoT Village. 645 00:42:22,760 --> 00:42:24,960 Um, I can put this out online if anyone wants it. 646 00:42:25,020 --> 00:42:25,860 You guys take pictures too. 647 00:42:26,020 --> 00:42:33,600 The multimeter that I use and the USB microscope, literally Amazon came in, tried it out, worked great. 648 00:42:33,960 --> 00:42:35,720 Nothing more crazier than that. 649 00:42:35,860 --> 00:42:39,160 But the one thing I use a lot is the FT232, which by Adafruit is $15. 650 00:42:39,680 --> 00:42:42,320 Um, the equivalent is the Shikra, which is $50. 651 00:42:42,540 --> 00:42:44,760 Has a little bit more to it, but it's the same chip. 652 00:42:45,180 --> 00:42:47,780 Um, so depending on your budget, you may want to go through that route. 653 00:42:49,280 --> 00:42:50,660 But, that's the end of my talk. 654 00:42:50,880 --> 00:42:52,420 I appreciate you guys sitting through this. 655 00:42:52,520 --> 00:42:55,340 Are there any questions before we say, get out? 656 00:42:57,220 --> 00:42:57,620 Yes? 657 00:42:58,500 --> 00:43:05,120 So, um, for chips that, or excuse that, have block bits or if they have, like, JPEG to see if there's one or anything, 658 00:43:05,260 --> 00:43:08,380 would you be able to, like, ask, ask those questions? 659 00:43:08,700 --> 00:43:15,080 So, the question was, um, around, uh, was it the manipulation of, uh, chips if, like, 660 00:43:15,180 --> 00:43:16,500 JTAG is disabled and stuff like that. 661 00:43:16,660 --> 00:43:18,840 So, there's, there's one question around that, too. 662 00:43:18,920 --> 00:43:19,860 How is JTAG disabled? 663 00:43:20,080 --> 00:43:21,960 Is it software disabled or is it a fuse? 664 00:43:22,360 --> 00:43:24,160 If it's a hardware disabled, you're kind of screwed. 665 00:43:24,420 --> 00:43:29,500 Unless you can, you know, decap it and, like, fuse that fuse back together to bridge it. 666 00:43:29,680 --> 00:43:35,660 If it's software, find the reset pin, ground it or, you know, do what the data sheet says, but it's usually ground it. 667 00:43:36,260 --> 00:43:36,960 Power it on. 668 00:43:37,400 --> 00:43:42,060 Everything will turn on and no software will be loaded and the JTAG state machine will be accessible. 669 00:43:43,800 --> 00:43:45,120 So, but if it's the latter. 670 00:43:45,120 --> 00:43:45,980 You're kind of screwed. 671 00:43:46,220 --> 00:43:47,500 So, that's the only downfall, right? 672 00:43:47,760 --> 00:43:48,080 Yes? 673 00:43:48,360 --> 00:43:50,620 What if, uh, GDB is not enabled on the device? 674 00:43:51,080 --> 00:43:51,900 If GDB what? 675 00:43:52,180 --> 00:43:52,760 It's not enabled. 676 00:43:53,040 --> 00:43:55,980 So, I have cross-compiled GDB and I can teach you guys how to do this well. 677 00:43:56,100 --> 00:44:00,580 So, on my device as well, I had, uh, there's no GDB on it and I had to craft my exploit. 678 00:44:00,920 --> 00:44:02,700 So, that's why I was doing the emulation route. 679 00:44:02,880 --> 00:44:08,880 But I did cross-compile GDB for, uh, MIPS and I believe it was, like, MIPS Big Indian, Little Indian for, uh, 680 00:44:09,020 --> 00:44:10,560 for generic instruction of MIPS 1. 681 00:44:10,860 --> 00:44:11,560 So, that's on there. 682 00:44:11,620 --> 00:44:12,360 You can compile it yourself. 683 00:44:12,540 --> 00:44:13,460 It's a little bit of a pain in the ass. 684 00:44:13,780 --> 00:44:14,540 But it's doable. 685 00:44:15,780 --> 00:44:17,700 Um, so, you would have to cross-compile it yourself. 686 00:44:17,880 --> 00:44:18,560 Put it on the device. 687 00:44:18,800 --> 00:44:22,640 Or, if the device doesn't have enough space on it, you're going to have to go through the emulation route. 688 00:44:23,340 --> 00:44:24,300 So, that's the only two ways. 689 00:44:24,720 --> 00:44:25,560 Cross-compile it yourself. 690 00:44:25,700 --> 00:44:26,260 Put it onto the device. 691 00:44:26,340 --> 00:44:27,760 Because most devices usually have wget. 692 00:44:28,280 --> 00:44:32,040 Um, they usually have wget or you can just echo it through the serial interface and just put it into a file, right? 693 00:44:32,840 --> 00:44:34,480 So, uh, put GDB on it. 694 00:44:34,520 --> 00:44:34,780 Run it. 695 00:44:34,860 --> 00:44:37,960 Or just emulate yourself through QEMO or whatever you want to use. 696 00:44:38,440 --> 00:44:39,000 So, that's... 697 00:44:39,000 --> 00:44:40,580 If you put a GDB on it, do you have access? 698 00:44:41,280 --> 00:44:41,720 If what? 699 00:44:42,040 --> 00:44:42,620 Do you have access? 700 00:44:43,140 --> 00:44:44,180 If you have access to GDB? 701 00:44:44,420 --> 00:44:45,100 If you don't have access. 702 00:44:45,120 --> 00:44:47,480 If you don't have access to the device, how can you put GDB on it? 703 00:44:47,520 --> 00:44:49,160 Oh, you can put GDB server on it. 704 00:44:50,020 --> 00:44:50,640 GDB server. 705 00:44:50,880 --> 00:44:52,520 And then just attach it to the process. 706 00:44:52,660 --> 00:44:53,460 Have it listed on the socket. 707 00:44:53,600 --> 00:44:54,420 Connect over the socket. 708 00:44:54,520 --> 00:44:55,020 Over the network. 709 00:44:55,120 --> 00:44:55,440 And that's it. 710 00:44:57,320 --> 00:44:58,920 That's the way I've done it. 711 00:44:59,020 --> 00:45:03,820 Like, I've always either GDB and then I put GDB and I use it over a serial interface. 712 00:45:04,120 --> 00:45:05,100 Or GDB server. 713 00:45:05,200 --> 00:45:05,960 Connect it over a socket. 714 00:45:06,160 --> 00:45:07,240 And just do everything like that. 715 00:45:08,200 --> 00:45:09,240 Or just emulate it. 716 00:45:09,460 --> 00:45:11,540 That's pretty much it. 717 00:45:11,600 --> 00:45:12,420 Nothing too crazy there. 718 00:45:12,560 --> 00:45:13,340 Are there any more questions? 719 00:45:13,920 --> 00:45:14,320 Yes? 720 00:45:14,320 --> 00:45:18,100 What hardware did you use to talk to the flash chips? 721 00:45:18,260 --> 00:45:18,660 Yes. 722 00:45:18,760 --> 00:45:22,060 So the question was what is the hardware that I use to talk to the flash chips and stuff. 723 00:45:22,240 --> 00:45:26,600 That is the Adafruit FT232H breakout board. 724 00:45:27,180 --> 00:45:28,860 It is a FTDI chip. 725 00:45:29,180 --> 00:45:32,620 And it supports JTAG, SPI, I2C, UART. 726 00:45:33,040 --> 00:45:34,360 And I believe that's about it. 727 00:45:34,460 --> 00:45:35,360 But there may be more. 728 00:45:35,460 --> 00:45:36,220 But that's what I used. 729 00:45:37,060 --> 00:45:41,300 And in the open OCD, you just tell it the driver to use is FTDI. 730 00:45:41,500 --> 00:45:42,800 It will automatically attach to it. 731 00:45:42,800 --> 00:45:44,220 So, yeah. 732 00:45:44,320 --> 00:45:46,040 That's $15, man. 733 00:45:46,160 --> 00:45:47,520 So that's the one I use. 734 00:45:48,240 --> 00:45:49,400 Any more questions? 735 00:45:50,620 --> 00:45:51,260 Yes? 736 00:45:51,540 --> 00:45:54,960 Have you been working with Cortex M3 and M4? 737 00:45:55,280 --> 00:45:57,040 So basically the Archons? 738 00:45:59,400 --> 00:46:02,520 What did you take on, like, trusted platforms? 739 00:46:03,000 --> 00:46:05,380 I mean, MLTI. 740 00:46:05,740 --> 00:46:08,500 So this one is kind of a heavy question. 741 00:46:08,700 --> 00:46:11,840 So he was talking about the Cortex M3, M4s. 742 00:46:11,840 --> 00:46:14,760 You know, the real-time devices and the trusted model. 743 00:46:15,400 --> 00:46:16,120 Trusted models, right? 744 00:46:16,560 --> 00:46:17,200 Trusted platform. 745 00:46:17,480 --> 00:46:17,720 Yes. 746 00:46:17,780 --> 00:46:18,320 Trusted platform. 747 00:46:18,420 --> 00:46:19,340 I haven't looked into that. 748 00:46:19,400 --> 00:46:20,600 So I don't know at this time. 749 00:46:21,120 --> 00:46:22,500 So I would have to follow up later. 750 00:46:22,660 --> 00:46:23,640 So right now, I just don't know. 751 00:46:23,760 --> 00:46:24,700 I don't want to give you a bad answer. 752 00:46:26,480 --> 00:46:27,120 So, yeah. 753 00:46:27,200 --> 00:46:30,100 Let's sync up afterwards because I want to find you that answer because I'm curious now 754 00:46:30,100 --> 00:46:30,380 as well. 755 00:46:31,080 --> 00:46:31,800 Any more questions? 756 00:46:35,240 --> 00:46:35,560 No? 757 00:46:36,640 --> 00:46:38,280 Yeah, sure. 758 00:46:39,620 --> 00:46:41,820 So if you guys want to, you know, if you guys want to, you know, if you guys want 759 00:46:41,820 --> 00:46:46,660 to see what's going on in my not-so-interesting life, hold on one second. 760 00:46:48,880 --> 00:46:49,280 Yeah. 761 00:46:49,420 --> 00:46:53,360 So my Twitter is, it's BlackOwl, but someone already had that name. 762 00:46:53,500 --> 00:46:54,240 So I said no. 763 00:46:54,480 --> 00:46:56,740 So I replaced the L with a 1 and the O with a 0. 764 00:46:58,000 --> 00:46:58,840 That's about it. 765 00:46:58,860 --> 00:46:59,480 Nothing too crazy. 766 00:47:00,020 --> 00:47:04,160 The image is I was fuzzing libpng with an owl image and it looks pretty cool so I took 767 00:47:04,160 --> 00:47:04,500 a screenshot. 768 00:47:06,220 --> 00:47:07,020 So, yeah. 769 00:47:07,120 --> 00:47:07,580 That's about it. 770 00:47:07,760 --> 00:47:09,380 Any more questions before I just wrap up? 771 00:47:11,380 --> 00:47:11,780 No? 772 00:47:11,820 --> 00:47:12,040 Great. 773 00:47:12,160 --> 00:47:13,280 Again, thank you guys. 774 00:47:13,840 --> 00:47:14,860 Have a great conference.