Well, hello, everybody. Good afternoon. I know it's lunchtime, so I really appreciate you all being here. If you made your way to this room, that means you want to hear about how to hack Bluetooth low-energy devices. So hopefully I get to answer some of those questions today. My name is Jose Gutierrez. Oh, shit. This is funny. The title of my presentation is actually, How Do I Have BLE Hacking But Really, Truly Underground? It's called How to Make Nick Cage Rich Again, and I'll tell you why in a second. My name is Jose Gutierrez. I'm a researcher. My background is electrical and computer engineering, and I like to consider myself a perpetual dabbler. I dabble all over the place. Most recently, I did that. Most recently, home automation and definitely Bluetooth low-energy security. Our research director is Ben Ramsey. Unfortunately, he couldn't be here today. He's recovering from surgery out east. But some of his most recent work is all sorts of Z-Wave. Z-Wave stuff, which I know a lot of guys here have worked with, and he's talked at DerbyCon, ShmooCon, and he has most recently a POC or GTFO article, which is really cool about reading EEPROM and extracting some private keys out of it. So it's pretty awesome. All right. Cool. So some housekeeping slash expectation management. What I will be presenting today is a basic, basic overview of how Bluetooth low-energy works. I'll be talking about some of the most basic. Bluetooth low-energy tools and how to use them and when to use them. Most importantly, I won't be presenting an in-depth, you know, down-in-the-weeds Bluetooth low-energy talk. I don't have enough time. So go read the specs and you'll get all that information. And I'm not going to present every single tool out there. So there's plenty of approaches to do some of the stuff that we're talking about today. But I'm just going to present what we have done, what we've used. Some nomenclature. Whenever I say tablet, think mobile. So smartphones, tablets, tablets, tablets, whatever is whenever I say Cali, think Linux machine with a bluesy Bluetooth stack. OK, so most of most of the time you'll be able to do all of these things with those two types of devices. OK, so let's get started. Let's go into a little bit of a story here. We know that Bluetooth low-energy is a forefront technology in smart devices slash IoT because it's super easy to use. It's super low energy. Um. And we knew that it was pretty available, but we didn't actually know how much it was being used. People use this on everything. OK, we're talking like, we're talking smartwatches, outlets, pressure cookers out there. You can buy you can buy a a a bid and sorry, what's that called? Pacifier. Oh, my God. You can buy a pacifier that basically reports on a baby's temperature. I'm using Bluetooth energy. There's all sorts of shit out there. You can buy all right. Um, some of them has some has some has implications, security implications. So there's Bluetooth locks on. Actually, one of my co-workers, Anthony Rose, is going to give a talk later today and tomorrow about how to hack Bluetooth low-energy locks. So if you're interested, go check that out. Um, there's also industrial sensors. So this is a pressure sensor. You can go buy online. We decided to focus on a data logger, temperature and humidity data logger, specifically the onset MX 1101. Why did we focus on that? Well, the manufacturer actually is really proud to include some testimonials. Um, this is one of them. So this lady's claiming that she uses this to monitor the temperature and humidity of the Magna Carta, one of the four copies of the Magna Carta in England. Um, and there's no way that's actually happening, right? Well, I don't know. I haven't been to England recently. Uh, and I couldn't get them to pay for a trip, but we do know that this picture exists. And this is like a, you know. Uh, a marketing picture, if you will, but it's her holding an app that's controlling the temperature sensor that's inside the case of the Magna Carta. So there are some potential implications. So let's talk about, uh, this. Yeah, that's how you make them rich again, right? Uh, let's talk about this sensor a little bit more closely. Um, specifically it's a, it's a data logger. So essentially you put this thing out there, um, and it just tracks temperature. Humidity and just logs it. And you can walk by with a companion app to actually pull off that information. Um, there's a password that you can set up on the sensor so that not anybody can walk by and pull off your data. Um, and you can also do firmware updates over the air that the manufacturer has enabled on this device, which are both very interesting things that we'll talk about in a little bit. Okay. So before we move on, I want to draw a clear line in the sand between Bluetooth classic and Bluetooth low energy. Okay. Um, when you hear Bluetooth, it kind of covers all these. Things. So I want to make sure that we're, we're talking about the same thing here. Um, classic is a high over head, fast data rate, something that you might use to listen to music, uh, to make phone calls, right? So your car is using Bluetooth classic type of communications. Uh, Bluetooth low energy is a completely different protocol, um, that is designed specifically for low energy transmissions, specifically state full type of transmission. So whether a door is open or closed, whether a light is on or off or acting a command to turn a light on or off. So. So it's very quick, very short bursts of transmissions, and that's what Bluetooth low energy is primarily, uh, used for. And that's where that's the type of, uh, communications that we're gonna be talking about today. Okay. So our basic hacking process, if you will, kind of follows the traditional hackers methodology that you can just go Google. Um, basically you have to find a target first, then you enumerate its services and characteristics. We'll talk about what those mean. Um, and then we'll, you, you kind of have to reverse the application protocol and try to figure out what the application is trying to do. Um, specifically. Like the app on your phone. What's it trying to do when it communicates to the device? Okay. And if you complete these three steps, then you can, of course, uh, do whatever you want, attack, profit, whatever. Okay, cool. So step one, select the target. Uh, as of yesterday, there wasn't really a, a clear way to do this. Thanks to, uh, zero and his team. They, they put out a tool called blue Hydra, which helps you find Bluetooth low energy devices out in the wild. So, uh, there you go. Uh, so go down. Download that and use it. If you don't have that, here's some of the other ways that you can do it. Basically every Bluetooth learning low energy device, um, advertises some sort of, some sort of, uh, uh, information specifically advertises connectability. Am I connectable? Um, it advertises, uh, optionally available services that it's providing or, um, some manufacturer specific data. Okay. So if you can listen to those advertisements, you can generally see that there's a device out there. Your other option is to do a scan request. So a scan request is just. A broadcast asking for what devices are out and they all respond with, with scan responses and then there you go. You have what, what devices are out there. Okay. To do it, uh, on a tablet, you can use an app called light blue or NRF connect. If you just download it right now, you can, you can find what Bluetooth learning devices are, are around here. Um, if you're on Cali, you can use, uh, HCI tool. So anybody heard of HCI tool ever used it? Yeah. Right. So it's, it's, it comes available with a, with a bluesy. Bluetooth. Learning stack. So you just use it, run an Ellie scan and you can see all the, the Bluetooth learning devices in the area. If you just want to listen to those advertisements without sending scan requests, you can use these, uh, passive option. Now, every time I, anytime I do anything, Bluetooth or energy on my Cali box, I have BT mon running on a different window. And BT mon essentially is wire shark for, uh, Bluetooth. So anything that your computer sends down to the Bluetooth dongle and anything that comes back from the dongle back to your machine, uh, gets displayed on. By BT mon actually. And I think blue Hydra actually uses BT mon and parses BT mon to provide you information about what devices are, are in the area. So cool. Awesome. Okay. If all else fails, you can always use a sniffer. So we're going to talk three, three different types of sniffer or three sniffers that are out there. Uh, number one, Uber tooth one. It's probably the most popular one. It's one of the most, um, it's one of the first dongles I could actually sniff Bluetooth classic communications, uh, for the cheap. So, uh, it's really, um, well known and widely available. So you can find that for a hundred, about a hundred bucks. Um, if you don't have a hundred bucks and you only want to slip snip, Bluetooth, low energy, low energy devices, you can use something like the, uh, CC 2540 eval kit, which actually comes preloaded with a sniffer. And then you just download TI software that to run on your machine that displays all the sniff packets, or you can use the Bluetooth or I'm sorry, the blue fruit Ellie sniffer, which is about 30 bucks. Um, again, or these types of sniffers are actually, those two are. They're actually meant for, uh, debugging purposes, right? So if you're building a Bluetooth low energy application and you want to know what kind of communications are occurring between your devices and, and, uh, like your app and your device or something, these sniffers will help you debug that communication. We're just taking advantage of it. Cause hell we, that's the information that we're looking for. So, um, you can use those now you might come across packets that are actually encrypted, and this is kind of what an encrypted packet looks like in Wireshark. So most notably, you'll see the start encryption request. At the top, that, that's kind of a giveaway that the packets are, or the communication was encrypted at, uh, the link layer. Um, if you see a lot of L2 cap fragments like that, it's also probably means that it's encrypted. So you're not shit out of luck. If, uh, if there's encryption, Mike Ryan gave us a tool called a tool called crackle, which takes advantage of a vulnerability that he found, um, with the pairing process. If you're using either six digit pin pairing or just works pairing. Um, so if you use his tool, you can, and you can capture the sniffing process. Okay. Which only happens once at the very beginning, whenever you first get the device, um, you capture us that, that sniff pairing, you, you feed the encrypted traffic to the tool and outcomes out unencrypted traffic. So we've run a lot of this, we've tested this tool and it works really great. If you're using those two types of, uh, either one of those two types of pairing modes. Now, uh, the Bluetooth gods, if you will put out another type of pairing, um, which actually was recommended by Mike Ryan, which mitigates this, this attack. But what we found is that actually most devices don't even use link layer encryption, um, because you have to pair. So that's harder for the user to do. So they just avoid it altogether and they either don't encrypt their communication or the encrypt at a higher level application level or something like that. Okay. So, uh, we actually prefer not to use any snippers at all. If we, if we can avoid it because sniffer still do drop a lot of packets. So what we prefer to do is just if there's an Android app available for this. The specific thing that we're trying to interact with, we'll download the Android app, we'll enable, uh, developer options, enable that Bluetooth HCI snoop log option, and then it just does the same thing that BT Mon does, except for in your Android tablet. So you just pull that file off and you can read it in water shark, super easy. So step one was finding devices. Step two, enumerate. We're trying to figure out what service and services and characteristics are running on our target. If you, um, want to do it actively. You can. Use your tablet to connect. So as soon as, as soon as you connect with NRF connect or light blue, it's just going to tell you what services are available on the device and what characteristics are on there. Um, if you're on Cali, you can use a tool called gap tool, which is also included with the bluesy stack. Um, you can use commands, primary and characteristics to get all of that information. If you want to do it passively, you can always sniff it. So at the very beginning of a, of a Bluetooth connection, you'll see some of these service discovery messages, which essentially is a device talking to each other. They're saying, Hey, I have the, I'm, I'm providing these types of services and here's my characteristic handles and all that stuff. So at this point, you're probably wondering, uh, what the hell is a service and what the hell is a characteristic? And why don't you tell me? I will. So I want to do it through an example. So let's, let's pretend that we're working out. Um, I have a phone and a heart rate monitor, and essentially my phone is asking my heart rate monitor through Bluetooth low energy. Um, Hey, what's this guy's heart rate. Okay. So this is a type of communication that we might see during a. Workout. Now what's actually happening is the heart rate monitor is a Bluetooth low energy server in this case, serving three different services, two that are required by Bluetooth low energy that I'm not going to go into today. Um, and one that's application specific and actually those, any, any other ones that you see besides those two are going to be application specific. So what's really happening is my phone is contacting the heart rate service inside the Bluetooth low energy server and asking for my heart rate. Pull back one layer. Really what's happening is my phone is contacting the, the heart rate measurement characteristic inside of the, inside of the heart rate service asking for my heart rate. You can actually pull one, one more layer back. Um, the BLE client is actually sending a read request to the value attribute inside the heart rate measurement characteristic inside the heart rate service inside the Bluetooth low energy server. But I've pulled the wool over your eyes because really the Bluetooth low energy server is just a list. Of attributes. Okay. The whole thing is just one giant database of attributes. Now the GATS, um, profile is what assigns, um, meaning to those attributes. Okay. So it says this is a service or this is a characteristic. So really, uh, at the end of the day, all, all Bluetooth low energy communications are reads and writes to these attributes. That's it. That's all it is. So if you can break the communication down to those, to that level, you know, what's going on between the app and the device. Okay. So here's how it works. Here's how it looks for the MX 1101 data logger that we talked about earlier. Okay. This is literally all of the attributes on that device. The first 11 attributes define those two services that I talked about that we're not going to talk about for the rest of the talk. The next 11 attributes define the device ID service, which includes stuff like manufacturer name and model number string. This specific service is actually defined by the Bluetooth SIG, the Bluetooth gods, if you will. So these guys. Took their specs. And just applied it here and, and created that service on the device. And then the last 11 are actually the application specific stuff that onset the, the manufacturer developed and put on the server. Okay. And this, the most interesting thing about, about these attributes is the command and control attribute. Okay. So as, as we'll talk about in a sec, um, they use this one single handle to control it and to pull data off of it. And we'll talk about, um, all that in a little bit. Okay. So once you've, you've, you've, uh, found. Find your, found your device and you've enumerated all the services and characteristics and found that attribute table. Then you have to understand, like I said, what the application is actually doing, how it's communicating with those handles to figure out what kind of data it's pulling, how it's pulling that data. Okay. So the strategies for this are endless. I mean, it's just a reversing project. Um, one of our favorite things to do is once you figure out what the, what the handles are and how they relate to services and characteristics, you just impersonate the device. So we pretend it after we found. Found that got that database, we implemented our own device with that same database, and then we use the app to communicate with our device. And because of that, we were, we were able to extract a lot of functionality that the app, um, had that the device maybe didn't have. So just an interesting thing to do here. Um, so let's talk about the MX 1101, our target and Nick's favorite item here. Uh, the password that I talked about that protects your device. It's sent from the app to the device in clear text. To that command control handle, literally just sit here with an Uber tooth and you will know my password, which is ridiculous because that command control handle, um, does everything from configuring the device, setting alarms, pulling data off, whatever. And you can do all of it. If you've authenticated with the device using the password that, oh, you just sniffed. Okay. Now, the most interesting thing for me is the fact that they allow, uh, that, okay. Uh, this is an example of you would send a command to that, to that handle. And. Everything that comes back is data. Okay. That's kind of what that looks like. Now, the most interesting thing to me is that you can send a specific command that's just unhandled right after you've authenticated, you spend the specific command and it just stops logging. It just breaks down, which is a problem because in order to get it to start logging again, you have to reconnect with your app and you have to reconfigure the device and then restart it. And then I'll just do it again. And then you're offline. Cool. Um, but even more interesting than that, you can perform over the air updates. So I thought, well, okay. Well, can I perform over the air update with my own firmware? Um, and this is just as a proof of concept. Remember I said they had a device information service running in that device. Um, I just changed where the Mac manufacturer name, string and model number string were, and then I uploaded my own firmware and I changed it. Right. So proof of concept, you can change, you can add your own firmware to this thing. And actually, um, if you, if you guys pull out the app right now, you'll see that the device, which is, I meant to pull it out. Yeah. Yeah. Uh, yeah, right. I'm not Nick cage. All right. Um, if you guys find this device right now, um, it's actually a heart rate monitor or it's pretending to be a heart rate monitor. So I, yeah, I literally rewrote the whole firmware for this thing and just added my own, whatever the hell I wanted to do. So, so not good, but this is the type of stuff that you'll find out there once you start looking into Bluetooth low energy devices. So once you've figured out the application, do something with it. Okay. So if you want to write, write stuff on your Cali machine, you can use scapy and scapy has a lot of nice libraries that you can just use to send, send, write commands and read commands and pull data off. Again, all you're doing is interacting with these handles. So as long as you can code that up, you're good to go. Um, if you're on a tablet, you can actually just like pull it up, tap handle 19, tap, write this set of hex characters, go. That's it. Now, you know, most of these communications will take like 20 or 30 back and forth. You know, handle writings and reads. So you probably want to implement a lot of it on, on your, on your Cali box. If you can, um, proof of concept, we built a password sniffer and a brute forcer, a password brute forcer. We built a data dumper. So you can just pull the data off of that device arbitrarily. Uh, we built that device impersonator that I was talking about earlier. So that's, um, and a firmware uploader and all those tools are available on our GitHub as proof of concept tools. Um, now you probably don't have an MX 1101 to play with. But, uh, what you can, if you look through that code, you'll see how we're actually writing to handles and reading from handles and then, you know, go forth and conquer. Um, so some more resources for you. If you're interested at all in Bluetooth low energy hacking, read the developer's handbook by Robin Hayden. He's one of the original developers for the Bluetooth low energy protocol and he wrote this book and it's awesome. So read through it and a lot of this will make more sense. Um, Mike Ryan, the guy who made Crackle, he's done a lot of Bluetooth low energy research. So you can go find it. His sites, um, some people to thank, a lot of, some of them in the audience, Ben Ramsey, Anthony Rose, Caleb Mays, Mike Ryan, and directly the folks at Wireless Village for letting me come here and talk. Um, and of course the lady at home. Now, does anybody have any questions for me at this time? Ma'am. So Bluetooth low energy specs, I thought it defined a security layer that was different from classic Bluetooth and that it came more towards the Wi-Fi security. But it's not mandatory for implementation, so is this the product only that don't implement Bluetooth low energy, uh, security or is it, am I missing something? Maybe, maybe not, maybe I'm not familiar with it, but the only, the only security protocol, I guess, that I would know about is, is the link layer encryption, which is all handled by a security manager service, basically. Um, and I, yeah, so I'm not really familiar with, with what you mean, but maybe we can talk offline about it. Anybody else? All right, hopefully this was helpful, I'll be around, um, come ask me questions, grab me a beer if you want, it'd be cool. Appreciate it, thank you very much.