1 00:00:00,000 --> 00:00:10,120 You guys having a good day? All right. Well, hopefully you're in the right place. One of the 2 00:00:10,120 --> 00:00:17,500 things that I do for a living, I teach at a university and, you know, whenever you go to 3 00:00:17,500 --> 00:00:22,880 school, the first day of school, the biggest question in everyone's mind is did I go to the 4 00:00:22,880 --> 00:00:28,300 right classroom? Thankfully we have nice big projectors so if you're not here to learn about 5 00:00:28,300 --> 00:00:34,760 endpoint security and USB impersonation, go somewhere else unless you're probably all really 6 00:00:34,760 --> 00:00:40,140 just here anyway because the other tracks you really wanted to go to were full. That's okay. I 7 00:00:40,140 --> 00:00:48,820 can live with that. All right. So let's get started. Just a little bit of a road map. Why this 8 00:00:48,820 --> 00:00:57,960 talk? Who is this handsome guy up here? A little bit of brief history of USB. How does USB work? 9 00:00:59,640 --> 00:01:07,640 We'll talk about descriptors and endpoints in USB. Then we'll delve into mass storage devices. How 10 00:01:07,640 --> 00:01:13,660 do they work? And then we'll talk about the good stuff. How do you bypass endpoint security 11 00:01:13,660 --> 00:01:21,880 anyway? Talk about some microcontrollers, devices that you can build for 20 bucks or less, as 12 00:01:21,880 --> 00:01:28,280 advertised. And a little bit about some future directions that you might do. All right. So, a lot of 13 00:01:28,280 --> 00:01:33,200 about. So why this talk, anyway? Well, there are some organizations that are starting to use 14 00:01:33,200 --> 00:01:42,720 endpoint security programs in order to restrict portable media. They're tired of everybody just 15 00:01:42,720 --> 00:01:48,780 bringing in their stuff and sucking things off of their networks. In the movies, what happens, 16 00:01:48,900 --> 00:01:55,960 right? Someone has stolen all the secrets onto a flash drive and surprisingly nobody notices until 17 00:01:55,960 --> 00:01:58,260 after they've left the building. Did you ever notice that? Pretty much anyone knows they've left the building. They're 18 00:01:58,280 --> 00:02:02,140 notice that? There's an alarm. Oh, wait. They just left. Darn 19 00:02:02,140 --> 00:02:08,500 it. All right. So a lot of software out there exists that 20 00:02:08,500 --> 00:02:11,820 is starting to come into the market that does the equivalent 21 00:02:12,440 --> 00:02:17,800 of Mac filtering but for USB. And if you know anything about 22 00:02:17,800 --> 00:02:22,740 Wi-Fi, you know Mac filtering doesn't work. So basically what 23 00:02:22,740 --> 00:02:26,120 do they do? They have device, they have software that says are 24 00:02:26,120 --> 00:02:30,760 you on my good list, are you on my white list, your vendor ID 25 00:02:30,760 --> 00:02:35,660 and product ID and if you're not, well, guess what, I'll 26 00:02:35,660 --> 00:02:38,440 show you how you can build something for cheap that makes 27 00:02:38,440 --> 00:02:43,020 your device look like it's on that list. And why would you 28 00:02:43,020 --> 00:02:46,080 want to do that? Two reasons. You want to inject something 29 00:02:46,080 --> 00:02:51,560 and you want to extract something. So who is this 30 00:02:51,560 --> 00:02:55,720 handsome guy? I teach security at a small private 31 00:02:55,720 --> 00:02:56,100 labeling center. I teach security at a private 32 00:02:56,120 --> 00:03:00,380 University in Iowa. I like to hack hardware. I've been known 33 00:03:00,380 --> 00:03:05,860 to fly and build airplanes and do other fun stuff. And the last 34 00:03:05,860 --> 00:03:11,480 couple years I've been known to play with USB devices. So USB 35 00:03:11,480 --> 00:03:15,280 something has been around for quite a while. 96 they released 36 00:03:15,280 --> 00:03:18,220 the first spec and then they quickly updated it a couple 37 00:03:18,220 --> 00:03:24,300 years later. Back in the olden days they had 1.5 and 12 38 00:03:24,300 --> 00:03:29,500 megabit speeds. 1.5 was called low speed and then 12 was called 39 00:03:29,500 --> 00:03:36,160 full speed. And then in 2000 they came out with a new spec 40 00:03:36,160 --> 00:03:42,340 and they added high speed, 480 megabits per second. Then they 41 00:03:42,340 --> 00:03:45,580 kind of took a break for a bit and they came out with USB 3. 42 00:03:46,240 --> 00:03:50,280 We're starting to see some USB 3 devices now that are really 43 00:03:50,280 --> 00:03:54,280 getting out there and they claim speeds of up to 5.5 44 00:03:54,280 --> 00:03:58,200 gigabits per second. It's kind of like my cable modem internet. 45 00:03:59,060 --> 00:04:04,000 Yeah. Up to 15 megabits per second. Why is it I always get 46 00:04:04,000 --> 00:04:11,120 three? All right. So how does this stuff work anyway? Well, 47 00:04:11,240 --> 00:04:14,300 it's made to be very simple. Simple from a user standpoint. 48 00:04:15,140 --> 00:04:19,200 So they have some nice idiot proof hardware. It's a pretty 49 00:04:19,200 --> 00:04:23,780 simple four wire protocol. And it's set up so that you cannot 50 00:04:24,540 --> 00:04:29,760 screw it up unless you try, right? So, you know, if you're 51 00:04:29,760 --> 00:04:34,840 used to going old school serial, you know that you can very 52 00:04:34,840 --> 00:04:39,440 easily hook something up wrong and you're like, oh, that's the 53 00:04:39,440 --> 00:04:44,020 wrong kind of RS-232 cable. Or, oh, it's got the 25 pin and I 54 00:04:44,020 --> 00:04:47,480 needed the 9. And, oh, it's not a no modem cable. And they got 55 00:04:47,480 --> 00:04:52,920 rid of all of that hassle. Also made it hot pluggable and they 56 00:04:52,920 --> 00:04:54,260 use differential voltages. So you don't have to worry about 57 00:04:58,260 --> 00:05:02,840 that. And you can have some fairly long USB cables as much as 58 00:05:02,840 --> 00:05:08,740 16 feet. All right. There's some software involved. There's 59 00:05:08,740 --> 00:05:11,440 automatic configuration. There's no jumpers or anything 60 00:05:11,440 --> 00:05:14,480 like that that you need to use. There's a process called 61 00:05:14,480 --> 00:05:19,040 enumeration where it basically goes to the device and says, 62 00:05:19,100 --> 00:05:24,260 tell me about yourself. And within the standard, you can 63 00:05:24,280 --> 00:05:25,780 use a lot of different things. So we have some standard classes 64 00:05:26,480 --> 00:05:30,140 for our devices. So we have human interface devices, 65 00:05:30,960 --> 00:05:35,180 printers, audio devices. And then for today, we want to talk 66 00:05:35,180 --> 00:05:41,420 about mass storage devices. So how does this work? Well, it's a 67 00:05:41,420 --> 00:05:45,720 12-step process. Now, of course, I have some friends in 68 00:05:45,720 --> 00:05:48,360 the media and they tell me that all hackers are intimately 69 00:05:48,360 --> 00:05:54,260 familiar with 12-step programs. All right. So, you know, it's a 70 00:05:54,260 --> 00:05:56,500 little bit difficult, but you know what happens. You connect 71 00:05:56,500 --> 00:06:00,740 device and the hub detects it and the host, which is usually a 72 00:06:00,740 --> 00:06:05,680 PC, says, hey, it's informed there's a new device. And then 73 00:06:05,680 --> 00:06:08,340 it starts talking to it and says, what are your speeds, what 74 00:06:08,340 --> 00:06:11,760 are your capabilities, and it resets it, gives it an address, 75 00:06:12,040 --> 00:06:17,740 et cetera, et cetera, et cetera. All right? So it all 76 00:06:17,740 --> 00:06:23,740 comes down to descriptors and endpoints. So an endpoint is 77 00:06:23,740 --> 00:06:24,240 really a blip. You can't say, I'm not going to do that. You can't 78 00:06:24,260 --> 00:06:34,480 a virtual wire or a pipe, if you will. It's a unidirectional virtual pipe. And by the way, 79 00:06:34,480 --> 00:06:40,960 the endpoints have a direction and the direction is measured relative to the host. So sometimes 80 00:06:40,960 --> 00:06:44,540 things might seem a little backwards when you're dealing with USB. You might think, 81 00:06:44,640 --> 00:06:49,680 but wait, I'm sending stuff out. No, you're sending stuff in to the host. 82 00:06:49,680 --> 00:06:56,580 All right. Fortunately, a lot of the things like fragmentation, handshaking, and all that 83 00:06:56,580 --> 00:07:00,960 is done in hardware. You can get specialized controller chips to do this. 84 00:07:01,560 --> 00:07:10,240 And the address for each endpoint has a meaning. The high bit tells you whether it's in or out. 85 00:07:11,700 --> 00:07:18,340 And there are various types of endpoints. Control endpoints are something that every device has to 86 00:07:18,340 --> 00:07:19,660 have. You can use them to control your device. You can use them to control your device. You can 87 00:07:19,680 --> 00:07:26,800 have bulk endpoints, which we'll talk about a bit today. Interrupt endpoints and also 88 00:07:27,540 --> 00:07:35,220 isocrinthus endpoints. All right. So control endpoints. Most devices use this to communicate 89 00:07:35,220 --> 00:07:42,060 with the host. And every device has to have at least one. We call it endpoint zero, not endpoint 90 00:07:42,060 --> 00:07:49,320 one, because we don't program in BASIC. And the devices must respond to standard requests. So 91 00:07:49,320 --> 00:07:56,700 these standard requests are things like, hey, get, set your address, give me descriptors, change 92 00:07:56,700 --> 00:08:02,380 your power settings, and what's your status anyway? Some of you may have gotten status input 93 00:08:02,380 --> 00:08:12,200 from your badges. How many of you have hooked those up to USB yet? Really? That's all? Okay. Just 94 00:08:12,200 --> 00:08:19,300 a little hint. They'll talk to you and tell you status. Okay. All right. So the device is 95 00:08:19,320 --> 00:08:29,360 going to respond to specific class requests for the class of device and optionally vendor 96 00:08:29,660 --> 00:08:38,440 requests. So you could in theory have a very special driver for your kind of mass storage 97 00:08:38,440 --> 00:08:44,160 device. In practicality, nobody does that because nobody wants to rewrite the drivers. All right. 98 00:08:49,320 --> 00:08:54,780 So the data stages and the control endpoint transfer, you have a setup stage, hey, let's talk, 99 00:08:55,780 --> 00:09:04,800 maybe a data stage, depending on the kind of communication, and then a status. All right. So 100 00:09:06,280 --> 00:09:12,580 the status stage, you just send a zero-link packet back that says, yeah, we're all good. 101 00:09:15,220 --> 00:09:19,120 Interrupt, isosynchronous, don't really want to talk about them, but just so you know what they are, 102 00:09:19,120 --> 00:09:25,560 interrupts for infrequent communications, things like miles, keyboard, stuff like that. 103 00:09:27,100 --> 00:09:35,600 Isosynchronous is good for streaming media, et cetera. All right. Bulk endpoints. The good stuff. 104 00:09:36,760 --> 00:09:43,220 Bulk endpoints are used for mass storage devices. They don't have any guarantees on latency, 105 00:09:43,460 --> 00:09:49,100 but if their bus is idle, which it usually is, you have some pretty good performance. So if you're 106 00:09:51,060 --> 00:09:53,820 able to run it on your bus, it's a good product. It, however, if there are other kinds of 107 00:09:53,820 --> 00:10:00,380 transports on your bus, it gets superseded by anything else. If you're doing full speed 108 00:10:00,380 --> 00:10:06,600 communications, you know, that whopping 12 megabits per second, you're allowed 864 byte packets, 109 00:10:07,300 --> 00:10:13,840 and keep that number in mind for later. It will be relevant. If you're doing high speed transfers, 110 00:10:14,060 --> 00:10:19,100 you can use 512-byte packets. And this is your data and you can see that, you can use your data in the 111 00:10:19,100 --> 00:10:23,180 used pretty extensively in flash drives, also external hard 112 00:10:23,180 --> 00:10:31,080 drives. So the transactions consist of a token packet and 113 00:10:31,080 --> 00:10:38,120 then some data possibly and then you send an act at the end. So 114 00:10:38,480 --> 00:10:44,680 what's a descriptor? Well, the, right? Descriptor. Describes 115 00:10:44,680 --> 00:10:51,500 things. They all have a standard format. The first byte says this 116 00:10:51,500 --> 00:10:55,400 is how big this descriptor is. In other words, hardware on the 117 00:10:55,400 --> 00:10:58,420 other side, this is when you should stop reading information. 118 00:10:59,660 --> 00:11:03,080 This is when we're done. The second byte is what kind of 119 00:11:03,080 --> 00:11:07,260 descriptor was this thing anyway? And the rest of it is 120 00:11:07,260 --> 00:11:11,600 the actual descriptor. Some common types of descriptors. A 121 00:11:11,600 --> 00:11:14,660 device descriptor is what's gotten first and then the 122 00:11:14,680 --> 00:11:21,000 basic stuff like, hey, how can I talk to this device? What sort of 123 00:11:21,000 --> 00:11:24,580 power requirements does it need? Things like that. Configurations. 124 00:11:25,480 --> 00:11:29,460 I'm sorry. Configuration tells you how much power. How many 125 00:11:29,460 --> 00:11:33,720 interfaces does it have? How do I talk to it, et cetera, et 126 00:11:33,720 --> 00:11:38,940 cetera. Interface then goes on to further describe the device 127 00:11:38,940 --> 00:11:44,260 and then we have endpoint descriptors which tell us about 128 00:11:44,260 --> 00:11:44,660 each of the different types of descriptors. And then we have 129 00:11:44,680 --> 00:11:48,400 each of the endpoints and then string descriptors which just 130 00:11:48,960 --> 00:11:54,340 give us strings and Unicode. All right. So device descriptor, 131 00:11:55,260 --> 00:11:58,100 what does it send you? First thing it's going to send you is 132 00:11:58,100 --> 00:12:02,020 the length and then the descriptor type. In this case, 133 00:12:02,040 --> 00:12:09,420 it's descriptor type 1. USB and BCD. It's going to send 200 and 134 00:12:09,420 --> 00:12:14,000 hex. And then it's going to send you a couple of important pieces 135 00:12:14,000 --> 00:12:17,840 of information, namely the class, subclass and protocol. 136 00:12:18,780 --> 00:12:24,660 Now, in the spec, in the USB spec, you can send zeros which 137 00:12:24,660 --> 00:12:28,600 mean, oh, well, I'm not going to tell you yet. I will tell you 138 00:12:28,600 --> 00:12:32,340 in the latter lower down descriptor. All right. So I'm 139 00:12:32,340 --> 00:12:35,100 not going to tell you in the device descriptor. Maybe I'll 140 00:12:35,100 --> 00:12:38,460 tell you in the configuration descriptor or the interface 141 00:12:38,460 --> 00:12:43,880 descriptor. All right. And, you know, other things like packet 142 00:12:43,880 --> 00:12:49,880 sizes. And then we have a manufacturer ID and a product ID. 143 00:12:50,660 --> 00:12:54,140 And in some cases, a serial number that has to be filled out. 144 00:12:57,020 --> 00:13:02,280 So this configuration descriptor is gotten next and, again, it 145 00:13:02,940 --> 00:13:08,780 starts with the length and then at the type, it's type 2. 146 00:13:09,200 --> 00:13:13,860 They're real creative, right? One, two, et cetera. And then 147 00:13:13,880 --> 00:13:18,300 it gives you some information. The last bit that it gives you is 148 00:13:18,300 --> 00:13:22,760 the maximum power. All right. Now, if you're going to make a 149 00:13:22,760 --> 00:13:27,100 little device, say something kind of like this, a little 150 00:13:27,100 --> 00:13:33,080 preview, that is going to fake another device, obviously I have 151 00:13:33,080 --> 00:13:36,780 some electronics that are going to require a little bit of power 152 00:13:36,780 --> 00:13:40,100 of their own in addition to whatever my thumb drive takes, 153 00:13:41,560 --> 00:13:43,860 some people might be tempted to just, well, I'm not going to do 154 00:13:43,880 --> 00:13:47,200 that. I'm just going to crank up the power. Don't do that. All 155 00:13:47,200 --> 00:13:51,160 right. The problem with that is if you crank up the power and 156 00:13:51,160 --> 00:13:55,580 your port cannot provide that much power, it won't enumerate 157 00:13:55,580 --> 00:13:59,420 your device. All right. So usually 100 milliamps is pretty 158 00:13:59,420 --> 00:14:03,460 safe. And it's probably enough anyway. All right. So don't get 159 00:14:03,460 --> 00:14:06,180 lazy and get all gung ho and like, yeah, I think I need a 160 00:14:06,180 --> 00:14:10,920 watt of power or five watts of power here. No. Don't do that. 161 00:14:11,200 --> 00:14:12,460 Just a little tip. 162 00:14:13,880 --> 00:14:17,560 All right. Then we get an interface descriptor. And again, 163 00:14:17,660 --> 00:14:21,860 in the interface descriptor, we can have the class, subclass, and 164 00:14:21,860 --> 00:14:27,360 protocol. If we had zeros in the earlier descriptors, then we 165 00:14:27,360 --> 00:14:30,200 eventually do have to say, this is what kind of device this is. 166 00:14:32,700 --> 00:14:36,340 And then we have to describe our endpoints. Well, in the case of a 167 00:14:36,340 --> 00:14:39,960 mass storage device, as I'll say in a little bit, you're going to 168 00:14:39,960 --> 00:14:43,600 have at least three endpoints, control endpoint, bulk in, bulk 169 00:14:43,600 --> 00:14:43,860 out. All right. All right. All right. All right. All right. All 170 00:14:43,880 --> 00:14:47,620 right. All right. All right. And each of those endpoints has an 171 00:14:47,620 --> 00:14:52,220 address. And remember that the high order bit tells you the 172 00:14:52,220 --> 00:14:56,420 direction. And then it has an attribute bit field as well. And 173 00:14:56,420 --> 00:15:01,280 the attribute bit field will tell you things like, is this a 174 00:15:01,280 --> 00:15:08,160 bulk endpoint? Another thing you should keep in mind, you know, 175 00:15:08,160 --> 00:15:13,860 all this stuff you can get, USB.org, et cetera, a lot of 176 00:15:13,860 --> 00:15:17,660 these bits are reserved. If they're not zero, things tend to 177 00:15:17,660 --> 00:15:22,460 crash on you. All right. So just zero out stuff if it's not 178 00:15:24,520 --> 00:15:27,060 specified. All right. And then we have string descriptors. 179 00:15:27,980 --> 00:15:32,320 String descriptors give you Unicode text. Again, the first 180 00:15:32,320 --> 00:15:34,600 thing it's going to give you is the length. Then it's going to 181 00:15:34,600 --> 00:15:39,240 give you the type. It's type 3. It's a string descriptor. And 182 00:15:39,240 --> 00:15:43,840 then it's going to give you a Unicode string. It's going to 183 00:15:43,840 --> 00:15:46,680 give you the type. Which for most of us here is pretty much 184 00:15:46,680 --> 00:15:54,440 ASCII text where every other byte is just zero. There is a 185 00:15:54,440 --> 00:15:58,760 special case. And the special case is string descriptor zero. 186 00:15:58,900 --> 00:16:02,900 String descriptor zero says what languages do you speak 187 00:16:02,900 --> 00:16:10,800 please? All right. And here is proof that the USA has fixed and 188 00:16:10,800 --> 00:16:13,820 improved the English language that we got from the USA. So 189 00:16:13,840 --> 00:16:16,260 now you can use the U.S. and the British. Because even devices 190 00:16:16,260 --> 00:16:23,860 you get from the U.K. report speaking U.S. English. Which is 191 00:16:23,860 --> 00:16:31,200 by the way hex code 409. Is that formula 409? Cleaning up the 192 00:16:31,200 --> 00:16:34,400 language? I don't know. All right. So now that we've 193 00:16:34,400 --> 00:16:39,140 learned a little bit about general devices and such, without 194 00:16:39,140 --> 00:16:42,280 further delay, let's talk a little bit about bulk only mass 195 00:16:42,280 --> 00:16:46,320 mass storage devices. How does this stuff work? So we're 196 00:16:46,320 --> 00:16:49,040 talking about flash drives primarily. What kind of hardware 197 00:16:49,040 --> 00:16:52,600 do they have, software, file systems, how do you talk to 198 00:16:52,600 --> 00:16:56,940 them, things like that. Here's a picture I shamelessly pulled off 199 00:16:56,940 --> 00:17:03,200 of Wikipedia, all right, of a flash drive. So you can see the 200 00:17:03,200 --> 00:17:08,280 different components, you know, you see things such as a big 201 00:17:08,280 --> 00:17:13,220 NAND flash chip, a little controller chip, et cetera. By 202 00:17:13,220 --> 00:17:16,000 the way, the little silver can, you probably know this from 203 00:17:16,000 --> 00:17:19,340 looking at your badges for the conference here, is a crystal 204 00:17:19,340 --> 00:17:25,300 oscillator. Some of the newer drives, by the way, I've taken 205 00:17:25,300 --> 00:17:28,720 apart a few of these, and some of the new ones, they come in 206 00:17:28,720 --> 00:17:31,300 this big case and they have this big case and you're looking at 207 00:17:31,300 --> 00:17:34,060 it and you're thinking, okay, it probably looks like this 208 00:17:34,060 --> 00:17:37,020 inside. I mean, after all, Phil got this picture off of 209 00:17:37,020 --> 00:17:38,260 Wikipedia. And it's not the same thing. It's the same 210 00:17:38,280 --> 00:17:43,640 thing. It's never wrong. So sometimes you'll actually pull 211 00:17:43,640 --> 00:17:46,400 one of these apart and you'll find out that it's a big empty 212 00:17:46,400 --> 00:17:50,120 case and they have one integrated circuit. It's 213 00:17:50,120 --> 00:17:53,680 really integrated. It's the little spacer in the USB 214 00:17:53,680 --> 00:17:58,600 connector. It's literally a chip that's got the four leads 215 00:17:58,960 --> 00:18:02,040 built onto it. And you're like, really? I had this thing that 216 00:18:02,040 --> 00:18:04,580 was, you know, a couple inches long. There was absolutely 217 00:18:04,580 --> 00:18:08,200 nothing inside of it. It even had a little sliding case and 218 00:18:08,280 --> 00:18:13,460 everything. But just FYI. So typically these thumb drives use 219 00:18:13,460 --> 00:18:17,960 NAND flash storage. You get about 10,000 write cycles on 220 00:18:17,960 --> 00:18:23,340 these. If you're writing to them in particular, you'd only get 221 00:18:23,340 --> 00:18:26,720 anywhere close to that 480 megabits per second, by the way. 222 00:18:27,280 --> 00:18:32,440 Again, it's like the cable modem. Up to this. But not even 223 00:18:32,440 --> 00:18:37,680 close. You can only write to it in blocks. Typical block sizes 224 00:18:37,680 --> 00:18:43,380 are 512 bytes. You can have other larger block sizes, 225 00:18:43,740 --> 00:18:46,620 although honestly I have a whole stack of these sitting on my 226 00:18:46,620 --> 00:18:49,740 desk at home and I haven't seen a single one of them with these 227 00:18:49,740 --> 00:18:53,300 large blocks. Maybe I just don't buy the right drives. I 228 00:18:53,300 --> 00:18:57,020 guess I like the cheap ones. Maybe that's what it is. And 229 00:18:57,740 --> 00:19:03,280 you can have some forensic fun with those as well. So how does 230 00:19:03,280 --> 00:19:07,160 this work? These flash drives present themselves as a SCSI 231 00:19:07,160 --> 00:19:07,660 device. They're not just a flash drive. They're actually a 232 00:19:07,680 --> 00:19:10,500 device. So they really look like a SCSI hard drive to your 233 00:19:10,500 --> 00:19:16,180 computer. And you have typically 512 bytes sectors. And 234 00:19:16,180 --> 00:19:21,880 they use the SCSI control set. Most of these devices are 235 00:19:21,880 --> 00:19:28,360 preformatted as one partition. We don't call them partitions 236 00:19:28,360 --> 00:19:31,200 for flash drives. We call them logical units. We call them 237 00:19:31,200 --> 00:19:37,200 LUNs, logical unit numbers. By the way, here's a little tip. I 238 00:19:37,200 --> 00:19:41,200 have found that some versions of Windows do not see other than 239 00:19:41,200 --> 00:19:47,100 the first logical unit. So if you want to hide something on a 240 00:19:47,100 --> 00:19:52,120 thumb drive, put it on other than the first partition. And 241 00:19:52,120 --> 00:19:55,880 don't use a Windows compatible file system. That would be 242 00:19:55,880 --> 00:20:00,340 another good way. Sometimes the reported sizes don't match the 243 00:20:00,340 --> 00:20:06,360 actual sizes. And you can use that to hide some information. A 244 00:20:06,360 --> 00:20:11,640 few years ago, there was a big batch of cheap Chinese thumb 245 00:20:11,640 --> 00:20:14,960 drives that kind of went out in the market. I see some heads 246 00:20:14,960 --> 00:20:19,980 shaking. Did you buy one of those? No? Okay. But what they 247 00:20:19,980 --> 00:20:22,920 did is they over advertised. They said, hey, this is a four 248 00:20:22,920 --> 00:20:27,000 gig drive and it was really only two. And they figured by the time 249 00:20:27,000 --> 00:20:30,380 you filled it up past the two, then it would just start 250 00:20:30,380 --> 00:20:33,520 generating errors and they'd be like, well, I'm long gone by 251 00:20:33,520 --> 00:20:36,340 then. It's like buying something in the, you know, in the fleet. 252 00:20:36,360 --> 00:20:44,380 Sorry, it wasn't a real Rolex. But other things to keep in mind, 253 00:20:44,480 --> 00:20:49,660 typically, each 512 byte block needs 16 bytes for error 254 00:20:49,660 --> 00:20:53,880 correction. So you might wonder why is the software, why is the 255 00:20:53,880 --> 00:20:58,700 size not exactly what it's reported to be? Software usually 256 00:20:59,320 --> 00:21:04,280 implemented in a controller chip has to detect communications, 257 00:21:04,720 --> 00:21:05,800 respond to requests. 258 00:21:06,360 --> 00:21:12,700 Check for errors, manage power, things like that. What kind of 259 00:21:12,700 --> 00:21:15,920 file systems can you put on these things? Well, it's a 260 00:21:15,920 --> 00:21:21,140 block device. Whatever you want. Most of the time they come 261 00:21:21,140 --> 00:21:26,620 preformatted as FAT or FAT32. For external hard drives, I've 262 00:21:26,620 --> 00:21:31,960 seen those preformatted as NTFS or for a thumb drive, if you 263 00:21:31,960 --> 00:21:35,860 want to, you can put the true flash file system, the extreme, 264 00:21:36,360 --> 00:21:39,240 flash file system, the journaling flash file system or 265 00:21:39,240 --> 00:21:45,600 my personal favorite yet another flash file system. It's kind of 266 00:21:45,600 --> 00:21:53,560 like YAML. Again, if you want to maybe potentially hide some 267 00:21:53,560 --> 00:21:58,460 information from Windows users, a higher order LUN with a non 268 00:21:59,110 --> 00:22:03,340 Windows i.e. Linux only file system can work really well. 269 00:22:05,000 --> 00:22:09,460 All right. So how do you talk to this flash drive anyway? You 270 00:22:09,460 --> 00:22:12,540 have this bulk only mass storage protocol. Sometimes it's called 271 00:22:12,540 --> 00:22:19,720 BBB because it's all bulk. And unlike many devices, instead of 272 00:22:19,720 --> 00:22:23,860 using the control end points, you use the bulk end points. And 273 00:22:23,860 --> 00:22:27,000 there are three phases. There's a command block wrapper phase 274 00:22:27,640 --> 00:22:33,320 where you send a command block in a wrapper. Data transfer 275 00:22:33,340 --> 00:22:35,620 transport, depending on the command, and then a command 276 00:22:35,620 --> 00:22:38,680 status wrapper where you say, hey, did this succeed or not? 277 00:22:40,700 --> 00:22:44,240 All right. So most of these drives use a reduced SCSI 278 00:22:44,800 --> 00:22:50,480 instruction set. And, you know, if you have to send or receive 279 00:22:50,480 --> 00:22:56,560 data, you use a bulk end point for that. So what does this look 280 00:22:56,560 --> 00:23:00,320 like? Here's a little C structure for a command block 281 00:23:00,320 --> 00:23:03,320 wrapper. It starts with a signature. The signature is a 282 00:23:03,340 --> 00:23:07,740 really creative. Incidentally, kind of a funny story. I was 283 00:23:07,740 --> 00:23:12,580 reading a book on USB stuff a couple years ago. And they just 284 00:23:12,580 --> 00:23:17,000 had in hex, here is this code. And I'm looking at it. And they 285 00:23:17,000 --> 00:23:22,080 actually had it reversed. And I'm like, wow. That's just kind 286 00:23:22,080 --> 00:23:27,080 of obscure. Well, if you look at it, it types USB C for USB 287 00:23:27,080 --> 00:23:31,540 command. It's not so obscure. And then there's a tag that 288 00:23:31,540 --> 00:23:32,080 associates. 289 00:23:33,340 --> 00:23:36,700 You know, the packet, it's like a sequence number for TCP IP. 290 00:23:37,920 --> 00:23:42,120 And, you know, how long is it going to be? And some flags, 291 00:23:42,120 --> 00:23:45,380 et cetera. And then finally a command block wrapper. You have 292 00:23:45,380 --> 00:23:49,660 16 bytes in this wrapper. And real commands are going to use 293 00:23:49,660 --> 00:23:55,700 six to 16 of those. All right. So, for example, if I wanted to 294 00:23:55,700 --> 00:24:01,000 format a unit, I'm going to have a command block. It looks 295 00:24:01,000 --> 00:24:03,320 kind of like this. The first byte is going to be a command 296 00:24:04,020 --> 00:24:09,860 code. Again, what am I supposed to do? I have to know what the 297 00:24:09,860 --> 00:24:13,620 command is to know how much more I should really be looking at 298 00:24:13,620 --> 00:24:17,880 anyway. What's the logical unit number, et cetera, et cetera. 299 00:24:21,280 --> 00:24:24,740 Another example, if I want to do a read, there are different 300 00:24:24,740 --> 00:24:28,540 formats for read and write. This one is called read 10. And it's 301 00:24:28,540 --> 00:24:30,800 based on how long the command block is. 302 00:24:33,340 --> 00:24:37,500 All right. So what are some common SCSI commands? Format 303 00:24:37,500 --> 00:24:42,280 units is a good one because you can, in one atomic operation, 304 00:24:42,600 --> 00:24:47,780 just format the unit and erase it. Inquiry, how's it going? 305 00:24:48,820 --> 00:24:55,000 Mode select, mode sense, read, read format capacity, read 306 00:24:55,000 --> 00:25:00,180 capacity, all those other things. All right. Command 307 00:25:00,180 --> 00:25:03,320 status wrapper comes at the end. So you send a command status 308 00:25:03,340 --> 00:25:05,980 wrapper, command block, something happens, maybe some 309 00:25:05,980 --> 00:25:08,980 data is transferred, and at the end you send a command status 310 00:25:08,980 --> 00:25:13,620 wrapper, and it looks kind of like this. And again, real 311 00:25:13,620 --> 00:25:21,660 creative, USB S for status. By the way, if you're cheap and you 312 00:25:21,660 --> 00:25:25,680 want to view all this lovely USB traffic and you have a Linux 313 00:25:25,680 --> 00:25:31,280 machine, if you don't know this, you can use USB mod. So if you 314 00:25:31,280 --> 00:25:33,320 just do a mod probe, USB mod, you can do that. And you can do 315 00:25:33,340 --> 00:25:33,620 whatever you want to do with it. So if you just plug it on and 316 00:25:33,620 --> 00:25:36,240 you fire up Wireshark, guess what? All of a sudden you have a 317 00:25:36,240 --> 00:25:40,700 bunch of USB buses available for you to trace this stuff on. Comes 318 00:25:40,700 --> 00:25:45,240 in handy. Of course, hardware USB tracer would be nicer, but 319 00:25:45,920 --> 00:25:49,780 they're a little bit more expensive than free. All right. 320 00:25:50,300 --> 00:25:53,160 Enough of this background stuff. Let's talk about the good stuff. 321 00:25:53,280 --> 00:25:58,840 How do I bypass this security anyway? So essentially what 322 00:25:58,840 --> 00:26:03,140 we're doing is impersonation or social engineering USB style. 323 00:26:03,340 --> 00:26:09,640 If you will. All right. So if we know what an authorized 324 00:26:09,640 --> 00:26:19,920 vidpid is, we can use that fact to mount a device and then inject 325 00:26:19,920 --> 00:26:26,380 some code, get some stuff off of our device. Also, the device 326 00:26:26,380 --> 00:26:29,540 that I designed optionally allows you to do some write blocking. 327 00:26:31,360 --> 00:26:33,320 So we'll use some microcontrollers, we'll use some 328 00:26:33,340 --> 00:26:36,000 microcontrollers, because they're fun and they're cheap. 329 00:26:37,280 --> 00:26:40,140 So, you know, when you're going to use a microcontroller, you 330 00:26:40,140 --> 00:26:43,740 can look at the different possibilities and say which 331 00:26:43,740 --> 00:26:48,460 one should I use? Well, AVR is pretty popular, it's used in 332 00:26:48,460 --> 00:26:52,120 the Arduino family. A lot of code out there, unfortunately 333 00:26:52,880 --> 00:26:57,960 doesn't do USB very well. Even the U series chips, yeah, you 334 00:26:57,960 --> 00:27:02,700 don't need the FTD i chip anymore. But they don't do mass 335 00:27:02,700 --> 00:27:03,320 storage. So if you have a battery that is that big, or the 336 00:27:03,320 --> 00:27:07,960 They will do HID stuff, but they don't do the mass storage stuff. Same thing is true 337 00:27:07,960 --> 00:27:14,020 with the PIC family. A lot of people like them. I like them. They're fine. But just 338 00:27:14,020 --> 00:27:21,020 not good for this purpose. So the winner is neither of those. A couple years ago, FTDI, 339 00:27:21,240 --> 00:27:26,840 you know, the people that make those little USB interface chips, came up with a micro 340 00:27:26,840 --> 00:27:31,840 controller of their own. Maybe they got tired of just making the interface chips. It's a 341 00:27:31,840 --> 00:27:40,340 little faster, 48 megahertz. And unlike the Arduinos, it has sort of a proper real time 342 00:27:40,340 --> 00:27:48,860 operating system. It's got threads and semaphores and cool stuff like that. And more importantly, 343 00:27:48,940 --> 00:27:58,600 USB classes. So how does this work? These Finklum 2 chips allow for two full speed USB 2.0 344 00:27:58,600 --> 00:28:01,820 interfaces which can be host or slave interfaces. And they can be connected to the 345 00:28:01,820 --> 00:28:02,500 Internet for a little while and then you can just kind of plug it into something. And they 346 00:28:02,500 --> 00:28:09,020 The chip also has a whopping 256K of flash memory, which if you don't do micro controllers 347 00:28:09,020 --> 00:28:15,420 doesn't sound like a lot. And if you do, it does. 16K Ram and normal micro controller 348 00:28:15,420 --> 00:28:22,660 kind of stuff. They have several development modules available, which is a good thing, 349 00:28:22,700 --> 00:28:29,680 because they only provide their chips in surface mount technology. So it can be a real pain 350 00:28:29,680 --> 00:28:31,800 in the butt for prototyping and things like that. But you know, you should always be aware. 351 00:28:31,800 --> 00:28:39,060 that. They also have their yet another Arduino clone. It's got 352 00:28:39,060 --> 00:28:44,040 the Arduino format sort of with an extra row of pins that you 353 00:28:44,040 --> 00:28:50,080 can use. They come in these surface mount packages. Here's a 354 00:28:50,080 --> 00:28:54,660 basic diagram of the block diagram of the chip which I'm 355 00:28:54,660 --> 00:29:01,680 sure you guys can't read anyway. It does have a fairly decent 356 00:29:01,800 --> 00:29:05,560 IDE. It's not eclipse or anything like that. But it gets 357 00:29:05,560 --> 00:29:10,700 the job done. It has debugging facilities and such. So it does 358 00:29:11,240 --> 00:29:16,260 work. And in there, they do have this nice ability where you can 359 00:29:16,260 --> 00:29:19,720 pull up the chip that you're going to target and you can 360 00:29:19,720 --> 00:29:22,780 point and click and say this pin is going to do this and this pin 361 00:29:22,780 --> 00:29:27,360 is going to do that. And again, one other difference between the 362 00:29:27,360 --> 00:29:31,780 AVR series, say, and these FTDI chips is that you can pull up 363 00:29:31,780 --> 00:29:33,300 the chip that you're going to target. And the AVR is when you 364 00:29:33,300 --> 00:29:36,660 go from one size chip to the next, it changes the amount of 365 00:29:36,660 --> 00:29:40,360 RAM and flash where here it's consistent. So the only thing 366 00:29:40,360 --> 00:29:45,000 that changes, if I go from a 32 pin to a 64 pin, is the amount 367 00:29:45,000 --> 00:29:49,220 of IO pins I have available to me. So that can be nice and 368 00:29:49,220 --> 00:29:52,620 useful. You can develop something and then you can scale 369 00:29:52,620 --> 00:29:58,520 it up and down as required. Okay. So what's the small 370 00:29:58,520 --> 00:30:01,600 package look like? You know, if I just want something tiny, 371 00:30:02,100 --> 00:30:06,020 I can get something, I'm sure you guys can't see this so well, 372 00:30:06,160 --> 00:30:09,360 but it looks about like this. All right. So it's a little 32 373 00:30:09,360 --> 00:30:14,900 pin development board. And I only have four pins to solder. I 374 00:30:14,900 --> 00:30:19,900 can sacrifice an old USB printer cable, solder it on there. And 375 00:30:20,280 --> 00:30:24,620 the disclaimer, only four pins to solder if you're not fond of 376 00:30:24,620 --> 00:30:28,780 things like LCD displays and blinking lights and stuff like 377 00:30:28,780 --> 00:30:31,760 that. Okay. But so if you want to add that stuff to your 378 00:30:31,780 --> 00:30:34,220 stuff, then, okay, maybe you do have to solder a little bit 379 00:30:34,220 --> 00:30:40,820 more. If you're really not into soldering, you could use one of 380 00:30:40,820 --> 00:30:45,540 those Arduino clones, like this bingo board shown here. Now you 381 00:30:45,540 --> 00:30:48,240 don't have to solder on a cable because it's got a host and 382 00:30:48,240 --> 00:30:54,860 slave port built into it. Again, same disclaimer. All 383 00:30:54,860 --> 00:30:57,020 right. So how does this microcontroller-based 384 00:30:57,020 --> 00:31:01,280 impersonator work anyway? What it does is it allows you to 385 00:31:01,280 --> 00:31:01,760 install the microcontroller-based impersonator 386 00:31:01,780 --> 00:31:05,320 on your device. So you insert your flash drive, and it 387 00:31:05,320 --> 00:31:09,740 enumerates it. And then when the PC, when you plug this device in 388 00:31:09,740 --> 00:31:13,600 the PC, it says, oh, I see there's a new device. Let me 389 00:31:13,600 --> 00:31:17,200 enumerate it. And it tries to get an authorized vid-pid 390 00:31:17,200 --> 00:31:22,400 combination. All right. If it's not successful, it tries the 391 00:31:22,400 --> 00:31:24,820 next one. All right. So there are two basic modes of 392 00:31:24,820 --> 00:31:28,320 operation in the device. So you can either say, oh, well, I know 393 00:31:28,320 --> 00:31:31,760 what the vid-pid is, and I'll just set it. Or you can just 394 00:31:31,760 --> 00:31:37,000 try automatic mode. So in automatic mode, I have 500 of 395 00:31:37,000 --> 00:31:40,260 the most common vid-pid combinations, and it will just 396 00:31:40,260 --> 00:31:45,460 scan through those. So high-level design, it's a 397 00:31:45,460 --> 00:31:50,060 multi-threaded app. You know, you've got apps to say, hey, 398 00:31:50,180 --> 00:31:54,540 let's talk to this thumb drive, another thread that talks to 399 00:31:54,540 --> 00:31:58,140 your computer, some management threads, and things like that. 400 00:31:58,600 --> 00:32:01,740 Also, there's a timer thread. And what's the timer thread? 401 00:32:01,740 --> 00:32:05,760 What the timer thread does is if you're in the automatic mode, 402 00:32:06,920 --> 00:32:11,480 whenever the PC asks for a device descriptor, it says, oh, 403 00:32:11,520 --> 00:32:14,680 someone's trying to talk to me, and it starts a timer. If they 404 00:32:14,680 --> 00:32:18,280 stop talking to you after a second and they don't ask for 405 00:32:18,280 --> 00:32:23,300 additional descriptors, it says, oh, someone's blocking me. I'll 406 00:32:23,300 --> 00:32:26,140 go to the next one. And that's how that works. And there's also 407 00:32:26,140 --> 00:32:31,680 a thread for reading the buttons that come in. All right. So I 408 00:32:31,740 --> 00:32:35,460 have the main thread, sits around, waits for packets to 409 00:32:35,460 --> 00:32:41,260 come in. If it's a white-listed command, it forwards it on. It 410 00:32:41,260 --> 00:32:44,900 forwards on things like command block wrappers, performs the 411 00:32:44,900 --> 00:32:48,360 data transport phase, does a little man-in-the-middle action, 412 00:32:48,580 --> 00:32:55,760 and does the CSW passing. All right. If you're write blocking, 413 00:32:57,060 --> 00:33:01,720 if there are non-white-listed commands, it's just saying, oh, 414 00:33:01,740 --> 00:33:03,740 someone's trying to talk to me, and it says, hey, yeah, I got 415 00:33:03,740 --> 00:33:07,920 your command. And then it does any sort of data transport phase, 416 00:33:08,680 --> 00:33:13,120 and then it says, you're good. It worked. All right. And now, 417 00:33:13,200 --> 00:33:18,220 initially, in an early design of this, I actually returned a 418 00:33:18,220 --> 00:33:21,300 unsupported command status if you tried to do things like 419 00:33:21,300 --> 00:33:26,300 format my drive or write to it. And what I found is that, 420 00:33:26,380 --> 00:33:31,720 strangely enough, Windows does not handle it correctly. So I 421 00:33:31,740 --> 00:33:35,600 tell Windows, unsupported command. What do you think 422 00:33:35,600 --> 00:33:41,640 Windows does? Tries again and again and again, and it never 423 00:33:41,640 --> 00:33:48,120 gives up. It's really obnoxious. All right. So the main loop, 424 00:33:48,240 --> 00:33:53,500 you know, just sits around waiting for stuff. And then I 425 00:33:53,500 --> 00:33:57,760 have a bunch of handlers. So this is just a quick example for 426 00:33:57,760 --> 00:34:01,720 the inquiry command. It gets a command block wrapper. It gets a 427 00:34:01,740 --> 00:34:04,700 response. Allocates a little space. Forwards it to the 428 00:34:04,700 --> 00:34:11,380 device. Gets a response. Sends it back. And waits for a command 429 00:34:11,380 --> 00:34:14,360 status wrapper. Sends it back. You know, it's not rocket 430 00:34:14,360 --> 00:34:21,980 science here. Timer thread, as I said, will get started. And it 431 00:34:21,980 --> 00:34:29,980 will wait for a additional queries for descriptors. And it 432 00:34:29,980 --> 00:34:30,700 will get reset. 433 00:34:31,740 --> 00:34:33,280 And it will get a response if the device actually got fully 434 00:34:33,280 --> 00:34:39,520 enumerated. By the way, I don't currently have this set up this 435 00:34:39,520 --> 00:34:43,900 way, but you could start to brute force the Vid-Pid if you 436 00:34:43,900 --> 00:34:48,480 got to the end of the list. And, hey, source code is available 437 00:34:48,480 --> 00:34:53,520 if you want to do it. Other complications, Windows and Linux 438 00:34:53,520 --> 00:34:56,360 do treat these devices a little bit differently. One thing I've 439 00:34:56,360 --> 00:35:00,260 found is that Linux sucks in a whole lot of information at the 440 00:35:01,820 --> 00:35:05,880 Windows sucks in a lot less. It's one of the few cases where 441 00:35:05,880 --> 00:35:12,580 Windows sucks less. All right. So what did I do for my 442 00:35:12,580 --> 00:35:16,980 testing? Primarily I used UDEV rules. If you're not familiar 443 00:35:16,980 --> 00:35:20,580 with UDEV rules on Linux, they're a really powerful tool 444 00:35:20,580 --> 00:35:22,940 and they're a little bit addictive. They're kind of fun to 445 00:35:22,940 --> 00:35:29,340 play with. So what I did was set up some UDEV rules to say, 446 00:35:29,340 --> 00:35:33,480 here's my white list of mass storage devices. And if it's not 447 00:35:33,480 --> 00:35:40,160 on the list, you can't mount it. All right? My open source 448 00:35:40,160 --> 00:35:44,180 solution is a better value. It's equally ineffective, but at a 449 00:35:44,180 --> 00:35:48,840 better price. So why waste thousands of dollars when you 450 00:35:48,840 --> 00:35:55,800 can be just as insecure for free? All right. Enough. It's 451 00:35:55,800 --> 00:35:59,320 demo time. Some of the gamers might get the reference to 452 00:35:59,340 --> 00:36:06,860 this. Evan, that was just for you. So here's one version of 453 00:36:06,860 --> 00:36:10,520 the device. I realize you can't see it so well if I hold it up 454 00:36:10,520 --> 00:36:16,580 here. But this is the slightly bigger device. As far as the 455 00:36:16,580 --> 00:36:20,200 board on the right is just a programming board. And then I 456 00:36:20,200 --> 00:36:25,660 have an LCD display. And I have the actual development board. In 457 00:36:25,660 --> 00:36:29,320 this case, there's a thumb drive plugged into it. And I 458 00:36:29,340 --> 00:36:31,860 have two buttons. The pot you see there is just for adjusting 459 00:36:31,860 --> 00:36:36,360 the LCD. And then I have a red light and a green light for the 460 00:36:36,360 --> 00:36:40,360 right blocking status. All right. So it comes on initially 461 00:36:40,980 --> 00:36:44,560 right blocking so the green light should be on. The left 462 00:36:44,560 --> 00:36:50,160 most button can be used to toggle that status. And then the 463 00:36:50,160 --> 00:36:58,720 other buttons are used in order to set the bid and the PID. So 464 00:36:59,340 --> 00:37:03,180 you can set the bid and the PID. By the way, is Javid, Javid, are 465 00:37:03,180 --> 00:37:09,480 you here somewhere? All right. This video is dedicated to Javid 466 00:37:09,480 --> 00:37:15,860 Malik. Javid made a comment recently how there seemed to be a 467 00:37:15,860 --> 00:37:19,340 lot of videos out there on the Internet for hacking and security 468 00:37:20,360 --> 00:37:26,760 that are nothing but people typing and clicking with music. So I 469 00:37:26,760 --> 00:37:29,320 dedicate this actual slide to you. And I'm going to show you how to 470 00:37:29,320 --> 00:37:39,340 use a silent video with no music to Javid. If it plays. If it 471 00:37:39,340 --> 00:37:46,580 doesn't play, I dedicate it to Microsoft. It worked great in 472 00:37:46,580 --> 00:37:51,900 the speaker room earlier. That's all I can say. Oh, wait. It 473 00:37:51,900 --> 00:37:59,300 was already there. All right. So I'm going to go ahead and 474 00:38:01,560 --> 00:38:02,120 show you how to use a silent video with no music to Javid. Please 475 00:38:02,120 --> 00:38:02,860 stand by. 476 00:38:16,120 --> 00:38:19,880 If it helps you, you can imagine old-time music. 477 00:38:35,540 --> 00:38:36,940 . 478 00:38:56,300 --> 00:39:06,500 We got lucky today. Facts are easy. Of course, if they didn't have 479 00:39:06,500 --> 00:39:10,640 USB W, can you look in the registry. To make the demo quicker, I didn't. 480 00:39:17,580 --> 00:39:17,960 . 481 00:39:30,700 --> 00:39:33,620 So here you see the welcome screen and then it gives you an 482 00:39:33,620 --> 00:39:38,380 opportunity to set it or it goes into automatic. Notice that the 483 00:39:38,380 --> 00:39:47,940 green light is on. And I did time warp by the way. I 484 00:39:47,960 --> 00:39:49,500 didn't instantly mount my drive. 485 00:40:06,740 --> 00:40:09,360 I should have said insert Monty Python music here. 486 00:40:12,540 --> 00:40:13,260 Uh-oh. 487 00:40:30,680 --> 00:40:31,040 . 488 00:40:36,680 --> 00:40:37,040 . 489 00:40:37,040 --> 00:40:39,060 I got lucky. This guy had a payroll file on his 490 00:40:39,060 --> 00:40:39,400 desktop. 491 00:40:57,280 --> 00:40:58,680 . 492 00:41:03,640 --> 00:41:05,040 . 493 00:41:05,040 --> 00:41:05,280 . 494 00:41:05,280 --> 00:41:06,340 . 495 00:41:20,320 --> 00:41:34,340 All right. Just a little food for thought. How could we go 496 00:41:34,340 --> 00:41:38,760 from here? Well, we could possibly speed it up again if 497 00:41:38,760 --> 00:41:42,520 you look in the registry and try to find an authorized vid 498 00:41:42,520 --> 00:41:45,100 PID that's more previously loaded. By the way, if you're 499 00:41:45,100 --> 00:41:48,620 not familiar with USB dev view, it's a nice little tool. It 500 00:41:48,620 --> 00:41:52,020 tells you all kinds of useful information on previously 501 00:41:52,780 --> 00:41:58,720 attached USB devices, not just mass storage. We could use the 502 00:41:58,720 --> 00:42:04,320 larger device here to divine the vid PID and then possibly 503 00:42:05,600 --> 00:42:09,860 preprogram a bunch of smaller devices if we're going to, like, 504 00:42:09,880 --> 00:42:15,220 in mass go and attempt to do something, maybe say an 505 00:42:15,220 --> 00:42:20,140 organization, we knew what was authorized. Like everything else, 506 00:42:20,300 --> 00:42:24,660 you can thwart this device. It does only operate at full speed. 507 00:42:25,000 --> 00:42:30,320 If you were to detect that, you could possibly say, oh, I know 508 00:42:30,320 --> 00:42:34,320 that somebody is doing something bad. And you could 509 00:42:34,340 --> 00:42:37,760 use proprietary drivers, but you don't really see a lot of 510 00:42:37,760 --> 00:42:42,820 that out there. It's kind of even if you did, that's security 511 00:42:42,820 --> 00:42:48,860 through obscurity, which we all know is no security at all. One 512 00:42:48,860 --> 00:42:53,100 other thing, remember, who remembers what's the maximum 513 00:42:53,100 --> 00:43:00,740 packet size for a full speed USB endpoint? 64 bytes. What is 514 00:43:00,740 --> 00:43:04,320 the default block size? 64 bytes. 64 bytes. 64 bytes. 64 bytes. 515 00:43:05,360 --> 00:43:10,580 512. So what happens is it has to fragment and unfragment all 516 00:43:10,580 --> 00:43:14,320 those blocks. So that does give you a little bit of a 517 00:43:14,320 --> 00:43:18,600 performance penalty, unfortunately. But I don't know 518 00:43:18,600 --> 00:43:21,720 how you could do anything better other than find something that 519 00:43:21,720 --> 00:43:25,360 supports full speed. All right. Just a couple of references. 520 00:43:25,600 --> 00:43:32,620 These are in the conference DVD. You can go to my GitHub in a 521 00:43:32,620 --> 00:43:34,320 couple days since I kind of forgot to do that. But you can 522 00:43:34,340 --> 00:43:37,880 update it before I came out here. Or you can feel free to 523 00:43:37,880 --> 00:43:41,700 e-mail me. I'm also available on Twitter, just at peepholstra. I 524 00:43:41,700 --> 00:43:44,500 know it's not real creative, but people can find me. So 525 00:43:44,500 --> 00:43:45,340 thanks, guys.