1 00:00:01,680 --> 00:00:09,920 I would like to introduce our next two speakers because they are one of the very, very few that are actually doing Zigbee-style research and talking about it. 2 00:00:09,920 --> 00:00:19,340 So here's some really cool 802.15.4 stuff and I cannot begin to describe how awesome these guys are, so let's just get right on into it. 3 00:00:19,340 --> 00:00:21,060 This is Sergei and Ryan. 4 00:00:21,060 --> 00:00:21,980 Thank you. 5 00:00:21,980 --> 00:00:23,560 Hey guys. 6 00:00:31,180 --> 00:00:46,920 So what we want to talk about today is some hardware and some software to allow you to play with Zigbee and try to encourage you all that you want to screw with Zigbee and that you want to contribute to making the hardware and software more awesome so that you can continue to do this. 7 00:00:46,920 --> 00:00:51,520 So first of all, the requisite motivation slide, why do we even give a shit? 8 00:00:52,320 --> 00:00:55,140 Zigbee is used throughout a number of different things. 9 00:00:55,140 --> 00:00:58,760 Home automation, smart energy, security systems, healthcare, right? 10 00:00:58,800 --> 00:01:03,220 These are things we don't care about or maybe they're just called attack surfaces. 11 00:01:04,340 --> 00:01:15,700 And so what we're talking about today specifically is making sure that there's tools available for the practical exploration of these attack surfaces. 12 00:01:15,700 --> 00:01:24,700 So I recommend to you Wright's principle, security doesn't get better until tools for practical exploration of the attack surface are made available. 13 00:01:24,700 --> 00:01:28,320 This is something we believe in so much that we tried to get it on Wikipedia. 14 00:01:28,760 --> 00:01:36,420 Unfortunately we won that fight with one particular editor who didn't think it was noteworthy enough. 15 00:01:37,420 --> 00:01:41,880 He said we weren't allowed to cite all of our own papers as the fact that it exists. 16 00:01:42,500 --> 00:01:44,380 We cited a lot of papers. 17 00:01:44,380 --> 00:01:46,920 Joshua Wright said it, it's true. 18 00:01:51,320 --> 00:01:54,400 So specifically what we're going to talk about today, right? 19 00:01:54,400 --> 00:02:03,760 Zigbee is this whole stack and it goes into application specific things and has like huge 720 page specs and four of those. 20 00:02:03,760 --> 00:02:08,760 But what we're focusing on today is the physical and the Mac layer down here. 21 00:02:08,760 --> 00:02:18,700 And a lot of this stuff will be on the file layer because what we want to help people understand is just at the basis what's actually going on. 22 00:02:18,700 --> 00:02:25,560 So there's this like magic, you get a frame, you get an Ethernet packet, you get a Zigbee packet, it just magically appears. 23 00:02:25,560 --> 00:02:28,300 This diagram is a blatant lie. 24 00:02:28,660 --> 00:02:36,320 Sergey would call it a fairy tale told to small children to mislead them or something like that in a rant against higher education. 25 00:02:37,280 --> 00:02:46,800 But there was a talk given two days ago at B-Sides Las Vegas that talks about how all of this is a lie and breaks it down through the layers. 26 00:02:47,040 --> 00:02:52,300 But let's just say for the sake of this talk that a frame appears magically. 27 00:02:52,400 --> 00:02:56,860 And let's say that we could see the file layer, which you can't see in Wireshark, right? 28 00:02:56,860 --> 00:02:58,260 It doesn't show up there. 29 00:02:58,440 --> 00:03:01,400 What you see in Wireshark would be here on. 30 00:03:01,400 --> 00:03:04,040 That's the actual frame and the Mac layer. 31 00:03:04,040 --> 00:03:10,620 But for the frame to adjust to itself, you need for the radio reception to happen. 32 00:03:10,620 --> 00:03:13,400 There's a preamble, which synchronizes the clock. 33 00:03:13,400 --> 00:03:17,640 And then there's a starter frame delimiter, which says this is not just random noise you're hearing. 34 00:03:17,640 --> 00:03:19,140 This is a pack. 35 00:03:20,300 --> 00:03:35,640 And then, of course, the length of the packet is how many of those bytes will be taken for the body fed through a CRC and then compared with the frame check sum. 36 00:03:36,420 --> 00:03:38,600 Could you go back for a second? 37 00:03:38,600 --> 00:03:48,080 So the interesting thing about this is that we want to be able to manipulate not just the layer 2, but the layer 1. 38 00:03:48,100 --> 00:03:57,780 Say the preamble used for synchronization, mainly processed by the analog part of the chip for that reason. 39 00:03:57,780 --> 00:04:02,560 How much of this is actually enough to synchronize it? 40 00:04:02,560 --> 00:04:10,580 Are all of those 8 nibbles, symbols of ZigBee Phi, necessary? 41 00:04:10,580 --> 00:04:14,280 And the answer turns out to be it depends on the chip. 42 00:04:14,440 --> 00:04:16,620 Then the sync. 43 00:04:16,620 --> 00:04:31,220 It turns out that you can actually change the sync byte to something else, giving you the ability to transmit raw frames by using the packet-in-packet trick that neighbor Travis... 44 00:04:31,220 --> 00:04:32,740 Neighbor Travis... 45 00:04:32,740 --> 00:04:35,520 Who got distracted and went to find beer. 46 00:04:35,520 --> 00:04:37,920 Came up with... 47 00:04:37,920 --> 00:04:46,140 And our raw frame injection depends on that ability. 48 00:04:46,140 --> 00:05:05,260 So what we're going to show is that with these peripherals of ours, or any similar peripherals such as T-modes, you can actually construct raw frames with arbitrary preambles, arbitrary, well, syncs, and any length you like. 49 00:05:06,380 --> 00:05:10,500 Consider that the length is actually 7-bit. 50 00:05:10,820 --> 00:05:12,900 1-bit is reserved. 51 00:05:12,900 --> 00:05:14,900 It's not supposed to be set. 52 00:05:14,900 --> 00:05:16,940 What happens if you do set it? 53 00:05:17,600 --> 00:05:24,620 Again, you can distinguish between the chips based on that. 54 00:05:24,620 --> 00:05:37,840 So this is the neck layer, and it's pretty familiar to you if you have done 8211, except, of course, it expands, and then it expands some more. 55 00:05:37,840 --> 00:05:59,500 So in order to build frames where those relationships in yellow are violated only when you want them violated, say, for fuzzing, you can use our SCP modules, .15 D4, to build those frames. 56 00:05:59,760 --> 00:06:03,320 And so it's sort of like a complete package that you're getting. 57 00:06:03,320 --> 00:06:10,360 You're getting an injection and the construction kit for the frames together. 58 00:06:10,360 --> 00:06:18,660 Now, all of this was inspired by Joshua Wright's original Killer Bee framework, and we loved it so much that we sort of took over it. 59 00:06:19,040 --> 00:06:28,760 And Killer Bee 2 was largely rewritten by Ryan and Ricky. 60 00:06:28,760 --> 00:06:29,760 Where is Ricky? 61 00:06:29,760 --> 00:06:31,160 He's in Texas. 62 00:06:32,460 --> 00:06:33,860 What's up with that guy? 63 00:06:33,860 --> 00:06:38,640 I mean, he doesn't come out for DEF CON for like two consecutive years. 64 00:06:38,640 --> 00:06:40,520 Anyway, Ricky Milgaris. 65 00:06:41,460 --> 00:06:44,540 Now, we support a number of chips. 66 00:06:44,540 --> 00:06:46,200 We're going to talk about that. 67 00:06:46,200 --> 00:06:56,380 And the SCP Python thing is thrown in for your convenience. 68 00:06:56,380 --> 00:07:13,340 Now, using that raw frame injection, we did what we called a five-finger printing, and what we have in more official uses called active fingerprinting. 69 00:07:13,340 --> 00:07:24,940 The idea is that you lob a frame, say a beacon request, at a chip, and if it hears it, if it interprets it correctly, then it will respond. 70 00:07:24,940 --> 00:07:33,320 If it doesn't hear this frame for some reason, say this frame appears malformed, then it doesn't. 71 00:07:33,320 --> 00:07:38,120 And so we prod and listen for the move. 72 00:07:39,340 --> 00:07:51,900 Now, fingerprinting was sort of a ruse on my part, because yeah, you know, smart meters and all of that, you want to find if they are really legitimate and all that. 73 00:07:51,900 --> 00:07:55,560 But raw frame injection was really why we wanted to do it. 74 00:07:55,560 --> 00:08:02,160 And the little machines in the chips that do the handling of a frame, that was the goal. 75 00:08:02,780 --> 00:08:10,360 So now Ryan is going to talk about the actual mode that we built. 76 00:08:10,500 --> 00:08:38,440 Now, one of the reasons why we built this mode is that we found no convenient way of injecting raw frames if you can't find some of those T-modes, or yes, that would be them, T-mode skies. 77 00:08:38,440 --> 00:08:42,440 We used them initially, and they used to be littered around universities. 78 00:08:42,440 --> 00:08:56,640 We literally went up picking them off of walls after a wireless experiment, a wireless sensor network experiment that did not, you know, that ran its course and then was abandoned. 79 00:08:56,980 --> 00:09:10,240 But, of course, those things are hard to buy, and so we built a good fit with a, based on Travis's good fit, with a USB connection to your laptop. 80 00:09:10,240 --> 00:09:18,500 With a radio chip, the CC2420, which has some nice properties, which Ryan is going to cover. 81 00:09:18,500 --> 00:09:22,480 Now, besides that, there are other chips that do Zigbee. 82 00:09:22,480 --> 00:09:30,260 Atmel, Frigduino has one, T-mode sky, there is Kisbee, of course, the Raven chip. 83 00:09:31,500 --> 00:09:38,160 We stayed away from SDRs, because Travis said so, and because they are expensive. 84 00:09:38,160 --> 00:09:39,900 They are way beyond my budget. 85 00:09:40,600 --> 00:09:48,580 I was actually planning to do this originally with SDRs, and went begging, and then the neighbor showed up and said, hey, you know what? 86 00:09:48,760 --> 00:09:50,440 There is no need for that. 87 00:09:50,440 --> 00:09:55,140 It will be cooler if it's done with commodity chips. 88 00:09:55,140 --> 00:09:56,860 And we did it with commodity chips. 89 00:09:58,300 --> 00:10:08,120 So, one of the main things we want to do, and we're going to be handing these out at the end, or at least as many of them as we have, is try to show why did we build this. 90 00:10:08,120 --> 00:10:11,820 So, Sergei went over some of the limitations of the old hardware. 91 00:10:11,840 --> 00:10:13,460 What did we put in this one? 92 00:10:14,400 --> 00:10:30,700 This is the basic requisite block diagram, but it really boils down to, you can connect to your laptop and control it in Python or C or whatever, and out the other end, you can have very low level control over radio frames. 93 00:10:30,700 --> 00:10:50,340 The reason we use the CC2420 chip, which is tough to get a hold of anymore, these are some of the last ones that were available, and we keep trying to snatch them up, is that it has registers exposed, which allow you to violate the protocol, to do the raw layer injection. 94 00:10:51,940 --> 00:10:53,740 And so it looks like this, right? 95 00:10:53,740 --> 00:10:54,720 This is the blow-up. 96 00:10:55,460 --> 00:11:08,800 USB, FTDI chip to convert it to serial, MSP430 to hold your firmware, and then this new radio with the CC2420 chip to actually inject it. 97 00:11:08,800 --> 00:11:11,840 Yeah, notice the two antennas, right? 98 00:11:11,840 --> 00:11:14,540 The external antenna and the internal antenna. 99 00:11:14,940 --> 00:11:19,260 You should run it with the right one, or else you might hurt the chip. 100 00:11:19,260 --> 00:11:23,860 So all the ones we hand out are configured for the external antenna. 101 00:11:24,060 --> 00:11:31,660 We can show you how to change that, probably in the hardware hacking village next door, but if you would like to. 102 00:11:31,800 --> 00:11:33,480 So what do we support out of the box? 103 00:11:33,480 --> 00:11:39,380 These are already flashed with firmware, so please don't reflash until you know what you're trying to do. 104 00:11:40,140 --> 00:11:41,500 But you can sniff. 105 00:11:41,500 --> 00:12:00,080 The nice thing we have in this one out of the box is injection, as well as some jamming that you should only use in a controlled and legal lab environment, along with reflexive jamming, and then obviously the low-level control over the registers, and the ability to reprogram them if you want. 106 00:12:00,780 --> 00:12:09,860 But really what I'm here... really my motivation for being here is to try to convince you guys to take this hardware that we're going to give out and make it better. 107 00:12:11,260 --> 00:12:15,120 These are just a few of my ideas, and I'm sure you have better ones, right? 108 00:12:15,480 --> 00:12:19,060 We've wired it to support a battery pack. 109 00:12:19,060 --> 00:12:26,800 We've put flash on it, so you could sort of put a battery pack and flash and throw it over the fence and let it log some stuff for you. 110 00:12:26,880 --> 00:12:29,820 You could put more business logic in the firmware. 111 00:12:30,540 --> 00:12:33,720 And yeah, yeah, there's expansion headers so that you can actually do that. 112 00:12:39,290 --> 00:12:41,810 So now we're going to go into sort of two sections. 113 00:12:41,810 --> 00:12:44,250 One of which is like how to use it for defense. 114 00:12:44,250 --> 00:12:49,350 Here's some ideas how you can do some defensive wireless intrusion detection systems with it. 115 00:12:49,350 --> 00:12:53,270 And then the next one will be how do you totally break the idea of doing WIDS with it. 116 00:12:53,430 --> 00:12:57,430 We like to bundle it in the same talk, so you can't tell me that I told you so. 117 00:12:59,310 --> 00:13:02,370 What we did is we released an open source WIDS framework. 118 00:13:02,370 --> 00:13:04,390 It looks something like this. 119 00:13:05,590 --> 00:13:12,410 Basically you deploy drone devices out around your network where you want to detect attacks. 120 00:13:12,650 --> 00:13:15,410 And it has a backhaul and analytic portion. 121 00:13:15,410 --> 00:13:20,390 I'm going to really glaze over this, so please come talk to us more if you want. 122 00:13:20,390 --> 00:13:28,310 Or see our full presentation from Troopers 2014 this year that gives you a lot of detail about this. 123 00:13:28,310 --> 00:13:34,050 Long story short, together with making packets you can, of course, disassemble packets. 124 00:13:34,050 --> 00:13:38,470 And have rules fire when you disassemble a particular kind of packet. 125 00:13:38,470 --> 00:13:40,490 So you can roll your own WIDS. 126 00:13:41,590 --> 00:13:43,790 Wireless Intrusion Detection System. 127 00:13:43,850 --> 00:13:44,830 Sorry. 128 00:13:45,610 --> 00:13:46,590 It just keeps... 129 00:13:46,590 --> 00:13:47,810 Oh, WIDS WIPS. 130 00:13:47,810 --> 00:13:49,870 Intrusion Detection, Intrusion Prevention. 131 00:13:50,650 --> 00:13:55,750 You know, WIDS have been dead and not quite dead. 132 00:13:55,750 --> 00:13:57,110 Maybe like zombie. 133 00:13:57,930 --> 00:14:01,470 For, what, 10 years? 134 00:14:02,630 --> 00:14:07,790 So, hey, here is another dead baby, if you will. 135 00:14:08,430 --> 00:14:12,590 And, of course, we are going to kill it right now. 136 00:14:13,010 --> 00:14:17,970 But first, before we kill it, let's show that you could try to do something useful with a WIDS. 137 00:14:17,970 --> 00:14:23,810 So one very basic attack on 802.15.4 is doing network discovery. 138 00:14:23,810 --> 00:14:28,670 So if you do an 802.15.4 on a pen test, you have one of these devices hooked up. 139 00:14:28,670 --> 00:14:30,850 You want to find your target network. 140 00:14:30,970 --> 00:14:32,470 This is what you are going to do. 141 00:14:32,470 --> 00:14:35,430 You are going to go active, if you are allowed to. 142 00:14:35,550 --> 00:14:40,930 And you are going to basically do an equivalent of a TCP SIM scan, sending out beacon requests. 143 00:14:41,390 --> 00:14:47,890 So this is all well and good because, of course, even the documentation itself makes it clear that there is no security supported on these. 144 00:14:47,890 --> 00:14:49,530 Because why would you do that? 145 00:14:49,530 --> 00:15:11,710 And so this is just to show you that with a minimal amount of code inside the framework that is supposed to be highlighted but is not, you can request to get certain packets and then run some very basic statistics over those packets to show there is an increased number of beacon request frames. 146 00:15:11,710 --> 00:15:28,210 And really what this boils down to is if somebody runs out of our Killer Bee Toolkit, the tool ZB Stumbler, which is like, again, if you are on a pen test, one of the first things you might want to do, the WIDS is going to start popping these alerts. 147 00:15:28,430 --> 00:15:31,390 You know, that it saw beacon detection. 148 00:15:32,390 --> 00:15:35,230 The same thing goes for disassociation frames, right? 149 00:15:35,230 --> 00:15:38,010 We all saw this with Wi-Fi years and years ago. 150 00:15:38,010 --> 00:15:40,510 So let's have another protocol that has the same issue. 151 00:15:41,730 --> 00:15:49,750 Which is that you can either figure out, you can do some recon and do this smartly, or you can start spamming them all over the place. 152 00:15:50,350 --> 00:15:52,610 Let's say you want to spam them all over the place. 153 00:15:52,610 --> 00:15:55,570 We made a tool because why make you do the work? 154 00:15:56,130 --> 00:15:57,330 So you configure it. 155 00:15:57,330 --> 00:16:01,170 You actually do need some recon to do this from ZB Stumbler. 156 00:16:02,570 --> 00:16:05,990 But of course a WIDS would say that you could detect this. 157 00:16:05,990 --> 00:16:08,010 You start seeing a ton of these frames. 158 00:16:23,170 --> 00:16:28,810 So we have posted up on our website, obviously the talk was at 2-14. 159 00:16:28,810 --> 00:16:30,370 It goes a lot over this. 160 00:16:30,490 --> 00:16:32,270 The code is up on GitHub. 161 00:16:32,570 --> 00:16:36,150 And you can either build it into it or break it if you want. 162 00:16:36,330 --> 00:16:38,090 But let's talk about breaking it. 163 00:16:38,090 --> 00:16:43,010 Yeah, because now that we brought this little thing into the world, we're going to kill it. 164 00:16:43,790 --> 00:16:44,670 Badly. 165 00:16:45,690 --> 00:16:49,590 So here's your FIFRAME, right? 166 00:16:49,590 --> 00:16:53,430 This is the part that Wireshark would not show. 167 00:16:54,510 --> 00:16:58,890 This is the preamble, this is the SMD, and this is the frame. 168 00:16:59,070 --> 00:17:02,770 From that point on, you have your link layer frame. 169 00:17:03,390 --> 00:17:12,990 But these are the ones, these fields, are the ones that control the actual machinery inside the file. 170 00:17:12,990 --> 00:17:16,830 Now, when you say the file layer, that's already a lie. 171 00:17:16,830 --> 00:17:21,530 Because the file layer consists of several sub-layers, if you will. 172 00:17:21,530 --> 00:17:24,050 They're never really called that. 173 00:17:24,490 --> 00:17:30,050 But, you know, there is machinery that does synchronization. 174 00:17:30,050 --> 00:17:37,010 There is a shift register that looks for the specific SFD, A7, in the standard. 175 00:17:37,010 --> 00:17:42,910 And there is the machinery that then does the control summing. 176 00:17:42,910 --> 00:17:46,930 But, you know, you can ask yourself, what happens if you play with it? 177 00:17:46,930 --> 00:17:53,570 Say, what if you make the frame length longer than your actual frame? 178 00:17:53,650 --> 00:17:54,990 What will happen? 179 00:17:55,110 --> 00:18:02,730 Well, the file layer is just the chip, it's just a machine for pulling symbols out of the air. 180 00:18:03,110 --> 00:18:12,190 And so it will pull whatever symbols follow in the noise, and that will become a part of the frame. 181 00:18:12,190 --> 00:18:34,430 And if you're lucky, and the garbage symbols that make up the frame control sum actually does match, and this happens, you will get basically to hear at the end of your frame what the noise sounds like. 182 00:18:34,430 --> 00:18:35,870 And that's interesting, right? 183 00:18:35,870 --> 00:18:43,050 Because people believe in boundaries around the frame, but there are no boundaries. 184 00:18:43,050 --> 00:18:47,290 People believe in boundaries between symbols, but there are no boundaries. 185 00:18:47,290 --> 00:18:59,790 Travis showed that with his 8th oven nibble shift, that allows you to receive a frame that was never sent as such. 186 00:18:59,790 --> 00:19:05,910 No symbol in the received frame in his trick is shared with the sent frame. 187 00:19:05,910 --> 00:19:07,230 How cool is that? 188 00:19:07,230 --> 00:19:26,710 So, go over to the vendor area, find the samizdat booth, print yourself the previous issue of the International Journal of POC or GTFO, and that knowledge will be yours, together with a paper cutout game. 189 00:19:26,710 --> 00:19:34,030 But we're going to exploit this exactly along the same lines. 190 00:19:34,190 --> 00:19:38,330 The fact that the chip is just a machine for pulling bytes out of the air. 191 00:19:41,270 --> 00:19:47,150 And the trick that we're going to use is the packet-in-packet trick. 192 00:19:47,410 --> 00:19:59,850 So, one important thing, the most important thing about ZigBee as a protocol, is that the preamble, the sync and the length, are encoded exactly the same way as the rest of the frame. 193 00:20:00,150 --> 00:20:03,880 So, signaling is done the same way as data. 194 00:20:04,810 --> 00:20:10,390 So, one thing about the air is that there is always noise in it. 195 00:20:10,550 --> 00:20:25,710 And so if something steps on this sync, and radio noise tends to step on a single symbol, or on a single byte, no more, so if this A7 turns into a pumpkin due to noise, 196 00:20:29,150 --> 00:20:33,530 then all of this preamble will have been for noise. 197 00:20:33,750 --> 00:20:39,890 And your card will not, your chip, will not go into, oh, I am in a frame mode. 198 00:20:39,890 --> 00:20:47,610 And so it will continue to see these symbols in the air as noise, outside of a frame. 199 00:20:47,610 --> 00:20:59,490 And then, when your payload contains a valid preamble, and a valid sync, these things are perceived as the beginning of a new frame. 200 00:20:59,490 --> 00:21:05,890 So this is the packet-in-packet trick which got Travis his pony two years ago. 201 00:21:05,890 --> 00:21:24,650 So, the body of the injected frame will be basically at the higher layer, and so you can inject into PHY if you control the app layer. 202 00:21:24,650 --> 00:21:26,330 Now, how nifty is that? 203 00:21:26,630 --> 00:21:33,610 But, in our case, we don't really need to wait for the noise to come and do its magic. 204 00:21:33,610 --> 00:21:43,780 We can simply reset the configuration register, where the SFD is stored, to something else, and so there will be no SFD. 205 00:21:44,150 --> 00:21:58,830 And so we can transmit with arbitrary preambles, arbitrary garbage between the preamble and the sync, whatever length we want, and that's your raw frame injected. 206 00:22:01,050 --> 00:22:08,350 So, packet-in-packet basically serves as a vehicle for this injection with this chip. 207 00:22:08,910 --> 00:22:13,290 So, packet-in-packet is providing us sort of a layer-one injection. 208 00:22:13,290 --> 00:22:17,550 You can do this with a USRP or a software-defined radio as well. 209 00:22:18,610 --> 00:22:29,150 The differences in the state machines of the radio chips themselves exist, and together what that does is allow us to do a PHY layer fingerprint of the chips. 210 00:22:29,490 --> 00:22:34,370 A PHY layer fingerprint or something that would be a WIDS evasion. 211 00:22:34,510 --> 00:22:53,570 Because what you can do in this case, just to totally kill that WIDS that we just talked about, was if you're receiving your actual devices deployed in your network are not the exact same chips, or one that we cannot fingerprint differently than the ones being used in your WIDS deployment, 212 00:22:53,570 --> 00:23:09,610 so if you have two different vendor chips, even if they're both 802.15.4 and ZigBee compliant, there's differences between them so that you can transmit a frame which is seen by one as a perfectly valid frame with a high success rate, whereas another one will not see it. 213 00:23:09,790 --> 00:23:13,890 And what we're going to show you next is how to do that and how to find those differences. 214 00:23:15,450 --> 00:23:17,890 So, this is a really basic setup, right? 215 00:23:17,890 --> 00:23:25,470 You have your target device, and your target device for this needs to just, like, listen for something and respond with something else. 216 00:23:25,530 --> 00:23:28,170 So, the protocol supports this, right? 217 00:23:28,170 --> 00:23:41,050 Either beacon requests and beacon responses, or sending a data packet and getting an acknowledgement frame, any way that you can, or you could, you know, if you control this one fully in the firmware, you can just sniff out of it. 218 00:23:41,230 --> 00:23:50,310 And what you want to do is see if that radio chip, when you stimulate it with, say, a beacon request, if a beacon response comes back to your other chip. 219 00:23:50,550 --> 00:23:57,570 So, we've done this sort of thing with H.211 in a talk from a few schmuckons ago. 220 00:23:57,570 --> 00:24:19,110 If you remember, we simply used the frame control bits, the flag bits, one full byte of those, set them to all sorts of nonsensical combinations, say, a management frame claiming to come from the distribution system, or similar ridiculous things, or, you know, 221 00:24:19,110 --> 00:24:24,670 an app with a whole bunch of flags, like a Christmas tree packet that nmap sends. 222 00:24:24,670 --> 00:24:31,970 And we actively fingerprinted various chips, and lo and behold, they responded differently. 223 00:24:32,650 --> 00:24:38,490 So, the same is true on the lower layer, on the PHY layer. 224 00:24:38,490 --> 00:24:40,990 The chip has its own state machine. 225 00:24:40,990 --> 00:24:45,270 Here is the state machine of the C2420 chip. 226 00:24:45,710 --> 00:24:49,810 And, of course, all of those things would be different. 227 00:24:50,270 --> 00:24:54,730 And for some, a shorter preamble will be a killer. 228 00:24:54,770 --> 00:25:05,690 For others, garbage between the preamble and the SFD would be what would make them not hear the packet, while others would hear them perfectly. 229 00:25:05,690 --> 00:25:14,950 So, we came up with a bunch of methods to malform that PHY part of the frame. 230 00:25:15,330 --> 00:25:18,330 And, where is Travis? 231 00:25:21,940 --> 00:25:29,420 He's probably drinking beer while we're, you know, while we're introducing people to his native culture. 232 00:25:29,420 --> 00:25:36,400 This is Cumberland Gap, which is, of course, quite important in the Tennessee history. 233 00:25:37,300 --> 00:25:43,620 And Travis would have told you about this if he had the good fortune to. 234 00:25:43,620 --> 00:25:50,020 And now, of course, I have to sing the song, you know, drink a little whiskey, take a little nap. 235 00:25:50,020 --> 00:25:52,260 We're 15 miles from the Cumberland Gap. 236 00:25:56,760 --> 00:25:59,220 My vocals are horrible. 237 00:26:01,000 --> 00:26:05,740 So, that was actually the first method that we used, which didn't work out. 238 00:26:05,740 --> 00:26:08,560 So, we transplanted it on New Hampshire soil. 239 00:26:08,560 --> 00:26:10,320 And this is the Franconian Notch. 240 00:26:10,320 --> 00:26:18,280 This is how you would drive up to Dartmouth from Massachusetts, although I can't imagine why you want to go there. 241 00:26:20,860 --> 00:26:24,000 So, New Hampshire is a free state, right? 242 00:26:24,180 --> 00:26:26,000 Massachusetts, not so much. 243 00:26:29,020 --> 00:26:32,460 So, what we're going to do now is show you the three techniques that worked. 244 00:26:32,460 --> 00:26:36,380 We left off Cumberland Gap because Tennessee just didn't live up to Travis's... 245 00:26:36,380 --> 00:26:38,960 I'm trying to taunt him, but... 246 00:26:38,960 --> 00:26:52,280 So, in Franconian Notch, the technique here is that we take those eight nibbles of zeros that should be there, put this back as part of the preamble, and let's start changing some of them to Fs. 247 00:26:52,280 --> 00:27:02,380 So, when you start doing that, using the packet and packet to have control over this layer that you usually don't control, what do you see differently between chips? 248 00:27:02,740 --> 00:27:04,960 And what you see differently between chips... 249 00:27:04,960 --> 00:27:16,000 Say, this is an Atmel chip on an RZ USB stick, this is a CC2420 on either the Appemote or the Temote Sky, and you start seeing the numbers are very different. 250 00:27:17,360 --> 00:27:18,940 If you were to send... 251 00:27:18,940 --> 00:27:22,680 You know, the Appemote wants all zeros to be able to synchronize, right? 252 00:27:22,680 --> 00:27:29,740 If it doesn't have those eight nibbles, it's not doing well receiving the frames, except test results. 253 00:27:30,060 --> 00:27:38,120 But on the other hand, the RZ USB stick is a lot more resilient to this attack, or to this technique. 254 00:27:38,240 --> 00:27:56,220 And so, if you send something in this range, in these two, let's say, you're getting a 99% success rate getting that received on an RZ USB stick, whereas you're getting below 1% chance of it being received by a CC2420. 255 00:27:56,220 --> 00:27:59,400 And that's where you can see a device fingerprint difference. 256 00:27:59,400 --> 00:28:07,340 And now imagine that this chip is your intrusion detection chip. 257 00:28:07,920 --> 00:28:14,460 And this chip is the target, and the frame carries something interesting, such as an export. 258 00:28:15,720 --> 00:28:20,400 You really, really want to have it the other way around, right? 259 00:28:21,220 --> 00:28:29,160 So, we don't know what specifically in that state machine causes those responses. 260 00:28:29,620 --> 00:28:49,340 But we've gone through all possible preamble replacements, and noticed that some of those frames arrived with a completely botched preamble, if you believe the standard. 261 00:28:49,340 --> 00:29:05,760 And so, because I wouldn't believe this, in fact, I didn't believe this until we had 5,000 test runs done, in different cities, and I still couldn't figure out why, these are the PCAPs of, say, an example test run. 262 00:29:05,780 --> 00:29:12,960 And what I've done is overlaid, used on correlating with the sequence numbers, what the preamble of this packet was injected with. 263 00:29:12,960 --> 00:29:17,700 And these were captured at the exact same time, so the yellow lines are connecting two of them. 264 00:29:17,700 --> 00:29:31,500 So , what you see is the CC2420 chip is receiving, but it's all zero, which the RZUSB stick is usually doing as well, but it's also receiving a lot with other preambles set. 265 00:29:32,980 --> 00:29:43,900 Now, because Sergei said, obviously, the way around this is to simply switch which chips you use for your intrusion detection and not, we want to get rid of that notion as well. 266 00:29:43,900 --> 00:29:48,660 So, let's do another technique where you change the length of the preamble. 267 00:29:48,660 --> 00:29:58,740 So, instead of replacing it with garbage, what if you either have, you know, a two nibble preamble, or a four, or a six, or the full eight nibble preamble. 268 00:29:59,000 --> 00:30:06,880 Basically, how long does it take the analog portion of the radio chip to synchronize the clock? 269 00:30:07,280 --> 00:30:10,560 Or at least that's what we hypothesize is this difference. 270 00:30:10,560 --> 00:30:27,260 And here's the test results, which show that a CC2420 chip takes less time to synchronize than an Atmel chip, which we should have the eight nibble bar on here, oh no, it's at the top. 271 00:30:27,460 --> 00:30:34,600 There's something strange that happened in this test run with the Atmel, because this blue bar should be higher here. 272 00:30:34,600 --> 00:30:41,480 But you still see some difference, and you see the Zigduino, which is another chip, behaves differently as well. 273 00:30:42,820 --> 00:30:54,380 The Franconian bridge, because we just keep making up names for this stuff, or he does, says you keep the full eight nibble preamble, and then you put some junk in between. 274 00:30:54,380 --> 00:31:14,640 So you put different numbers, in this case Fs, between it and the SFD, which goes into what we hypothesize is how long is that shift register continually looking for the right SFD before it gives up and resets. 275 00:31:14,640 --> 00:31:18,220 So this is really bizarre, right? 276 00:31:18,220 --> 00:31:31,720 Because you see those nice images of those frames in your protocol and in the textbooks and everywhere, and you sort of assume that this is how those chips work. 277 00:31:31,720 --> 00:31:34,660 I mean, everything is a parser, right? 278 00:31:34,660 --> 00:31:54,180 So that silicon that matches the frame out of the surrounding noise, that magic that makes it start, you know, at this particular noise symbol and end at this particular noise symbol, and somehow what's in the middle is not noise but the payload, this is, 279 00:31:54,180 --> 00:31:57,660 I mean, this is a complete pack of lies, right? 280 00:31:57,660 --> 00:32:04,880 There are no boundaries except those that those machines like the shift register make. 281 00:32:04,880 --> 00:32:09,840 And those parsers are quite not what you expect, right? 282 00:32:09,840 --> 00:32:20,120 For example, you can run a whole bunch of Fs in there as the bridge between the full preamble and the SFD, and they don't care. 283 00:32:20,680 --> 00:32:22,240 Isn't that interesting? 284 00:32:22,240 --> 00:32:34,320 So, of course, we approach everything as parsers, and we approach everything as what we call recognizers, for the languages that are the respective data structures. 285 00:32:34,320 --> 00:32:45,280 And, of course, the first thing you want to do is to exercise the corner cases of those parsers, and just give them something to chew on until they croak. 286 00:32:45,280 --> 00:32:53,840 And normally people do this in the process of fuzzing, but we're really interested in those simple machines themselves for their own sake. 287 00:32:54,040 --> 00:33:00,980 And then it turns out that, yeah, all of those things are implemented differently on different chips, right? 288 00:33:00,980 --> 00:33:11,360 So here you inject that little bridge, and your RZ USB stick just doesn't care, right? 289 00:33:11,360 --> 00:33:16,120 Whereas your Zigduino, well, kind of cares, right? 290 00:33:16,120 --> 00:33:20,740 And the Teemo cares a lot, right? 291 00:33:20,740 --> 00:33:25,080 This is the only red that you're seeing here. 292 00:33:25,420 --> 00:33:32,800 Again, you could call this a width evasion, if you know what your width chip is. 293 00:33:32,800 --> 00:33:35,580 You could call it a shaped charge. 294 00:33:35,580 --> 00:33:49,020 You speak the right dialect to deliver your payload, to deliver your scan, and you could be talking to your fancy building energy management system without touching any other ZigBees around. 295 00:33:49,020 --> 00:33:58,480 Or you could be talking to this medical thingy without touching your thermostat. 296 00:33:59,420 --> 00:34:04,160 It's kind of like the battle language, right? 297 00:34:04,160 --> 00:34:19,100 The Dune, all of those super cool warrior casts and all of that, they speak this special language in battle that is unintelligible to the opposing faction. 298 00:34:19,100 --> 00:34:21,800 You could actually do it with ZigBee chips. 299 00:34:22,740 --> 00:34:30,220 With nothing but the PHY preamble SFD and some garbage in between. 300 00:34:31,580 --> 00:34:34,600 This was deeply satisfying. 301 00:34:34,900 --> 00:34:38,900 I hope it was as good for you as it was for us. 302 00:34:41,680 --> 00:34:48,060 So what we've showed you today is the App Emote hardware so that you can play with this and expand on it. 303 00:34:48,900 --> 00:34:56,280 A WID system which is very limited in its functionality and more limited when you try to evade it. 304 00:34:56,640 --> 00:34:58,600 You could work on improving that. 305 00:34:58,600 --> 00:35:10,600 In fact, using some of the packet-in-packet for sniffing, or what we would call packet-out-of-packet, you could start using commodity chips to get sort of a spectrum sniffing capability. 306 00:35:11,260 --> 00:35:14,680 And then Isotope, which is the name for the fingerprinting project. 307 00:35:14,680 --> 00:35:25,320 We've done such limited tests, the three we showed you today, and the one that didn't work, on doing fingerprinting that there's so much more that could be done there. 308 00:35:25,360 --> 00:35:33,420 Adding Fs in probably has a lot of unintended consequences because of how chipping is done, compared to using other symbols. 309 00:35:33,820 --> 00:35:38,200 So there's a whole variety of basically PHY layer fuzzing that could be done there. 310 00:35:38,260 --> 00:35:41,760 The code for all of this is posted online. 311 00:35:41,760 --> 00:35:44,460 If you have any questions, please reach out to us. 312 00:35:44,460 --> 00:35:49,460 We'll take questions, which will be rewarded with chips. 313 00:35:49,460 --> 00:35:51,240 That's how I get questions. 314 00:36:03,370 --> 00:36:13,710 Mainly by not having the metadata in the same encoding, in the same modulation, as the data. 315 00:36:13,750 --> 00:36:19,570 The ZigBee Consortium apparently took this decision to simplify things. 316 00:36:19,570 --> 00:36:24,930 Wi-Fi switches through modulations in the middle of the frame. 317 00:36:24,930 --> 00:36:28,410 And this is ugly and nasty. 318 00:36:28,410 --> 00:36:36,770 And so they decided to keep it nice, except, you know, how do you know where the frame actually begins? 319 00:36:36,950 --> 00:36:37,770 Right? 320 00:36:37,770 --> 00:36:41,950 Yes, encryption will help. 321 00:36:43,390 --> 00:36:54,990 In particular, the packet-in-packet trick with other people's hardware is broken by making the bits of the payload unpredictable to the attacker. 322 00:36:55,410 --> 00:36:58,530 So encryption would break that. 323 00:36:58,530 --> 00:37:04,050 Of course, you know, since we control the chip here, it would not hurt us. 324 00:37:04,050 --> 00:37:08,070 But then, of course, we would find it difficult to inject into an encrypted network. 325 00:37:08,070 --> 00:37:15,290 On the other hand, the file layer is not encrypted. 326 00:37:15,630 --> 00:37:22,310 So it's these particular symbols, and that's just it. 327 00:37:22,830 --> 00:37:32,470 Yeah, when people are doing networking for ZigBee and they do proper encryption on the actual application level phase, it makes it a lot more of a pain. 328 00:37:32,470 --> 00:37:37,090 But the radio chips have only two crypto key registers in them. 329 00:37:37,090 --> 00:37:44,030 Actually, if somebody knows of a ZigBee chip that has more than two key registers, please let me know. 330 00:37:44,270 --> 00:37:49,950 Because what that does is it forces you to really do network keying instead of per-device keying. 331 00:38:06,850 --> 00:38:08,310 Well, yes. 332 00:38:09,410 --> 00:38:18,370 Basically, again, you want to have symbols in your set that do not occur in the payload. 333 00:38:19,350 --> 00:38:29,190 Otherwise, you're solving a parsing problem that in the presence of noise becomes hard, and there is always noise. 334 00:38:34,970 --> 00:38:36,610 Symbols in what set? 335 00:38:37,210 --> 00:38:44,970 Symbols as in what you send encoded over the air with your error-correcting code. 336 00:38:45,070 --> 00:38:57,770 The symbol in ZigBee is a nibble, but in fact it's 32 chips, ones and zeros, physical ones and zeros. 337 00:38:57,770 --> 00:39:06,090 And the modulation is QPSK, I believe. 338 00:39:09,220 --> 00:39:10,580 That's correct. 339 00:39:10,580 --> 00:39:11,980 It's 32 bits. 340 00:39:14,300 --> 00:39:24,020 How to build a phi layer that doesn't fall to those ruses. 341 00:39:25,060 --> 00:39:33,380 It's good to have a symbol in your set that just doesn't appear in the data, so that you know where your metadata is. 342 00:39:33,380 --> 00:39:39,660 And Mike Ossman has an interesting talk that was built out of packet-in-packet called Unambiguous Encapsulation. 343 00:39:39,660 --> 00:39:43,660 And how do you do that across a wide range of protocols, including some radio ones? 344 00:39:43,660 --> 00:39:51,660 You can find that in his ShmooCon talk. 345 00:39:52,200 --> 00:39:56,900 His technical report on this is online. 346 00:39:57,120 --> 00:40:08,640 He uses error-correcting codes that cluster their symbols for data and metadata as far from each other as possible. 347 00:40:09,080 --> 00:40:12,160 And he enumerated a bunch of those codes. 348 00:40:12,160 --> 00:40:34,920 If you look at our Language Theoretic Security Workshop, LANGSEC Workshop, this year at IEEE, and look at Travis's paper that describes his one-eighth of a nibble chipping misalignment trick, that paper quotes the TR and gives a brief overview of the issues of how to build a better phi. 349 00:40:34,920 --> 00:40:39,580 And generally, I recommend to you the Language Theoretic LANGSEC approach. 350 00:40:39,580 --> 00:40:46,160 Just go to langsec.org, and there will be a bunch of papers there. 351 00:40:55,870 --> 00:41:00,810 So everything that we talk about in this presentation doesn't even touch on the ZigBee layers. 352 00:41:00,810 --> 00:41:04,370 It's all in the IEEE 802.15.4 spec. 353 00:41:04,370 --> 00:41:10,510 Which, I should have been clear, that's to find the phi in the math layers that ZigBee is based on top of. 354 00:41:27,510 --> 00:41:37,930 So, I think that really depends on how you use those different methods. 355 00:41:38,430 --> 00:41:42,710 There are different ones that are more effective, but it's not. 356 00:41:42,710 --> 00:41:45,750 I promise you that we have plenty... well, I'm not going to say plenty. 357 00:41:45,750 --> 00:41:50,530 We have a lot of these, but I'm going to continue doing questions for... 358 00:41:50,530 --> 00:41:53,290 How long do we have? 359 00:41:53,890 --> 00:42:01,670 I'm going to continue doing 10 more minutes of questions, and then my voice will not work, and then I will be drinking a beer, and then we can do more questions. 360 00:42:02,910 --> 00:42:04,590 You've had your hand up for a while. 361 00:42:04,590 --> 00:42:06,650 I wonder what the SFD value is that 362 00:42:09,840 --> 00:42:10,540 you built. 363 00:42:10,960 --> 00:42:17,440 So, the firmware allows you to configure the SFD value from Python at runtime. 364 00:42:18,000 --> 00:42:20,360 You do have to be careful about it. 365 00:42:20,360 --> 00:42:25,060 I'd have to look in our paper for which one we set it to in these tests. 366 00:42:25,440 --> 00:42:32,000 With, actually going back to the eighth of a nibble, misalignment because of how the error correcting codes work. 367 00:42:32,020 --> 00:42:40,020 Like, B0 can change into A7, depending on a slight clock drift, which happens in cheap hardware. 368 00:42:41,980 --> 00:42:48,720 I think we set it... you can't set it to FF because the chip decides that that actually means A7. 369 00:42:51,280 --> 00:43:00,320 And so, I think we set it to F0, which is actually 0F by the time it goes on the wire. 370 00:43:15,660 --> 00:43:19,060 Yeah, that was Cumberland Gap. 371 00:43:19,060 --> 00:43:21,460 Well, Cumberland Gap was meant to be that. 372 00:43:27,650 --> 00:43:31,490 Yeah, we didn't present Cumberland Gap. 373 00:43:31,490 --> 00:43:35,610 We can show you the results, or they're in our paper, but it didn't work so well. 374 00:43:36,910 --> 00:43:40,550 Well, I mean, we actually know how we messed up. 375 00:43:42,050 --> 00:43:43,550 Start the frame delimiter. 376 00:43:47,530 --> 00:43:53,310 Okay, I'm sorry, I'm having trouble keeping track of which order people raised their hands. 377 00:43:53,310 --> 00:43:55,270 I've seen your hand up for a while. 378 00:44:12,000 --> 00:44:16,000 Well, now you have something you can go test that with, legally. 379 00:44:31,620 --> 00:44:38,940 So, let me channel Dan Geer for a moment here. 380 00:44:38,940 --> 00:44:40,800 Risk is dependence. 381 00:44:40,800 --> 00:44:50,100 Introducing those new dependencies of technologies that we don't really know much about yet is not a smart thing, right? 382 00:44:50,100 --> 00:45:01,480 This whole smart grid is amazing, as in, whoa, not enough attack surface in our infrastructure. 383 00:45:01,480 --> 00:45:03,140 Let's add some more. 384 00:45:03,700 --> 00:45:05,420 Right? 385 00:45:05,420 --> 00:45:14,660 It's, you know, it defies understanding. 386 00:45:14,740 --> 00:45:18,140 But, yeah, shiny, right? 387 00:45:22,100 --> 00:45:25,520 Speak up, please. 388 00:45:36,730 --> 00:45:38,310 Yeah, yeah. 389 00:45:38,310 --> 00:45:42,450 So, it's really about the resistance on the antenna. 390 00:45:42,530 --> 00:45:47,290 They say it's got to be... I heard it has to be 50 ohms, right? 391 00:45:47,290 --> 00:45:54,510 So, if you try to run it without the external antenna while switched to that socket, it will be bad. 392 00:45:54,510 --> 00:45:56,930 The internal antenna has the proper... 393 00:45:56,930 --> 00:46:05,230 I assume the radio front end, which Ryan has been debugging for, you know, months, has been... 394 00:46:05,230 --> 00:46:07,990 Well, somebody else has been debugging for me for months. 395 00:46:08,110 --> 00:46:10,210 Yeah, the internal antenna works. 396 00:46:10,210 --> 00:46:13,990 You have to move a capacitor. 397 00:46:13,990 --> 00:46:15,230 There's a capacitor at the end. 398 00:46:15,230 --> 00:46:17,730 I'll be happy to show you guys or help you move it. 399 00:46:20,730 --> 00:46:23,510 It's a 603 landing, so it's sort of small. 400 00:46:23,790 --> 00:46:26,170 So, drink a beer before you try to solder it. 401 00:46:26,170 --> 00:46:27,510 Yes, sir. 402 00:46:41,580 --> 00:46:44,980 If somebody wants to buy Sergey the rest of them... 403 00:46:45,660 --> 00:46:53,260 No, there's at least 10 major chips that are doing 802.15.4 from different vendors on the market. 404 00:46:54,500 --> 00:47:00,700 And these are just ones that we had available in the lab to do this research on. 405 00:47:01,600 --> 00:47:11,980 So, we would love to have you basically around our framework and fingerprint what you have, right? 406 00:47:11,980 --> 00:47:13,980 We call this isotope. 407 00:47:13,980 --> 00:47:18,460 It's, you know, it's a joke on fingerprinting being useless. 408 00:47:18,460 --> 00:47:25,400 I had this discussion with Travis over beer, over multiple beers, over multiple, multiple beers. 409 00:47:25,400 --> 00:47:28,680 And I finally convinced him that it was not. 410 00:47:28,680 --> 00:47:31,100 And isotope, the name came from that. 411 00:47:31,100 --> 00:47:37,400 Because, you know, so some kernels have more neutrons than others, right? 412 00:47:37,400 --> 00:47:38,460 Who cares? 413 00:47:38,580 --> 00:47:40,880 Besides the chemistry geeks, right? 414 00:47:40,880 --> 00:47:46,680 Turns out that there is this thing called uranium-238 and 235. 415 00:47:47,080 --> 00:47:49,600 And this thing called the chain reaction. 416 00:47:49,600 --> 00:47:51,080 So, boom. 417 00:47:55,280 --> 00:47:56,960 Fingerprinting matters. 418 00:47:56,960 --> 00:48:02,180 Although, the kind of fingerprinting matters is fingerprinting receivers. 419 00:48:02,740 --> 00:48:04,460 Sanders, nah. 420 00:48:04,460 --> 00:48:05,720 I mean, forensics. 421 00:48:05,720 --> 00:48:08,120 Forensics is fun, but hey. 422 00:48:08,300 --> 00:48:13,160 But fingerprinting receivers gives you attack paths and those shape charges. 423 00:48:23,890 --> 00:48:25,290 Uh... 424 00:48:36,510 --> 00:48:37,910 Um... 425 00:49:02,610 --> 00:49:10,270 So, okay. 426 00:49:39,650 --> 00:49:42,330 Yeah, yeah, yeah. 427 00:49:42,330 --> 00:49:43,210 Yeah, yeah, yeah. 428 00:49:43,210 --> 00:49:44,630 I think what... 429 00:49:57,010 --> 00:49:58,990 Sergei, one behind you. 430 00:50:03,460 --> 00:50:05,120 Anyway, so... 431 00:50:05,740 --> 00:50:08,040 I think we're imposing another people's time. 432 00:50:08,040 --> 00:50:11,140 So, come up and, you know, buy us a beer. 433 00:50:17,420 --> 00:50:20,900 I mean, as usual, students do all the work, right?