Hi, everyone. Welcome to Hacking IEEE 802.15.4 Low-Rate Wireless Networks. My name is Dan Perrette. I'm one of the volunteers with the RF Hacker Sanctuary. And I help design and run challenges for the Radio Frequency Capture the Flag that we run at several conferences throughout the country. And part of that is what prompted this talk. So what we're going to be talking about today is what is IEEE 802.15.4? It's not something that a lot of people have heard of, unless you're very familiar with some of these low-rate protocols. We're going to talk about sending and receiving IEEE 802.15.4 data and some hardware and software tools to do that. I think that's kind of the most basic you can get with hacking these types of networks. And then we're going to talk about some RF Capture the Flag 802.15.4 challenges. There's a basic IEEE 802.15.4 challenge. There's also a 6LowPan challenge that I've been running for a little while, and then a new challenge that I introduced very recently. So if you're looking for zero days or new novel research, that's not what's going to be in this talk. I'm going to be talking about how to interact at a basic level with some of these types of networks. It's something that I've seen people seem to struggle with a little bit, and I want to share what I've learned about interacting with some of these signals. Mandatory disclaimer, the viewpoints, opinions, and recommendations in this presentation are my own, and they're not representative of the views, opinions, or recommendations of my employer. So what is IEEE 802.15.4? IEEE 802.15.4 is a standard from the IEEE for low-rate wireless networks. It was first introduced in 2003. It defines the physical and the MAC layers, meaning how the physical signal is sent over the air, and then also the media access control layer, so addressing different devices on that network. So we're talking about point-to-point, from one device to another. That's the kind of thing that this standard specifies. The latest version is 802.15.4.2020, so that was released two years ago. You can get a PDF of that standard for free under the IEEE GET program. It's about an $800 paid standard. If you really want to read through the entire thing, have a good time. We're going to be focusing on just the most common things that are in there. So 802.15.4 can range anywhere from 169 MHz up to 10.2 GHz, depending on which physical layer implementation you're using. They actually do define a couple of different options for the physical layer. I don't know that some of those are all that common, but they are possibilities. In the U.S., the 2.4 GHz and the 915 MHz bands are the most common. The 915 MHz band is split up into 2 MHz channels from 1 to 10, and then the 2.4 GHz band is split up into 5 MHz channels, numbers 11 through 26. I would say the 2.4 GHz band is probably the most common, or at least those are what we're going to be talking about when we get to the challenges later. So I mentioned that IEEE 802.15.4 defines the physical and the MAC layers for sending these signals. And so let's talk just a little bit about the OSI model, and I'm going to talk about that just a little bit because the OSI model, I think, is the networking abstraction model that most people are familiar with. It's not perfect, and so we're not going to dive super deep into things like certain protocols kind of split some of these layers, like the data link layer in particular, and how IEEE defines things slightly differently than OSI. But the main thing I want people to take away from this is that there are different layers, and we're talking about those bottom two layers, the physical and the data link layer, or the physical and the MAC layer. So if you're talking about other protocols like Ethernet, that's at the same level, the physical and the data link layer. Same thing with Wi-Fi, physical and data link again. On top of that, you can use other protocols like IPv4, IPv6, TCP, UDP, TLS, PPTP, SOX, and all the way up to the application level, HTTP. So IEEE 802.15.4 lives down at those first and second layers. A very, very short rant and a nitpick, IEEE 802.15.4 is not the same as ZigBee. So a lot of people have heard of ZigBee. It's got a really catchy name. It's great in its own right, but it is not the same thing. So IEEE 802.15.4 is the MAC layer and the physical layer that ZigBee uses. However, they are not interchangeable terms. So taking a look back at the OSI model, IEEE 802.15.4 is at the physical and MAC layer. ZigBee, 6LowPan, Thread, there are some other things, too, that you can put over 802.15.4. Those are all in those higher level layers. So next up, receiving and sending 802.15.4. So again, I think this is sort of the most basic thing that you can do with some of these signals, aside from maybe just detecting that there might be a signal at all. So if you look in the background underneath the presentation, underneath the slides, you see a scrolling waterfall display that's actually centered up on a fairly active 802.15.4 channel. And you can see some things that are about 5 MHz wide, and those are very likely 802.15.4 packets. This is also overlapping in their range of Wi-Fi, so some of the more broad spectrum things are likely not 802.15.4 packets. But there's a decent number of 802.15.4 packets scrolling through that waterfall behind me. So some of the common tools for sending and receiving 802.15.4 packets that we're going to run through. Killer Bee, OpenLabs 802.15.4 radios for Raspberry Pis, Nordic, Nordic Dongle, SILO OpenSniffer, FreakLabs has a Freak USB dongle that is helpful, and also some SDR tools or software-defined radio tools for interacting with it. So first up is Killer Bee. This is kind of the OG for manipulating IEEE 802.15.4 traffic. Also ZigBee, the name Killer Bee comes from ZigBee. It's obviously some inspiration there. So this is an old tool set, and it's fantastic for capturing and manipulating traffic. Some of the hardware that you can get for it is, or that can be used with Killer Bee, so the App Remote V4 up at the top there, that's something that Ryan Spears and Sergey brought us, introduced at DEF CON a number of years ago. And that's a fantastic tool for interacting with some of these networks. Downside for a while, it was a little bit hard to get. I think there's actually a vendor now selling those for somewhere around $150 or something. I don't have any experience with that particular vendor. Sergey and Ryan were nice enough to give me one of these boards after their talk at DEF CON, and I very much appreciate that. That's enabled me to mess around with a number of different 802.15.4 protocol or devices. Also, the Atmel RZ USB stick, which unfortunately is not made any longer. So this was somewhere around $30 when it was available. Sadly, Atmel decided to stop making it. This is something that you could flash with the Killer Bee firmware, and then use that with the Killer Bee tools like zbdump, zbreplay, and all that sort of thing. Something that I haven't used, but I've heard that other people are using with some success, the TICC2531 dongle, which you can see down in the lower right there. That, as I understand it, is capable of sniffing only with Killer Bee, but that's another viable option for potentially capturing 802.15.4 traffic with Killer Bee. Next up, the OpenLabs 802.15.4 radio. So this is something that can transmit and receive 802.15.4 and 6LOPAN. It's open source hardware. You can sniff with TCPdump, at least within the channel that you're currently on. It's fairly inexpensive at around $13 when it's available. There unfortunately is intermittent availability with it. That said, it is open source hardware, so if you really want to, you can make your own. Not something I've tried yet. I might try to do that at some point, but it is something that is an option to you. Potential downside to using this is that you do need to compile the kernel for the Raspberry Pi and or the modules. So I think you might just be missing a module for the default Raspberry Pi images at this point. There's a helpful guide at the link that's in that slide right there. It's something I've followed to recompile the kernel and the kernel modules to make this module work. You also need WPAN Tools, which is another open source project. So that guide is not 100% perfect, but it's evolved over time. It makes mention of a few different kernel versions that were problematic at a certain point. I believe the current versions of the Raspberry Pi kernel are compatible with this module and with 6LoWPAN and all that fun stuff. I think the latest version I was running was 5.10 point something. Don't quote me on that exact version, something very recent, much more recent than is listed in those directions. Should be able to get things working. Also from OpenLabs, a couple of things I haven't tried yet, but I think are potentially interesting. There's a Pi 6LoWPAN slip radius. So basically what this does, it has some firmware on it that will just talk IPv6 over a slip link to the Raspberry Pi. So the kernel itself is not interacting with the radio. There's potential pros and cons to that. It's a potentially interesting thing. It's also a relatively inexpensive module just like the other one. Again, not something I've tried, but it looks interesting and I know the guy that made it is using them with success. Also this KW-41Z mini board that's got an ARM Cortex processor in it and it's also capable of Bluetooth Low Energy. It can run on a coin cell battery. Again, not something I've used myself, but it looks like a viable option for interacting with some of these 6LoWPAN networks in particular. Next up, the Nordic NRF-52840 dongle. This is a USB dongle that's very versatile. It's got firmware available that can sniff Bluetooth Low Energy and also firmware for sniffing 802.15.4 traffic. There's a Python script which is available to use as an XCAP interface for Wireshark, meaning you can have this external script captured directly into Wireshark and you can control this module from the GUI in Wireshark. It's relatively inexpensive at around $10 and you can get it on both DigiKey and Mouser and I'm sure some other vendors online. Next up, the Celo OpenSniffer. This is not something I have, but I've heard good things about it. It's a multiband 802.15.4 sniffer. It's very expensive at around $622 was when I checked. It was the price on it last I checked within a week or two ago. There is a killer B firmware available. Something I noticed about this particular sniffer when looking at it is that it's got two different transceivers on it using the chips listed there, the Atmel chips there, one for the sub-gigahertz bands and one for the 2.4 gigahertz band. Interestingly enough, that is the same transceiver chip that's used in a couple of the other things like the OpenLabs 802.15.4 board, also something that we're going to talk about next. There are a couple of different things that use that chip for interacting with 802.15.4. This just has two of them and does some processing to make everything a little bit easier. If you're looking for a more professional type sniffer, this might be something that you should look into. The FreakLabs Freak USB is another option for sniffing 802.15.4. This again uses the same chips depending on which version you get. So they have 2.4 gigahertz and 900 megahertz options. They use the same chips as the Saewoo OpenSniffer and it's basically an Arduino that's interacting with that chip. So there's a sniffing firmware which is available as an Arduino example sketch that you upload to the dongle and then you can sniff packets that way. Close to this, you can program it with an Arduino. So if you're looking to write some Arduino code that interacts with 802.15.4 stuff, this would be a really good thing to use. Unfortunately, in some of my testing, I found that it dropped packets, especially when trying to monitor six low-pin data and trying to monitor, say, repeating pings or ping sixes over six low-pin. I found that it seemed to drop some packets compared to some of the other sniffing solutions or some of the other sniffing options that I mentioned. And I also noticed that it seems to be currently unavailable. I'm not sure if that's a permanent thing or if that's just the particular website I was going to wasn't around. But that's something to consider when looking at these. Great, you can do some good stuff with it. But if you're looking to buy something new, you might not be able to find one of these. Last up, I wanted to mention GRIEE 802.15.4. This is an out-of-tree module for GNU Radio that can interact with 802.15.4. I think they have a couple of different physical layer implementations available in this out-of-tree module, both OQPSK and CSS. They might have others at this point, I'm not 100% sure. But this is something that you could potentially use to use a USRP as a transceiver or potentially a BladeRF or something like that. That said, this is a little bit more difficult to set up. It doesn't work just out of the box necessarily. It's not something that I've been able to get working, which doesn't mean that it doesn't work. It just means that I haven't spent enough time to get this working myself. But this is something that I'm sure it works based on the amount of work that's gone into it, and I have a lot of respect for the guy that made it. So I have no doubt that it does work if you get it set up correctly. But this is something that you could use to send and receive 802.15.4 packets and have a lot of control over every aspect of the physical layer, the Mac layer, everything you want. Next up, the RFCTF 802.15.4 challenges. So in the RFCTF flag, for anybody that's participated in that, you've probably seen some of these little devices. These are Arduino UNOs with little XB boards on them. So that is an XB-S1. So those are XBs that communicate over 802.15.4 if you configure them to do so. So these are simulating an industrial temperature sensor. The idea behind this challenge is I wanted something that was just plain 802.15.4, very basic point-to-point communication, just sending a little bit of data, which I think is what 802.15.4 is really designed for. Sending small amounts of data back and forth just between a couple of different points. You can be more complicated than that, but this is, I feel like, about a very small amount of data going back and forth between the simulated sensor on the right there without the LCD, and the simulated display, which is on the left with that LCD display on it. So the idea here is that there are a couple parts to the challenge. One is to receive the 802.15.4 traffic. And so in addition to sending the simulated temperature data from the transmitter to the display, there's also a key that's being transmitted in ASCII across that. So if you're sniffing this traffic for a little while, you'll see a bunch of simulated data, and then you'll also see an ASCII key go across in clear text at some point. The second part of the challenge is reverse engineering this basic protocol, decoding it, and then transmitting a value that's outside of the normal range. So I took the temperature ranges for this based on what's necessary for melting glass. And the idea is that this would be a glass oven, something that's heating up for a little while, it gets up to a certain level, and then it goes back down and kind of cools off, kind of fluctuating in temperature like an oven would. And it fluctuates within a certain range, and if you watch for long enough, you'll see what that range is. And the transmit part of this challenge is to transmit something outside of that range, hopefully triggering an alarm, transmitting something that's too hot for this particular oven, or this simulated oven. Couple possible solutions for this. When I designed the challenge originally, I intended for Killer Bee to be used to decode and to replay the traffic for this challenge. So one possible way you could do this is take Killer Bee with whatever dongle you happen to have, sniff the traffic with zbdump, and then take that traffic, you can extract the receive key, the RX key in ASCII out of Wireshark or whatever else you're using to look at that traffic, and then you can take that PCAP and either create a new one or modify that PCAP and replay that with zbreplay. You can also, at the same time that you're doing that, if you're sniffing with a second dongle, you'll be able to receive the transmit key once you successfully complete that part of the challenge. Alternate solution is sniffing traffic with the tool of your choice, doesn't necessarily have to be Killer Bee, could be anything. You can do things like identify the channel, the PAN ID, the source and destination for the sensor and the display. And then if you have an XBee module, an XBee Series 1 module, you can configure that to send and receive frames just through the configuration tool, XCTU, that's used for configuring XBee modules. So here's an example of what that data looks like when it's going across. So you can see here there are a bunch of data packets going from a source of all zeros to a destination of one. So that is the simulated sensor transmitting to the display. And you can see there's a very small amount of data, just five bytes at the end there. And that's all that's going back and forth, all that's going from the transmitter to the display. Go back real quick here. You also notice there's a destination PAN of 3332, and that's something else that we'll need to plug into the configuration if we want to interact with this. So in this case, the channel that I had set was channel F or 15. I have the PAN ID plugged in there, destination address of one. In this case, I also have my address set to one, so I could potentially receive data. You can mess around with those and have your destination and your source address be the same. You could have them be different. You could have them configured exactly like the transmitter or the receiver. There are a couple of different things you can do here in order to receive all the data and to be able to send the data to where you want to get it to go. Something important here is the MAC mode. I have that set to 802.15.4 with AX. There's a couple options in there with the MAC stream header. That's not necessary for what we're doing, and that could make it incompatible. So I was trying to make this as plain vanilla 802.15.4 as possible. Could have done no AX, but decided to go with AX for whatever reason. Once you have that all set up, in the console log, if you open that up, you can see a bunch of data scrolling past. You'll see there's a bunch of 5-byte hex values on the right there, and then a couple of longer ones. And you can see that the longer ones are just an ASCII DEF CON 30 demo RX key. So that's something I just set up just for demo. The other ones are simulating the actual temperature. You can see in there, there's a 53, which is an ASCII S. In this case, that's just to simulate, hey, this is the type of sensor I have, or it's something to identify the type of transmission. The next two bytes are the actual simulated temperature, and then that's followed by a one -byte checksum, and 0d is just a new line or a carriage return. It's an artifact of how the code is written to send stuff over the XP. So once you figure that stuff out, you've got the receive key, you can also try to craft packets to send them back to the simulated display. That's something you can do through XCTU. You can construct packets just like I have up on the screen here, and then you can send the packets either once or multiple times. And depending on what you send... So there are a couple different things I saw over the amount of time we've been running this challenge. The first one I implemented with no checksum at all, and saw people immediately just jump straight to changing the values to all Fs. Okay, that works. But what if we had some basic error checking, and that's where the checksum came into play. And so at this point, this iteration of the challenge, there are a couple different error states or a couple of different things that the challenge will detect. One is if you just kind of blindly send all Fs to it, including with a checksum, it'll send back a nope key. So basically, the display detected a really rudimentary attack. It knows that that should never happen. Everything was all Fs, so it just kind of blindly went in there and did that and sent it. So this is the one negative flag that we have in there. If you send this and submit that key, you'll get some negative points. Not a lot, but we figured that was kind of mean when people are doing that to go too negative with it. Next up is the try harder key. So basically, what this is, is you capture a packet, and then you modified the right bits for the temperature and modified that to something higher, but you didn't update the checksum. So this is a checksum mismatch. So that's like, you were real close, try a little harder. So that's the try harder key. Finally, down to the bottom there, we have modifying the packet to include both the updated temperature data and also the correct checksum for that data. And that gets you the actual TX key. And here's some examples. So if you modify the data and send a temperature outside of a valid range, just a little bit, you get the screen also turn yellow. And if you send it way over correctly, then the screen will start flashing red as though there were an alarm going off. And that's when it will transmit the key back to you. Next up is the 6LOPAN challenge. So 6LOPAN is IPv6 over IEEE 8215-4. And this is something that is defined in IETF RFC 4944, if you care to read up on that. Basically, all it's doing is defining a way of sending IPv6 packets over 802.15.4 networks. So you can have IPv6 addresses on your IoT network that is running 802.15.4 stuff. Interesting thing about 6LOPAN is that an IPv6 packet is a lot bigger than the max size of an IEEE 8215-4 packet. So an IPv6 packet needs... MTU on that is 1280 octets, and an IEEE 8215-4 frame is only 127. So there's a lot of overhead that you need to crunch down into a much smaller space to get this to work. So a lot of what the standard defines is how to compress the headers for IPv6 and also how to fragment those packets across multiple IPv6 packets. This is something to consider when looking at sniffing traffic for 6LOPAN networks. Something that I thought was a problem... I thought that... Something I learned while preparing for this talk was that I thought that 6LOPAN actually increased the MTU of 802.15.4. I think that's actually not right. I think it just compresses the headers and does some fragmentation to get the traffic to flow across those networks. And I thought that the MTU was bigger because there are some tools... Kilby in particular, the last time I tried to capture 6LOPAN traffic with it, wasn't capturing properly. And I wasn't sure why. I thought this was why it was. I might be wrong about that. But all that to say, there are some tools that capture 6LOPAN properly. There are some that do not. Double check what you're looking at if you're trying to monitor 6LOPAN traffic. Test and verify that your stuff is actually capturing 6LOPAN properly, displaying it correctly in Wireshark if that's what you're using to analyze the data. So the 6LOPAN challenge that I created is two Raspberry Pis that are communicating back and forth with each other over 6LOPAN. You see they're using the OpenLabs 802.15.4 radios. One of them is a client. One of them is a server. One of the challenges is that the client is running ping6 with an ASCII payload. That's something you could see, even if you're not properly decoding 6LOPAN, you might get lucky and see that text going by. And the keys are usually pretty obvious. But just ping6 with an ASCII payload. And then that client is also periodically getting a page over a web page over HTTP. And there's a key on that page. And also a link to a second web page with an additional key. So here's what that looks like if you're monitoring that traffic in Wireshark with whatever tool you choose to use. So on the left there, there's an ICMPv6 packets. And you see a Defcon 30 demo key going by there. Just regular ping6 between two different addresses. You'll see a WCTF in the payload down there. That is actually just part of the IPv6 addresses that I chose to use for this. I figured I'd throw a little Easter egg in there in addition to the key. And also something to make it more clear that this is part of the wireless capsule flag. Over on the right, you'll see the web page that the client is requesting. It's just getting a root. So it's getting index.html. And if you follow that stream, you'll see the entire GET request and the HTML that's coming across. You'll see the key, the demo, 6LOPAN RX key in there. And then you can see the link to that additional page. And if you open those up in a browser, this is what they look like. So it's just a little page saying, hey, 6LOPAN is fun, here's your key. Are you really on the network? Can you click this link? Can you also request this page? And that key link will take you into a second page with the TX key or a key that's only available if you go and request that page yourself. Something that was possible for a while, and I think a number of people were doing, were passively sniffing while other people were solving this portion of it. For the most recent iteration, I added HTTPS to the key page. So the client will request the regular page, the index.html over HTTP. And that goes across in clear text, and other people can see that. You can passively sniff that and get that flag. But now when you go to the key, that's encrypted over HTTPS. And so other people won't be able to passively steal flags if you're computing in the wireless capture flag. Next up, a new challenge for this year. I wanted to introduce an RFCTF 6LowPanFox. So for anybody that doesn't know what I mean by a fox within the confines of an RFCTF, fox hunting, a.k.a. finding mobile transmitters, is what we're talking about. So in this case, there will be a 6LowPan transmitter roving around whatever conference we're at, and the goal will be to go and find that transmitter. If you're unfamiliar with fox hunting, there's a DEF CON 22 talk in the wireless village by Adam Worth called Practical Fox Hunting 101. This is an excellent intro to fox hunting, and he talks about a number of different techniques and considerations that you need to think about when fox hunting. We're not going to go into all of those during this talk, but if that's something you're interested in, definitely go find that video and watch that talk. There's a lot of great information in there. So when I was creating this challenge, one of the most important things that you need for fox hunting is to be able to figure out where that signal is, figure out how far away from that signal am I. So where's the signal strength? And if you look in this capture from below, there's a bunch of information in that capture, but one of the things that's missing is signal strength. There's no RSSI, there's no other way of representing signal strength. And so I want to make sure that this is solvable. So when I created this challenge originally, I started looking through a bunch of my captures, started capturing a bunch with all the different tools that I had, and I found that none of them had signal strength available. It took me into this rabbit hole of, you know, why is signal strength missing? Where would I find that? Is there anything that will show me that? And I started thinking about, you know, this is something that shows up when I do, when I sniff Wi-Fi with Aircrack or some other tools, it usually shows up in a header above the, above that Mac layer stuff. It's an extra layer that shows up in Wireshark. And before we get into it, this is the, this XHCD comic is the most applicable to what I found in this rabbit hole that I went down. There, it turns out there are multiple ways to represent signal strength. And there are many different standards. There doesn't seem to be a clear winner. There's some that sort of win in Wi-Fi, but there's even less of a clear winner when it comes to 802.154. So in 802.11, there's a, most commonly if you're capturing with Aircrack or something like that, you'll see a radio tap header. You'll also see underneath that a WLAN radio header. Actually, both of those additional protocol layers will show you some form of signal strength that you can go and look in your PCAPs for that. And there's also a case PPI pattern or header. So case, like for anybody that remembers the Air PCAPs, the company that made those, case per packet information is what that stands for. And that's another way to represent a number of different extra data fields with additional information about each packet. So when we get to 802.154, there is an 802.154 radio tap header that's relatively new. I think, I want to say 2015 or so, somewhere in that range. With the NRF sniffer or that NRF dongle that I mentioned earlier, their dongle will let you do that as long as you specify an additional metadata field. So that IEEE 802.154 tap as the metadata. You can also select that in Wireshark, which I'll show in just a minute. With Killer Bee, Killer Bee uses another header. It uses the case PPI headers, so the old 802.11 standard. They kind of repurposed that for 802.154. ZBdump does not use that header by default. You need to use the dash P flag or double dash PPI flag in ZBdump. And then you'll get that per packet information. You'll get signal strength. This is something that took me a little while to figure out because in the help output for ZBdump, it doesn't tell you what that dash P stands for. So if you don't know that PPI stands for per packet information, you might miss that option in ZBdump. But both of those tools will capture signal strength for you. And that's something that you could use to potentially foxhunt. So I mentioned that the NRF dongle and the Python script for that is available as an XCAP interface for capturing data in Wireshark. And here's what that looks like when you're configuring it. So you can select the channel that you want to capture on. You can select 802.154 tap from that out-of-band metadata. And then if you look on the right there, you'll see that 802.154 tap layer above the 802.154 data. You can see we have an RSS, in this case, of negative 51 dBm. So that's the kind of information that we need to be able to foxhunt successfully. And that's all I've got for you today. So if you have any questions, the easiest place to find me is going to be on the RF Hacker Sanctuary Discord. My username on there is RedBaron. I'm also on Twitter with underscore TheRedBaron, underscore some number of underscores under there. You can find me from the RF Hacker Sanctuary website under the crew page. The bio listed there is 100% accurate. And like I said, this is not original research. You know, this talk was intended to tell people with some of the things that I've struggled with in interacting with some of these networks and to convey some of the lessons I've learned over the years of interacting with these things. So I'm hopeful that more people will interact with these types of networks, go find more devices, maybe do some more driving with it, interact with the RFCTF challenges a little bit more. Hopefully we get somebody to find the 6LopanFox at some point. That's all I've got for you today. Thanks and have a great day.