My name is Matt Knight. I'm a software engineer with Bestial Networks. And today I'm going to be talking about this new wireless protocol called LoRa. We'll get into that in a minute. I love electronics and wireless. I came from a double-E background, work mostly with SDR these days. This is my passion, so I'm excited to be here. I also want to give a shout-out to the Wireless Village people. I've absolutely haunted this place for the last four or five DEF CONs, and I'm really excited to be here and present for you guys. Okay, before we get started, this is going to be more of a FI radio talk than like a security talk. No zero days, no exploits, but we are going to look at a very low level into a brand-new cutting-edge protocol. So before we get started, I just want to gauge the room. Hands up if you've used SDR before. Okay, good. If you've used a spectrum analyzer. All right, cool. And you know what an FFT is? And who knows what a symbol is in the wireless context? All right, cool. All right, so why is this relevant? Why do we want to look at a low level at these different radio FIs? Cisco projects that by 2020, there are going to be 50 billion devices connected to the Internet in some way, and fewer and fewer of those are going to be connected with wires every year. And in terms of, you know, security research and having insight into what they're really doing, we need to develop tools to be able to stay ahead and really be curious about these things, because Wireshark existed because somebody made it. And monitor mode capable Wi-Fi cards weren't always a thing. So we need to make the tools so that we can do this low level introspection and stay ahead of the game here. So I'm going to introduce this new class of network called LPWAN. We're going to review some technical concepts, and then we're going to get really low into the LoRaFI and talk about how it works. Finally, I'm going to introduce an open source tool that's coming out soon, and we'll hopefully get this into more hands. Before we get started, everybody's favorite marketing buzzword right now is IoT, Internet of Things. I kind of reset the term because really it's just fancy speak for connected embedded devices. And... Okay, how's that? All right, so embedded can mean a number of things, but a common theme is that there are hardware constraints involved. You often have low intelligence CPUs. They're battery powered, so you can't do complex operations on them. They get installed in hard to reach places. They need to last for a long time. They might not get patched. And they do often require installation provisioning. You have to have somebody go. Put them somewhere. And change some settings to get them to connect. So given this, an ideal interface, if we could design it, would be wireless so you don't have to run cable to it. Easy on the battery so it can last a while. Capable of being installed anywhere, whether it's in the middle of a field or in a building in an urban environment. No configuration. Easy to provision. You don't want to have to type in, you know, an SSID and a password to get it on Wi-Fi or, you know, pair it with a coordinator. You need a gateway on site or something like that. And finally, it would be inexpensive. Now let's talk about what's not required. And oftentimes when you're connecting devices like this, high throughput and persistent and always on connections are often things that we don't really need. If you have a sensor that you're just trying to report some data off of, you know, GPS every ten minutes or so, it doesn't really require an LTE pipe to do that. So as it currently stands, IoT devices are grossly over served by some of the common interfaces that are out there. So when we talk about IoT interfaces, we're often talking about things like 802.5. It's like 15.4 and all of its friends. Zigbee is a layer three and up flavor that, you know, people confuse. But 802.11, you know, Wi-Fi gets used a lot. We have Bluetooth, Bluetooth low energy, et cetera. So what's wrong with all of these? We have these standards. Why don't we use these? All of these protocols that we've talked about require some local provisioning. Whether it's Zigbee or 802.11, you need to connect to a coordinator. If it's Wi-Fi, you need to get on. Get on an AP, et cetera. In the case of 802.11, it's not too power efficient. So what's ideal then? What if you want an application where, say, your device is moving around? You're monitoring a vehicle fleet that, you know, drives throughout a city or across the country. Or if you want to monitor, you know, fuel tanks. If you have, like, heating oil tanks in New England and you want to remotely report back on their level on how full they are. You don't want to have your installers having to go and get on the home Wi-Fi of everybody there. How about cellular networks? They work everywhere. And they're easy to install. You know, pretty much guaranteed. One big problem with them is that they're very power intensive. And the second problem is that some of these PHIs are going away. So 2G in particular. AT&T is scheduled to sunset it at the end of this year. So January 1, 2017. They're turning off their GPRS and edge PHIs. And other major carriers are going to follow. These networks are really popular for a lot of these IoT applications. Because they're battery conscious. You get service everywhere. And they're somewhat inexpensive. So if you are a company that is deploying a device on a GPRS or edge network now, what are you going to move to? You can move to 3G, which is a little more expensive. It has some harder power requirements. Or you can wait for this thing called LTE-M release 13. It's part of the LTE standard. And basically it's going to allow for devices to use narrower bandwidths and lower data rates to get some of these higher performance applications for long-term embedded applications. However, the roadmap as it currently stands, at least what I've gleaned publicly, is that that's not going to be deployed until the end of 2017 or early 2018. So until then, there's a big hole in the market for these embedded devices to connect. So that brings us to the topic that we're going to discuss today, which are these low power wide area networks. LP WANs. The way to think of these things is they're just like cellular, but optimized for IoT and M2M applications. So you have a network of base stations that are deployed over some area. You know, it could be local. It could be a city. It could be, you know, the entire world. And then devices connect up to them as they would in a star network. So you have these central base stations and then devices and nodes connect directly. There's no meshing, no routing, just device wireless link to the base station. They can uplink and downlink traffic in many cases. And they have a range typical of miles. So, again, really think of this just like being cellular, but for low data rate applications. There are a whole bunch of standards that are popping up. But the most popular ones are the ones that we're talking about. The ones that have the most momentum are LoRa and Sigfox. They've raised a ton of money in the last, you know, 18 months or so. LoRa raised or, sorry, Sigfox raised $115 million last year. And Wall Street Journal reports that they're going to IPO. So they're growing like crazy. Raise your hand if you've heard of them. Not too many hands. And finally, two companies that are big LoRa backers raised $51 million last year. So there's a ton of investment. Investors see the revenue. They see the relevance here. So expect to see these protocols be more and more relevant going forward. Let's talk about the stacks and what makes them cool. As I mentioned, they're optimized for IoT applications, meaning they're very battery conscious. That's probably the big thing. Sigfox, one of those standards I just mentioned, gets 10 years on a single AA battery. That's what they advertise. That's, like, pretty crazy to be sending data over miles for 10 years on a single AA. You cannot do that on LTE. And LoRa advertises 13 miles of range between the end node and the base station. So pretty crazy coverage. Compare that with, like, 2G, which has a limit in the standard of 22 miles. All these other things are really local, short range, and they are not great on battery. So this is a huge step forward for embedded devices. You know, how can they do this? They embrace the fact that embedded and IoT applications can accept some level of compromise. So they embrace this, and they do recycle the messages heavily, so you're not sending that much traffic. You're often not always listening all the time. So you might have scheduled windows where the end device will wake up and keep the radio on, look for downlink from the base station. Really small payloads. We'll talk about that in a minute. And they're very highly rate limited. So some examples. Sigfox limits devices to 140 12-byte datagrams per day. Think about that. That's like, I mean, what is that? That's like a single UDP packet. And finally, waitlist N is uplink only, so it can only send messages up to a base station. It cannot accept messages down. And finally, LoRa class A devices only can receive a downlink message from the base station after sending an uplink message. So they're not promiscuously listening. So this is quite different. And there's some really unique features that contribute to this. So the rest of the talk we're going to spend talking about one of these LPWANs in really great depth. We're going to talk about this PHY called LoRa. LoRa is an LPWAN PHY that was developed by a semiconductor company called Semtech. It was actually developed by a startup that was acquired by Semtech. But Semtech is the company that's evangelizing it and pushing it worldwide. The PHY was patented in 2014. And the first definition of the PHY was, the MAC and network stack that they're pushing products on came out last year. So these things are brand new. They really haven't been battle tested and are just starting to become available. Just to clear something up before we continue, oftentimes you'll hear the term LoRa used. Sometimes you'll hear about LoRa WAN. LoRa refers only to the PHY layer. And LoRa WAN is the higher layers built on top of it. So think of it as being like 802.15.4 versus Zigbee. Different layers of the stack that often get, get used together. LoRa WAN defines a whole bunch of security features. They have a pretty, they've, they've done a pretty good job of thinking about these things, things ahead. But some interesting features is that the MAC stack is controlled by an IP-based network server that does all of the intelligent coordination in place of the base stations. Probably do some more on that later, if there's time. But they also define the security architecture that does enable a unique key being used per data. So if you're using a device, but that's left up to the, that's left up to the application to, to implement, of course. And they also have two different keys. So you have the application key, which is end-to-end between, you know, your company's application server and the end node. But then there's also a network key that protects everything going from the end node to the network server. So if you're a developer, you can use these application keys to make it such that the carrier never sees your, your content in plain text. That's all we're going to say about LoRa WAN. We're going to talk about the LoRa PHY from here on out. So one of the really unique things about, about this PHY is that it operates an unlicensed spectrum. So when we say unlicensed, we're talking about the ISM bands in the U.S., primarily 900 megahertz and 2.4 gigahertz. And in these bands, you have devices like Wi-Fi, 802.15.4, cordless phones, etc. You don't need a special license to operate on those bands, so long as you abide by certain rules and regulations that the FCC has put out. You know, if you go to Best Buy and you buy a router, you don't need to, you don't need to petition the FCC to get, to install it in your house. You can just do it. It's because, you know, Netgear or whoever you're getting your router from plays by the FCC's rules. They get it certified and anybody can use it in mass market. Contrast this with cellular, right? Cellular operates on private and protected spectrum that is very expensive. The FCC auctions the air rights of the spectrum for billions of dollars, which restricts building infrastructure to the biggest companies, you know, Verizon, AT&T. You can't put up, legally put up your own 4G base station, your house if you wanted to. You'll get a phone call. So, I don't know if you can see the numbers here, but this is a price list from the FCC's reverse auction of some very high value wireless, or TV white space spectrum that was recently auctioned. Circle one number there, you probably can't see it. That is $900 million for WCBS TV in New York. So, you know, if you want to start a cell network, you know, maybe we can pass the hat and buy some spectrum at the end of the con. So, there are a couple companies that are building up cellular type networks on this LoRaWAN technology. The two big ones are Senate, which actually started with that heating oil monitoring scenario that I mentioned earlier, and now is doing a commercial data network, you know, kind of at scale. And the Things Network is another one that's really interesting. That's a totally crowd sourced network. So, you know, they own a couple base stations here and there, but really what they do is they provide that network back end architecture open on the internet, so that anybody can buy their own LoRa hardware, set it up wherever they want, and then send the data back to their network servers. So, think about how radical this is. You don't need a spectrum license to stand up a base station that can cover miles and miles of range. You know, one day you might be able to go to Best Buy and buy a LoRaWAN gateway and set up a network that either could be private or could be hooked up to something like the Things Network that could cover, you know, all of Manhattan, right? That's really cool, and that's like a pretty radical shift for connected devices and IoT applications going forward. Okay, so we're going to run through this next section. I figure it's on the first, you know, technical talk of the session here at the Wireless Village and DEF CON. We might have varying levels of experience. Let's just kind of even the playing field a little bit. This is going to be obscenely short, so bear with me here. We're talking about the file layer for the rest of the talk, which is this lowest level on the OSI stack. And that refers to how bits of data get mapped into the physical electrical characteristics that are used to carry it. So we're talking about, you know, voltage, you know, current, actually moving electrons. So that's where we're going to be moving forward. We're talking about a wireless protocol, which travels over radio frequency, and that's just electromagnetic waves and energy moving through the air. And you can manipulate RF by using a radio, which can either be hardware-defined, like a chip that speaks one protocol really well, or software-defined, where you have really flexible hardware at the front end, and then you implement the hardware and protocol-specific stuff in software. Really flexible and allows you to iterate and prototype things really easily. When we talk about radio PHYs, one of the most important components is this thing called the modulation. And that defines how the digital data values get mapped to RF energy, how you take the bits and convert them into signals moving through the air. And when you're modulating, there are three parameters that you can play with. You can play with amplitude, frequency, and phase. Or you can, you know, put them together in a combination. Modulators can be either analog or digital. And with digital modulation, we have this notion of something called a symbol. And a symbol is an RF energy state that represents some quantity of information. It is discretely sampled. We're going to get into this more, but just think about this concept of a symbol being a state that represents data. We're going to talk about it more going forward, so just remember that. To illustrate some symbols here, we have two different IOT, you know, common IOT PHYs. On the top, we have frequency shift keying. On the bottom, we have on-off keying, which is like an ASK type thing. And on the FSK example, a symbol representing a single bit of information is a frequency being on, or is the power being in one frequency versus the other at some instant in time. And with the OOK example, it's the presence of the signal. So these are all different, how different modulations represent digital information over the air. There are some more complicated PHYs that are used as well. On the right there, we have an 802.154 packet. And what 802.154 does is it spreads, it spreads its information across a wider, it spreads its information across more spectrum to increase resiliency and get some, you know, low power features in there too. It makes it more resilient to RF noise and interference. And some other more complicated PHYs are Bluetooth and Bluetooth Low Energy that do some frequency hopping and things like that. So we mentioned hardware and software-defined radios earlier. We're going to use one of each in this talk. On the top, we have a hardware-defined LoRa module. That's what I use to generate the traffic that we're going to take apart. And on the bottom, we have a really popular Edis B210, which is a commodity software-defined radio that we're going to use to prototype our receiver and iterate quickly on this protocol. Last thing I want to talk about is a fast Fourier transform. What this does is if you feed it some samples, it will decompose the signal into the component frequencies that comprise it, and we can visualize this using a spectrogram. So here we have a whole bunch of FFTs that we've run over a signal in time. And then we have time in the y-axis, the frequency increasing in the x-axis, and finally power in the z-axis, how intense the signal is there. We're going to be seeing some more of these. Okay, cool. That's enough with the crash course. Back to the main event here. LoRa implements a proprietary PHY that's built on a modulation called Chirp Spread Spectrum, CSS. Now, what is a chirp? A chirp is a signal that is continuously increasing or decreasing in frequency. It's like a sweep tone. We have some visuals here. An up chirp is on top, and here you can see the frequency is linearly increasing until it hits the edge of the band, and then it wraps around to the bottom of the band and continues increasing. The frequency can change instantaneously, but the rate at which it's changing is constant, right? The first derivative of the frequency is some constant value that's going up. We can have the complex conjugate of that too, which is the down chirp with the frequency decreasing. So it just keeps going and then wraps when it hits the edge of the band. Why would you use CSS to carry data? It's very resilient to interference and gives you great, you know, link budget, multi-path performance for real-world deployments. So it provides some benefits. It's pretty interesting. Where else would you see something like this? And the answer is radar. CSS features are, you know, derivative of some RF elements that you often see in radar systems. Just some examples here. Marine radars will use chirps for their ranging applications. Also, chirps are used in some scientific and atmospheric radars. There's an open-source project that's pretty interesting that has some really cool visuals online if you want to check it out, of chirps being received that had been reflected off of the ionosphere to measure space weather and geomagnetic activity. So that's pretty cool. So I first heard of this LoRa protocol in December of last year. I thought it was pretty cool, so I went to look for it. I got my SDR and went on a little fox hunt. I couldn't find LoRa in Boston, Atlanta, San Francisco, or New York. Pretty big engineering urban centers. However, you know, a few weeks after I heard of it, the company sent it to meet up in Cambridge. They were talking about their company and their network. One of the things they mentioned was that they were growing pretty rapidly. So I was watching one of their marketing videos and they popped up this pretty slick graphic. Looks like a coverage map, right? And I look a little closer here and, you know, where is that? That's Portsmouth, New Hampshire. So at the time, I was living in Cambridge, Mass. And, you know, Portsmouth isn't too far away, so I grabbed my radio, went for a little drive, and here I am sitting in my car, usurp on the dash, and the result of this little field trip was some LoRa found in the wild. So luckily that graph they showed was real live data on their deployment. The base stations that were on that picture were real. So there you go. So let's take a closer look at this random signal that we captured in a parking lot in Portsmouth. This is, you know, part of the PHY frame that we pulled out. Some features we can immediately identify is up at the top, we have some continuous repeated upchirps. So the signal is just increasing kind of continuously. And finally, about halfway down, we have, sorry, you can think of that as being like a preamble. Finally, halfway down, we see the chirp direction changes. We have two downchirps. Which, you know, looks like a start of frame delimiter or some sort of synchronization element. And then finally after that, we have these choppy upchirps of varying length. So again, notice the frequency is always increasing, although it might change instantaneously. So, you know, the rate of change for the frequency is always constant in that PHY data unit. But the frequency might jump within that band. And that's how we modulate data onto this waveform. So, yeah, we just talked about that a little bit. Jumped the gun on this slide. But one way to think about the way the data is encoded is it's kind of like frequency modulated chirps, right? Chirps are, you know, kind of your signal that you modulate and you modulate it by changing the instantaneous position within the band. So let's take this thing apart and try to get the data out of it. So LoRa is a closed PHY. It's proprietary. The spec is not published. The LoRaWAN spec that defines the MAC and network layer, that's open. You can look that up. But the actual modulation is closed. And that's because, you know, Semtech, they make ICs. They don't want other people knowing how it works. But there are some documents out there that leak a little bit of information that we can use to start gauging our exploration here. They have a European patent application which talks about some very high level concepts. They have that MAC and network spec which talks about PHY elements without necessarily going into too much detail. We have some application notes which talk about some radio specific considerations. That's if you have one of their LoRa ICs you know, some of the features that they implement. And finally, there's a little bit of prior art out there. There was an open source project called RTL Strangelove that had an attempt at a LoRa decoder. I never quite got it working but there were some good hints there. And finally, some pretty high level observations on the PHY in a wiki page. So from all this documentation we're able to start to pull out some definitions about features that are actually occurring in the PHY. We have the bandwidth which is the width of the chirp. How much frequency we have you can see the chirp traverses if just allowed to run continuously. Secondly, we have this notion of the spreading factor. And this is very important. This is a very important concept that we'll talk about. The spreading factor represents the number of bits encoded per symbol. So this is a spread spectrum modulation meaning that we have multiple bits being encoded into each symbol. So the spreading factor is the number of bits in each RF energy state that we're going to measure. And finally we talked about the chirp rate that's the first derivative of the frequency all of these things are mathematically defined and from these documents we can start to figure out how they relate to each other. The bandwidth in the US is 125 250 or 500 kHz the spreading factor ranges from 7 to 12 bits per symbol and finally the chirp rate is a function of the first two. So if we know the modulation parameters we can figure out what the chirp rate is. So what's a symbol in this case? We mentioned it being a frequency modulated chirp but what we're going to be trying to do when we demodulate this is measure the changes in frequency throughout the band as that chirp jumps. Alright so here's our little checklist here. When writing software to find and decode this there are a few steps that we need to do. Pretty much all digital radio systems have a preamble and a start of frame delimiter for training the receiver to pick up an incoming message. So the first thing we're going to do is we're going to find the preamble which is those repeated up chirps at the beginning of the frame. So when we think we're about to receive a packet we're going to start looking for those two down chirps which we're going to use to synchronize on the start of the message. Finally once we have that we're going to extract the data from the frequency transitions by doing some math. So how can we do this? One technique that I found that was pretty cool was if we do a little transformation on the signal it puts it into a form that makes it pretty easy to work with. So we can de-chirp the signal by generating a local copy of each of those two chirps and multiplying it against the original baseband. And we know what the chirp rate is because there are a finite number of modulation parameters we can kind of guess them until we get the correct chirp rate which is just a function of those two features spreading factor and bandwidth. So we do that and we start to see something interesting here. This is just an IQ signal being run through a GNU radio flow graph that does this. So some repeated elements here. I don't know if you can see it we'll move quickly through this and look at a better picture in a minute. But here we can start to see that those chirps that were previously diagonal moving throughout the spectrogram have been rotated and they're now vertical. And that looks like something we can start to play with. So going back to symbols we know that the symbol is the energy state representing how many bits of information there are. And since LoRa is spread spectrum there are multiple bits per symbol. We can derive from this the number of possible symbols that there can be and that's just 2 to the spreading factor because the each bit can either be a 1 or a 0 and that's just how it works out. So we can leverage this to come up with a method for extracting symbols from this D chirp signal. And we can do that using a fast Fourier transform. If we set the width of the FFT that is the number of component frequencies that we're looking at and run the D chirp signal through it then each bin will represent a possible symbol and then the symbol which is present is just the bin that has the most amount of energy in it. So here's our original signal next to the D chirp signal. Again chirp can either be positive or negative up chirp or down chirp so when we do the multiplication we do it against both and we get out these 2 different IQ streams. So on the left is the D chirped up chirp and on the right is the D chirp down chirp. So you can see that the preamble and the data which are always up chirps are going in the right direction and the those come out when you D chirp the up chirp and finally the SFD, those 2 down chirps you can see is a pretty intense little red spot right there on the right. Going back to our flow graph we need to start working through this process and actually writing software that does this. So identifying the beginning of the packet is signified by finding this preamble and the preamble in the case of Laura is the same symbol being transmitted over and over again. Remember it's just that continuous up chirp. So when we D chirp it all that energy winds up being in the same FFT bin. So we can do this and just look for a number of consecutive symbols having the same value and that says okay, we're probably getting some data out of this. We're probably about to receive a packet. Finally once we've found that, we need to start looking for that synchronization word that we're going to use to lock onto the start of the packet. And we do that by looking at the opposite D chirp signal. So again remember we found the preamble in the D chirp up chirp signal. So we're now going to look at the D chirp to down chirp signal and look for that SFD. And in the Laura Phi I found it to be two symbols so we just look for two symbols that have the same value and then we can use that to synchronize. We're missing something important here and that's that SFD detection is essential for having accurate synchronization. And if we have a bad sync, in this case what can happen is we can wind up spreading energy between multiple consecutive FFT bins. And that can lead to reading the data out incorrectly. Here's an illustration. If you look at these bits that I've pulled out, we have element 39 and element 50, you can see that there are basically two peaks in each of those FFTs. Ideally we should just see one because there's only one symbol because we're reading out one symbol per FFT ideally. So basically what's happening here is we have multiple symbols leaking into each FFT. You can think of it as if you have a buffer and each symbol is two to the spreading factor number of samples. In this case it would be 256 because this is an SF8 spreading factor 8 signal. You can think of it as being that 128 samples in that buffer are from symbol 0 or symbol n and then 128 samples in that buffer are from symbol n plus 1. So we need to basically realign that and get it so that 256 all 256 samples in that FFT are from one symbol. So one way we can do that is we can increase our FFT resolution in time by overlapping them. So basically what we do is if you have your FFT buffer you kind of walk it through and process each sample multiple times as it traverses through the buffer. This has the effect of getting you better resolution in time. So we overlap the buffers and we get this nice picture on the bottom here. On the top we have a non-overlapped FFT, same picture we saw earlier with the collisions. On the bottom you can see that those features start to become much more defined. So if we do that when we're looking for the SFD, oh yeah sorry this is the overlapped FFT zoomed in a little bit here it is, looks much cleaner. So if we overlap these FFTs when we're looking for the sync word, we can get a very precise we can very precisely calibrate our receiver to that and read the data out correctly. So here are all three on the left we have the non-overlapped, in the middle we have the overlapped FFTs and on the right we have the synchronized the synchronized non-overlapped FFT that we compute after we find that sync. So we'll zoom in just a minute here look at line look at line 39 there, 38 and 39 look at how much better that looks. I know there's some noise in there but you can see where the maximum is right? It's much cleaner, much more defined. So there it is, we went from the the unsynchronized to the synchronized and we get much better precision out of that. Finally step three, we need to extract the data the data from the payload section, which we'll get to in a minute and then we normalize it about the preamble so if we take whatever bin the preamble occurred in as being data element zero, then we can just rotate the data values within, or relative to that, normalize it and we're good to go. That's it, right? Hardly, we're just getting started. That's the demodulation and the data that's being sent over the air is being encoded. What is encoding? Basically the data gets transformed before it gets sent to the demodulator to increase the over-the-air resiliency of the signal. Why would you want to do this? Why would you want to add the complexity of adding this encoding onto your signal? Well, a smart guy once shared some information with me. Is he here? You should talk to him. He knows a lot. I didn't quite understand this at the time but I think what he was getting at is the fact that radio frequency is a really brutal environment to operate in. All systems can see interference from the environment, whether it's weather, other devices, and then add in the fact that this PHY is designed to operate an unlicensed spectrum where you're guaranteed to have lots of other traffic, right? You have to contend with Wi-Fi, you have to contend with Bluetooth. If somebody is microwaving their leftovers, that's going to produce some emissions in 2.4 and that's going to interfere with you, right? So encoding scrambles and replicates the data within the frame to increase resiliency. So what do we think we have here? Let's take a closer look. We have some clues from those documents that we looked at earlier. Specifically, the patent suggests that there are four stages of encoding being applied here. First, we have this thing called gray indexing which adds error tolerance for off-by-one symbol errors. So if when you do that FFT on your DTRIP signal, the power accidentally registers as being off by plus or minus one bin, the gray coding will correct that when you apply it. Secondly, we have data whitening, which induces randomness, lots of little transitions for your receiver to synchronize on. Third, we have interleaving, which scrambles the bits within the frame, just takes all the bits that are there and moves them around. We'll talk about that in a minute. And finally, forward error correction, which adds correcting parity bits. So we have some, from our open source intelligence, we have these four distinct operations to reverse. So when the order that's being presented here is the receive, the receiver's, the order that the receiver's gonna process them in. So the receiver would start with step one, you know, go through two, three, and four. The transmitter does the inverse. So steps go four through one when the transmitter's preparing this data. But again, we're reversing this, so we're thinking about this from the receiver perspective. Now, I'm gonna do, I'm gonna go a little bit out of order here, and I'll explain why. I'm gonna start by explaining the forward error correction. The reason why is because the forward error correction is essential for reversing the other steps. We're gonna exploit some properties there that make the other steps a little easier to understand if we can understand what the FEC does to the data before it gets sent. So forward error correction, you can think of it as being like parity bits on steroids. They are parity bits that, in addition to detecting errors, can repair them. A common FEC scheme is the Hamming scheme, where, depending on how many bits you have, or some, you know, some little rules that define how many bits get you a certain amount of tolerance, you can repair errors. So if you have, let me explain these numbers here. So we have two pairs of numbers in each of these different modes. The first number is the total number of bits in the encoded data code word, and the second number is the number of data bits that get input. So the difference of the two is the number of error correcting bits that get added. And if you have one or two error correcting bits for four data bits, you can compute parity, just like having a parity bit in, like, RS232 or something like that. But if you have three, then you can go a step further and correct an error bit. And then if you have four parity bits, in addition to correcting that bit error, you can detect if there were two. You can't correct two, but you can, you know, you can at least know. Okay, so I'm missing a slide here. No, I'm not. Okay. So we're gonna come back to this later, but just remember that when we're talking about FEC, we're adding parity bits to the data bits. So you're increasing your data size as you apply FEC. Okay, so going back to that flow graph, right, this is step one, the gray indexing. The patent suggested that gray coding was applied to the signal before it was sent, and in fact, experimentally it was determined that the gray encoding was actually the reverse. The payloads that were sent were de-grayed before they went over the air. And we were able to determine that experimentally while working on the whitening. Again, the whitening is that step two, which is, induces the randomness into the data. So the way the whitening works is the transmitter will XOR the data against a pseudo-random sequence that is known to both the transmitter and the receiver. So this basically takes your data, applies it to some mask, and then sends it. The receiver will then XOR the received data against that same pseudo-random sequence. And that will return the original frame because XOR is its own inverse. Why would you want to do this? Randomizing the data adds some features to it that make it easier for the receiver to lock onto. You can think of it as being like line coding, like Manchester encoding. However, whitening has an advantage in that it doesn't reduce the effective bitrate that your signal can use. Manchester imposes a penalty of I guess, your effective bitrate becomes half of what it would be if you weren't applying Manchester encoding. Whereas whitening, since it's just an XOR, there's no penalty there, no overhead. So, we had to find this whitening sequence to know what to XOR or receive data against. There are a couple of different whitening algorithms to find in one of those reference designs, one of those application notes I mentioned, also a few that were published in RTL Strangelove, that open source project. However, none of them worked. I implemented them all. I tried them against receive data and it just didn't make any sense. However, we can again go back to our friend the XOR operator and start to do something clever to back this out. One awesome property of XOR is that if you XOR data against a stream of zero bits, you get the data out, you get the original data out. So, if we transmit a frame of all zeros, from the transmitter's perspective, the receiver is going to get the whitening sequence out of that. So, that's kind of cool, right? So, we're going to do that. Some things that help us get this right is we mentioned the Hamming correction. Hamming 8.4, all of the code words contain four one bits and four zero bits, except for the code words for data zero and data F. The code word for data zero is just all zeros. So, there's no FEC being applied here. It doesn't mess with our receive-whitening sequence. And also, if the interleaving is non-additive, then there are no bits being added. So, basically, by sending all zeros, these two stages fall away. We don't have to worry about them. The only other thing that we need to control for is the gray indexing. So, there are just three different states that we could try. Graying, no graying, and degraying. And then, when we get the zeros out, we know we got it right. So, that's how we were kind of able to solve for these first two steps, the gray indexing and the whitening, kind of in one go. Alright, step three. Finding the interleaver. There was an interleaver to find in the Semtech European patent application that I mentioned. And it suggests a diagonal interleaver abiding by that formula there. Guess what? That also didn't work. Fantastic. So, we're one for four on documented features right now. The gray indexing was actually degray, like the first before it got sent. The whitening algorithms that they gave us did not work. I still have no idea what those algorithms are applied to. You know, they're in the documentation, but they're not what were actually implemented in the PHI. And now this. The interleaver that's in the patent is not the one that's there. So, we're going to have to figure this out experimentally. Okay. So, deducing the interleaver. This was hard. This was the hardest part of all this. Bear with me. I have some graphics that I think will make it a little easier to understand. But just like we did with the whitening, we're going to exploit properties of the Hamming-Ford error correction to get the interleaver to reveal some patterns about itself. So, remember that most Hamming code words contain four set bits except for zero and F, right? So, zero contains no set bits. F, all the bits are set. So, if we craft transmissions that are all zeros except for one set of Fs, and we walk where the F is through the packet, we can start to reveal some properties of the interleaver here. I'll make it easy for you. Does anybody see what's happening here? So, I'll draw your attention to the bottom row second from the right. That's payload for zero F and then the rest is zeros. And you can see that it's almost perfectly diagonal, right? And if you look at the other ones, you can see that it's also similarly diagonal with an offset one other thing that I'll call your attention to is that the most significant bits in each interleaver block are flipped. So, looking at the data didn't make any sense until I constructed these payloads to try to back this out. And this was the first step to start seeing the patterns here. Okay, so with this we've mapped out which diagonals correspond to each four-bit positions within, or to each of the bit positions within the transmitted payload. So, with that in hand, we need to think about aligning each of those code words within each diagonal, right? So, we can map the diagonals to the code word, but the bits that we get out of each code word are scrambled around. So, we need to start looking a little more granularly into each of those diagonals to figure out what's actually happening there. So, our solution again, just like before, is to transmit some known words and look for the Hamming-encoded, the Hamming-Feck-encoded signals within each diagonal. So, we'll take a known, you know, well-loved known payload here and we will map out the diagonals into a table. You guys see what's going on here? Basically, we know the diagonal position from that exercise that we did before. So, we're just reading each position that we know from where the F was into this table here. We populate this little matrix here. And here it is next to the data that we're expecting on the left, right? So, we have the unencoded data in the middle column there, and finally the parity bits that we expect to be applied to it on the right. Does anybody see anything here right off the bat? This might be a little bit harder. Again, I'll make it easy. Oh, wait, no. Sorry. Jumping the gun. One thing that just to help us along here, if you reverse the endiness of this, then we start to see patterns here. So here, we've got the data that we find in these bit positions here. And if we go a step further, we can start to correlate and map some of those Hamming-Fech fields into these interleaver codeword positions. So, these two fell out pretty, or these six fell out pretty nicely. Interestingly, Hamming parity bits three and four were flipped, and that's something that was just deduced experimentally by looking at the actual values versus the expected parity here. And, yeah, so that's a huge step. We're almost there. If we apply the forward error correction to these bits that we have here, we've got it. That's it. That's the whole thing. So, that's the fight. We just went from that weird, you know, diagonal chirped modulated signal to the data that's in there. Just based on some open source documentation and gumption. So, how are we able to do this? So, we have these four steps, right? And I hinted at this earlier that we were able to control for the first two and make an assumption about the last step, the fec, based on some documentation that were leaked. And basically what that meant is that the only experimental variable that we really had to solve for that was really hard was the interleaving. But since we were able to control these other three, then we had one that was we only had one variable that was unbounded and then we could solve it. It's like algebra. Okay. So, what's next? You guys want to play with this, right? You guys want some tools. I'm working on that. So, I want to briefly introduce GNU Radio LoRa. It's an out-of-tree GNU radio module that implements the LoRa PHY. I'm working on it currently. It's going to be released between now and GNU Radio conference in September. So, this will be out there. You guys can grab it and play with it. You know, it's going to have all that good stuff. I have a proof of concept receiver complete. I just got the time warning. I don't think I have time for a full live demo. But if anyone wants to see it, I will be happy to show it to you right after this talk. So, finally, to conclude, these LP WANs have a ton of momentum and are rapidly proliferating. I mean, you're going to be seeing these everywhere with all the money they're raising, with how much everybody's emphasizing IoT. It's inevitable. These things are going to be everywhere. One other point I want to make is that RF stacks are becoming more diverse. When you think about wireless, oftentimes in the enterprise we think about 802.11. But wireless is not just Wi-Fi anymore. You have to start to think about these protocols. Bluetooth, cellular, it's all out there and it's all starting to become connected to the internet and more and more interrelated. Third, we've shown how to go from some obscure RF signal to bits. And fourth, we're adding a new tool to the RF security researchers arsenal. So you can start to take a look at this brand new network that is totally greenfield and start to find things and make it better. Finally, I want to acknowledge my team at Bastille, especially Bell and Sieber for helping make this happen. The open source contributors for starting to look at this and the wireless village for hosting. Thank you very much. I'm happy to take your questions. Okay, so the first question is, have I heard from the company in question? And I actually have. So, you know, I first published this research back in May and, you know, not too much happened. But finally, I did get an email from one of the guys who worked at the, from one of the founders of the startup that invented this modulation that was bought by Laura. So the guy that invented Laura shot me a note and said he thought it was awesome. I haven't gotten any CNDs or anything legal, but I did get a digital high-five from the guy that made the PHY. No, it's being applied in the inverse order. So, yeah. That's a good question. I actually haven't looked at that because I only have one radio. Yeah, I did do some look at some basic jamming. Laura's really good in contested channels, so even just using a usurp on max power, I wasn't really able to, you know, jam it with wideband noise or anything. I really wonder what would happen if you were to stack a whole bunch of Laura carriers on top of each other, if that would just totally throw a receiver out. Yeah, exactly. Just imagine just drawing diagonals all over the 900 MHz spectrum. The other question was, was there any particular reason you used you didn't do, like, quasi-demodulation? Would that work for MFSK? Basically, the whole point of de-chirping is that it converts those signals from the chirps to those nice linear pulses, so we can basically treat the whole thing like multiple frequency shift keying. No, I hadn't thought of that. Where can you get Laura hardware? So, hardware's out there. You can get dev modules on DigiKey. They're not too expensive. Of course, you know, ICs are available in volume, but honestly, like, there are more and more signals in the wild. I mentioned, I had that slide about my road trip to Portsmouth. I had to go to the source to find it there. I see Laura everywhere now. I actually haven't checked here in Vegas, but you know, all over Boston, all over San Francisco, it's popping up, so it's out there. Mainly being used for, like, industrial type stuff, like monitoring applications, or just, like, tourist stuff? So, it's kind of all over the board. You know, I mentioned the heating oil company, Senet, that is monitoring gas tanks in New England. I think there are people doing vehicle fleet monitoring, you know, just reporting GPS and things like that. One really interesting case that I heard about, I met this guy at a conference who he was making 802-15-4 connected rat traps. These are things, I know, right? IOT, woo! You put these things in your crawl space or whatever, and it used a thermal sensor to detect when a rat had been caught and actually killed, right? It looked for, like, the temperature going down to room temperature. This is a real thing. I'm not making this up. But yeah, so he had made that on 802-15-4 in Zigbee, and he was psyched about Laura and couldn't wait to make Laura-connected euthanization for rats. Anyone else? Okay, I'll be around. Come find me if you want to talk about this. Thanks again. Okay, thanks, Matt.