Okay, this is Bluetooth Smells Like Chicken, and I am Dominic Spill, and that's me. I am affiliated with Imperial College London, although they do not know that I'm here. And so that's the email address in case you want to email me and ask me questions later, and you don't get a chance at the end of the talk. How's it going? I haven't actually tested this yet. Yeah, I'm Mark. I'm currently unemployed, so no affiliation, thankfully. And I have just finished my Master's in Computer Science, and that was on Bluetooth. And that's how I met Dominic and the others. And I'm Mike. I do wireless communication security research for the United States Department of Commerce at the Boulder Labs in Colorado. And I'm required to tell you that the United States government has no official position on any of this. And in general, what we're describing today is some stuff that has worked for us and is not necessarily the best solution for any particular problem. But we think it's cool stuff, and we hope you will, too. And I guess I'm going to get up to do this. Take your breath. So sniffing Bluetooth is hard, and that's why it's an intriguing problem for us. It is something we're trying to make easier. Bluetooth, as you guys all know, is a personal area networking technology that operates in the 2.4 gigahertz band, and it is a frequency-hopping spread-spectrum system. And it is this frequency-hopping that is the principal reason that sniffing is hard. There are a lot of different spread-spectrum techniques, like 802.11, for example, uses spread-spectrum. But the particular type that Bluetooth uses is frequency-hopping, where it just operates on one relatively narrow band at a time and then jumps around to all these different bands. It jumps around through 79 channels. Each channel is 1 megahertz wide. And for reference... So basically... We have this 79-megahertz band that's carved up into 1 megahertz chunk. And 802.11b and 802.11g operate in 20 megahertz bands. So they sort of spread out their entire... A single packet spreads out across 20 megahertz and uses all of that at once. But what Bluetooth does is it just uses 1 megahertz at once, but it jumps around across about four times as much bandwidth as 802.11 does. So a radio that can receive 802.11 traffic only has to be able to process and receive 20 megahertz of bandwidth. A radio that receives Bluetooth has to either hop around or it has to receive all 79 channels, which is a lot of bandwidth and difficult to deal with. The frequency-hopping happens 1,600 times per second in most situations. And basically... Every 625 microseconds, a new packet slot occurs. And that packet, that entire packet, goes all on one packet. Sorry, on one channel. And then the next time there's a packet, which may be as soon as 625 microseconds later, it selects a new channel. Now, there's a clock that's just a free-running counter. It's just a counter in every Bluetooth device. It's just a counter that increments 3,200 times per second. And the hops happen on every other clock cycle. The master device in a Bluetooth PicoNet provides the clock for the entire PicoNet. So when you have, say, a Bluetooth headset connected to a Bluetooth cell phone, generally the cell phone would be the master and the headset would be the slave. And once they've synchronized and they're connected, they are a PicoNet. And at that point, they're both using the same hopping sequence because they're both synchronized to the master's clock. They're also synchronized to the master's address. The BDADDR is the Bluetooth device address. And it's a MAC address. Every Bluetooth device has one of these assigned. And it's carved up into multiple sections. The NAP is... It's called the non-significant address part, which is a little weird because it's the most significant bits. But it's non-significant in other ways. In fact, most of the work that we've been doing, we've been kind of ignoring the NAP until very recently because you can do pretty much all the stuff that we're doing just with knowledge of the LAP and the UAP. The hopping sequence is derived from the master's LAP and UAP, but not the NAP. The NAP is non-significant for the purposes of a lot of stuff. The UAP is the upper address part, and the LAP is the lower address part. So that's just the different portions of the MAC address. And the LAP is transmitted... I don't need to go into this. No, I can cover this. Yeah, you'll cover that. All right, so you want to sniff Bluetooth traffic, and with 82.11, you just throw your card, whichever card you've got, into monitor mode or promiscuous mode, and anything on that channel, you grab. But as Mike said, you can't do that with Bluetooth because it's frequency hopping, and you need to know which channel you need to be on. So the options are hop around and somehow work out how you hop or capture everything with really wideband hardware that's expensive. We picked the second option because expensive hardware is cool. There are basically three devices that you can use. There's a protocol analyzer that's about $10,000. It's made by a company who I won't mention right now. But that is great for debugging Bluetooth devices. If you're building a Bluetooth device and it's not working as you think, then their product is fantastic for what it does. But it's not going to sniff arbitrary traffic from anyone in the area or anything like that. It's designed for a very specific set of conditions. Then there's Bluetooth dongles. I assume most people in this room have a Bluetooth device of some sort. Otherwise, what the hell are you doing here? They're about $10. You've all seen them. We've got a Holo plugged in here. They're USB. They're that big. They're all over the place. And it would be really great to be able to use them. But they're designed to implement Bluetooth. They're not designed to be really wideband. They're designed to actually do this hopping that we're talking about. So you have to get in them and do a whole lot of stuff, which Mark will talk about later. And then there's the USRP, which is this box at the front. Do you want to just hold it up? I don't know if anyone's seen one before. It's a software-defined radio, and it's about $1,000. So you want to use the protocol analyzer for sniffing traffic. You can either buy it, or you can steal it. But neither of those are particularly great for being legal or cheap, which is my preferred method. I've already discussed what else it does. The Bluetooth devices, they're designed to go on one channel. They have this custom firmware. It's a custom CPU in there. You really don't want to get into it. You can vouch for that. Software radio. USRP gives us 8 megahertz of bandwidth. Now, that's obviously significantly less than the 80, but it's a start. So we might be able to do something with this. And the USRP2, which came out midway through this work, gives us significantly more, and we've incorporated that into what we do. But we have to do all our signal processing in software. So we don't have a device that we can just tune to a channel and listen. We have to do some serious post-processing on that. And that's where this project comes in. So I want to sniff a single channel. Let's see if we can get some data as devices hop past. All right. This is a Bluetooth packet in an oscilloscope. It took me months, six months to find that. I spent what I thought was about a month sniffing my own CPU clock, which was 2.4 gigahertz. And just an example of how bad at signal processing I really am. I discovered that it wasn't my CPU clock, only, what, three hours ago? And we discovered I was actually sniffing the internal clock of the device I was using to sniff. Yeah, that is epic fail. But we can get the packet. And so then we have to look at how the packets are formed. And this is all given to us in the Bluetooth spec, which you can go and download from the special interest group. And it's divided into three parts. There's an access code at the beginning which lets you know. It's kind of like the packet. Header, header. It lets you know there's a packet coming, and it tells you which channel it's on and which device it's come from or going to. Then there's a header which contains all the standard stuff you'd expect in a packet header. And then there's a payload which carries your data. The access code is derived from a 6430 BCH code from the LAP, which basically means it's an error check on the LAP. And just for good measure, they stuff the LAP in there as well. So you don't really have to perform the error check unless you are worried about noise. So we can capture a single packet and grab the lower address part. As you saw before, that's half your MAC address. So devices in non-discoverable mode don't respond to inquiries. But all you need is this MAC address to talk to them. So we've got half of it with one single packet. And as you can probably expect, all your devices are transmitting stuff all the time. They are not quiet devices. They don't go to sleep properly. So the next thing we want. Let's keep working up the MAC address. We have the UAP. The UAP is a single byte. It's the third or fourth byte, depending on which direction you're going. It's not as simple. It's not given to us in the packet. We don't just read it out. But it is used to initialize the checksums in the packet. And there are two checksums in some packets and only one in others. But there's a checksum on a header and there's a check on the payload. And the UAP happens to be used to initialize both of these checksums. So we might be able to do something to retrieve it from these checksums. There's an added complication. And this is that the Bluetooth packets are what they call whitened. And this means that they're XORed with a pseudo-random stream of data to prevent DC offset of the transmitter. Which is not a term I strictly understand. But it's something we've got to overcome. You don't have to understand it to break it. So that pseudo-random sequence is seeded by the current clock value at the time of transmitting the packet. The bad news is I'm going to interrupt the talk. The good news is I'm going to keep it short. There has been an almost epidemic outbreak of the stupids over the last 24 hours. You need to police yourselves. You are not 13 anymore. You are supposed to be adults. And you are supposed to be in the top 10% in terms of IQ in the United States. In the last 24 hours, I've been flashing back to DEFCON 9. Stop it. We like it here. We want to stay here. If you do not want to stay here, don't come and fuck it up for the rest of us. That's all I got to say. Okay. Okay. Where was I? Sorry. Whitening. I think you were fucking it up for the rest of us. Oh yeah, I was. Right. Oh yeah, whitening. Okay, so we take the six bits of the clock, or six of the bits of the clock. clock. It's a 27-bit clock, loops every 24 hours. So we take the lowest 6 bits and we un-mighten. Now, as you may expect, we don't know the MAC address of the device. It's a fair chance we don't know what its internal CPU clock value is. So what we do is we just brute force it. It's only 64 combinations. It's going to be fairly straightforward. And then there's some forward error correction, but that actually helps us eliminate the noise. So that's great for us. So we do the whole thing in reverse. We take those 64 candidate clock values. We un-mighten the packet. And then we reverse the checksum process. And we just run the algorithm in reverse. And that gets us out 64 candidate UAPs. And it turns out, for some bizarre reason, it gets us 16? 16 candidate UAPs. The same 16 candidates are going to be getting 16 candidate UAPs four times. And for every packet with that UAP, it will get us the same set of 16 candidate UAPs, which is slightly annoying, but not fatal. So then we go on and we go through the payload. And we reverse the payload checksum. And the great thing about that is that it's actually a 2-byte checksum. So we have a byte of 0 and a byte of the UAP. So we can be fairly sure when that's un-mightened. And there's a 1 in a really big number chance that we'll get a collision. And it's a 1 in a really big number chance, but it happens. I've seen it happen. Hopefully it won't happen during the demo, he says, jinxing it. So hopefully out of that we get a single UAP. And I think we're going to give that a try. So do you want to run the demo and I'll talk about it? Sure. Okay. I'll just talk you through what Mike's doing. I can see it. Do a UAP CRC keyboard. Okay. So we're going to run the demo and I'll talk about it. We're basically looking for the UAP by checking the CRC on both the header and the payload. And we're doing it. Turn around. This is what happens when you try live demos. Sorry. Okay. Wow. Okay. That was actually the demo of the next fantastic thing we were able to do. But let's start off here. If we scroll back up. Do you want to just highlight it with the mouse? Where it found the Okay. So just highlight this. So we went through six packets. And does that make it more readable for everybody? Okay. Excellent. We went through six packets. And on the first packet, we managed to drop from 64 to 54 candidates. So that's a lot of UAPs and candidate clock values. And then we kept reducing that for five more packets. And at one point, we got a CRC confirmation. And so we found out that given that we already know the LAP of our mobile phone, the UAP of the mobile phone is 0xAF. Own it at will. And in this particular case, we weren't lucky enough to get a packet that had a CRC, a payload CRC. Not all packets have them. Only certain packet types. And so the method that he was talking about on the slide was saying, well, you know, we try a value. We try a clock value. We try a UAP. And we see if it works. And we see if we get a CRC hit. And if we do, great. Now we have a pretty definitive answer. But in this case, we never got a CRC. We never got a payload that actually had a CRC. And so we were still able to determine the UAP not through CRC checks, which would have done it in one packet that had a CRC. In this case, we did it with six packets that don't have CRCs. But we were able to measure the relative timing between the packets. And so we could narrow down the clock values because, you know, if the clock value of one is such and such, then X microseconds later, the clock value is going to be such and such. Right? Right. So we had the ability to take multiple packets and run these checks and narrow it down within a handful of packets rather than just one that we, if we were lucky enough to get a CRC. Right. So the correlation between a candidate UAP and the clock value for the whitening actually gives us the extra information to be able to do that. So the whitening actually helps us to break it. Which one, Steve? You want to do another one? No, I was going to do it. There. Okay. So now we have an LAP and a UAP. What can we do? Well, we can sniff packets. That's all we need to grab the packets, verify that the checksums are correct because we used them to find the UAP in the first place, so we can use the UAP to find the checksums. And we can get six bits of the clock, which is part of the way there, but there's still another 21 bits to go. And that's quite a lot to brute force. But as you probably saw from the demo already, we were able to get that. So do you want to just flick that? Do you want to do the... Yeah. The... Yeah. Yeah. So if we scroll down in this, what you'll notice is that we were able to retrieve the clock value by doing exactly the same thing, finding packets, measuring the time gaps between them, and just finding a place that fits into the pseudo-random hopping sequence. Okay. But I was wondering if you wanted to do... Yeah, go for it. Yeah. Yeah. Why don't you talk about it? Okay. We're going to trade up here and let Dominic see if he can have more success at the demos than I am... than I had. We want to show you something that we just learned about the other day. The... One of the things you can do when you know a MAC address is actually connect to a device and do something like an L2 ping, which is what Dominic's about to do here. He's got a couple of different dongles plugged into this laptop, and he's using one of them to ping the other one. So he's doing an over-the-air L2 ping. It's just a real easy way to verify connectivity between the two Bluetooth devices. And if you know a MAC address, you can do this. But Josh Wright noticed recently... That you can do this even if you have the wrong non-significant address part. Check this out. Okay. So now we're pinging an incorrect MAC address. You can put garbage in those first two octets of the MAC address there. And it doesn't matter because at this layer, at this part of the protocol, the NAP is non-significant. It's completely ignored. Okay. So this is kind of interesting because it means that all the work that we've done to figure out what the UAP is, it kind of doesn't matter anymore because you can just brute force it. Once you know the LAP, there are only 256 UAPs that you have to try, right? Because it doesn't matter what you type in as the NAP. And this is the kind of stuff you can learn if you take Josh Wright out for sushi. But we still like our techniques because our techniques are a way to accomplish the same thing completely passively and relatively quickly, like in a few packets that happen in, say, a few milliseconds, versus a brute force that, at least using the command line tools, a brute force that I ran took like 90 minutes. It should be possible to speed that way up. But it's slower, and it's an active attack. And, of course, it's nice sometimes to be able to do passive stuff. It's you again. It's me again. I'm up. Yeah. You're up. Okay. So we would like, so far everything we've been showing you is just using a single channel. We have the USRP up here tuned to one particular channel of the 17. And that allows us to get some packets, which is great. It gives us kind of a survey of the traffic that's in the area. And that's very helpful. It lets us discover the LAPs there. It lets us discover the UAPs. But it sure would be nice if we could actually get more traffic and preferably all the traffic that's out there on a particular PicoNet, for example. So the most straightforward way to do that, to extend to several channels, is just to run our tool many times. If we take the input from the USRP, Dominic mentioned that we get 8 megahertz of bandwidth. We can take that same 8 megahertz of input and de-multiplex it by just running it through our code eight times with different down conversion frequency. And that allows us to, in software, tune to those eight different channels. And we can run it. Eight separate decoding threads. And away we go. That technique does work. It lets us get 8 channels at a time with the USRP. It also lets us get 25 channels at a time with the USRP, too. That's a pretty good chunk of channels. Can we get all 79? Well, we could if you happen to have a pile of these things. If you have 4 USRP2s, or 10 USRPs, you could theoretically do this. But realize you're dealing with an incredible amount of very high bit rate of data that's coming from the device, the USRP or the USRP2, to your host computers. And you are going to need multiple hosts to be able to do this. Roughly speaking, we get a little better than this. But roughly speaking, we can decode one channel per CPU core. So in this laptop here that has two CPU cores, I can do this and I can decode two channels in real time simultaneously. But if I go more than two channels, if I try to do eight, for example, I start not keeping up with the traffic. And so I can't do it in real time. I can post process. I can save the raw waveform to file. And then slowly post process later and decode all eight channels. But if you want to do it in real time, you need to have in the neighborhood of 79 CPU cores. And you need a lot of throughput for your USB buses, gigabit Ethernet buses, in the case of the USRP2 and so forth. Your favorite slide. Oh, I love this slide. So we gave a presentation on this at SmooCon. And a question at the end was, hey, there's an FPGA on board. Why don't you use the FPGA to demodulate channels? And I said, that's a great idea. I'll do that. Thank you. Tony is clapping because he knows the progress of my work. This slide is the entire progress of my work. There's a... On the USRP2, there is a huge FPGA. There's loads of stuff that can be done. And there are some guys on Thursday giving a whole workshop on FPGA design. And if they want to get their hands on the USRP2 and do it, that would be fantastic. But FPGA design is not something I appear to be good at. In fact, I appear to be less than good at it. And there's also debate as to whether we can... Before we get to the FPGA, before you demodulate, you have to filter. And there's some debate as to whether we can get the filtering and demodulation to all take place for all 79 channels in the single FPGA. And if we can't do that, then it's sort of pointless to do it because we have some techniques that are slightly more intelligent now. So it is something we've thought about and we're working on. Please, at the end, don't ask about FPGA demodulation because I'll just curl up into a ball and cry. Is this me? I don't remember. Okay. Go ahead. So earlier you may have seen that we... I jumped ahead a little bit and I was talking about getting the clock. The clock value is used as input to this frequency hopping. So as we hop frequency, we work out which channel we're going to use next by using the UAP... Yeah, let's get one. By using the UAP, the LAP, and the current clock value. Exactly. And it's not linear. It is all over the place. There are some characteristics to it. It windows and shifts the window. It jumps about inside a small band and then shifts that band. But in general, we have the algorithm. So we thought what we'd do is take the UAP and LAP that we know, generate the entire hopping pattern, which is about 24 hours long, and then time the gaps between packets and work out where in that hopping pattern we are and therefore which clock value we've got by the gaps between the packets. And back at the envelope calculation, I decided this would take five or six packets and in practice it takes a little bit more. And in fact, the entire discussion surrounding this is how I met Mike and how we got on to doing it. Do we want to demo this or are we going to... We'll do it with the alias. Okay. We'll demo it later. So ignore that slide. Okay. So we're going to combine two demos in one here to save time and give Mark a chance to talk. One of the things we'd really like to do is to be able to snip all 79 channels at once. And as we've shown you, we have a hard time doing that. But there's a trick that we use that allows us to do just that. And what we do is intentional aliasing. So those of you who know something about signal processing probably see this slide and say, ah, that's how they do it. And I've in the past sometimes explained in gory detail how this works. But I'm going to skip straight to the function, exactly the mechanics of what we do, instead of just boring you with all the theory. What we do is we have an antenna in the upper left-hand corner of this diagram. We have an antenna plugged into this daughterboard in the USRP2. It's called the RFX 2400. And in that daughterboard, the signal path goes through an ISM band pass filter. This is just a band pass filter that's specially designed for the 24... 2.4 gigahertz ISM band, right? And then it's down converted. To base band. So a signal in the neighborhood of 2.4 gigahertz is now in the neighborhood of 0 hertz. And then it's low pass filtered, which is this triangle, empty triangle, that's an anti-aliasing filter that prevents different frequencies from clobbering each other in the digital domain. And so that happens right before the path goes to the ADC, the Analog to Digital Converter, which converts the analog signal into the digital signal. And then passes digital signal to the FPGA. Now the FPGA has to actually down sample or decimate. It has to throw out a lot of samples because there are too many to spit over the gigabit ethernet bus. The ethernet is not fast enough. So it has to throw out a lot of the samples that the ADC gives it. And at that point it has the opportunity to introduce more aliases. And generally speaking, when you're developing a software radio sort of device, you always have these anti-aliasing filters. Here we have two. One of them is in hardware on the RFX 2400 daughterboard. The other one is actually on the FPGA. So one of them is analog, one of them is digital. But they're both doing anti-aliasing filtering that prevents signals on disparate frequencies from ending up layered on top of each other in the digital domain. And usually you don't want that. You don't want those aliases layered on top of each other. Because it creates more interference when you're trying to decode stuff. But what we do is we remove, we bypass the low-pass anti-aliasing filter on the daughterboard. And we modify the FPGA so that it's not doing its anti-aliasing filtering either. We leave the ISM band filter intact on the daughterboard because that gives us only the aliases that we want. Only the ones that are between 2.4 and 2.483 gigahertz. And that encompasses, quite nicely, our 79 channels. So we leave that intact so that we don't get aliases we don't want. But we do get aliases that we do want. We get 25 megahertz of bandwidth. We get 25 contiguous channels layered on top of the next 25 contiguous channels layered on top of the next 25 contiguous channels. And it allows us to decode packets that are on all these different channels. Now one of the things that, the reason that people usually don't do intentional aliasing is because if you have two packets or two signals on two different channels that are aliases of each other and they happen at the same time, then they clobber each other and you lose the ability to decode it. But we're lucky because in Bluetooth, the target network is only transmitting one packet at a time. Right? So it's only transmitting on one of those aliases and we don't end up with that problem of aliases clobbering each other. So as long as there isn't too much noise and interference, because this technique does amplify the effects of noise and interference, as long as there isn't too much noise and interference, this allows us to sniff all the channels of a single pico net. And if we use the techniques, that we talked about to recover the clock and figure out which channel to expect a packet on at a particular time, then we only have to do the work in our CPU of decoding one channel at a time. Even though we're getting 25 channels of bandwidth, which is multiplied by the aliasing. So really from our CPU's perspective, we only have to decode one at a time and we figure out by aliasing which channel we're going to look at. So let me give you a little demo. I'm going to kind of cheat on this one and do a demo. This is actually a waveform. Instead of doing this live, I'm going to use a waveform that was captured. So this is just the raw data that was coming from the USRP2. At tour camp, actually, one of our fellow campers had a Wiimote. And so we were just sniffing the traffic that it was producing. And so I'm going to run this. And you'll notice that it found the UAP really quickly because there was a CRC. Hey, that was good. And now it's trying to figure out, and it's going through all 25 channels, each of which is aliased to three or four channels in real life. And notice it keeps trying to calculate the hopping sequence and it keeps failing and restarting and failing and restarting. This happens sometimes for a variety of reasons, some of which are my fault, I'm sure. But sooner or later, it's going to acquire the clock. And at that point, it's going to stop being slow. Here it is. It just got the clock. And now it's spitting out packets. And notice that it's telling you what the clock value is and it's telling you what channel a packet occurred on. And it's spitting out packets at a pretty high rate. Actually, the Wiimote in this particular example was not working correctly. It was like, I don't know, he was trying to get them connected to each other, but he wasn't actually getting the accelerometer data streaming very rapidly. So overall, we have kind of sparse packets. But we're getting a lot of packets and they're on the channels we expect them and they're at the times we expect them. And once we're to this phase where we're actually decoding stuff, and that's the end of the sample, when we're actually decoding stuff like this, we're only having to deal with one channel at a time, and so it's fast and we can actually do this in real time. We're not in real time during that initial period where we're discovering the UAP and the clock. But once we have the UAP and the clock, we can catch up and do the rest in real time. Right, so yeah, as I said, I met Dominic as part of my master's project, which was investigating whether there was another way of doing this because as I've mentioned, it's quite a lot of work to sniff Bluetooth. There's the demodulation, there's the aliasing, there's the large amount of processing required. And it seemed that the thing you really want is a Bluetooth device because they already have all the hardware there. There are... So we targeted a large manufacturer of Bluetooth devices. This is the one who also created the protocol analyzer that Dominic mentioned earlier. And the protocol analyzer was actually the one that Max Moser, a couple of years ago, managed to get running on his own personal Bluetooth device just using the firmware. So yeah, basically, it's CSR. They've built quite a nice platform for Bluetooth. It's a soft core for the hardware. And then there's firmware on top of that. And then on top of that, there is a VM. So it's designed to be extensible at every level. And so the Bluetooth sniffer protocol analyzer just updates the firmware and can listen to anything when you have the lap. This is the layers of Bluetooth. We're actually... Ideally, we're looking for the radio. Radio layer, which is what Dominic's done. But the stuff on chip includes the link manager layer, which is... Excuse me. Yeah, basically, all the setting up of communications and links and so on is done on chip. And so there are different layers that are built into the firmware. So the chip itself, every Bluetooth chip, has sort of the complexity of about 286. And it's got a... This one in particular has a 16 megahertz processor as well. The... Yeah, so the firmware... Firmware does the link layer and the Mac layer. And everything else is done in hardware. As mentioned, everybody finds Bluetooth hard. So there's a lot of testing built in. The Bluetooth... Bluetooth SIG had to organize unplug fests for... In order to get... Once they'd done... Released all the spec in order to get everything to work. Because there are parts of the spec that aren't really very well defined. And so there... It makes sense to put in a lot of places for testing. However... There isn't a simple, you know, just read off the... Read off the air... Test mode in any of the test suites. This is probably on purpose because of FCC certification and so on. And... Because... Yeah, they don't want people... Sniffing Bluetooth. So the... The Bluetooth device comes with... Various internal tests as well. Which are not documented. But looking at the... At the firmware, you can work out what's going on. The... My... Dominic and my supervisor had actually built a... An assembler and disassembler. So... It was simply a matter of looking through... Finding the... And... And... You know, finding the tests and working out what they do. One of the tests which is particularly interesting is... One that is basically just called MemCopy. So you can... You can get your own code to run... On these little computers... Just by... Just by... Writing... Overwriting the return address on the stack. And it turns out that there is also an area... Presumably for flashing... Of memory that... Allows... That allows you to run... To put code... In RAM and then execute from that. So... I think I can... Do a little demo of that. If... Yeah, so basically you... Write the code you want into... Into this area of... Of... Of memory. Overflow the stack and you can... Say, call malloc. Or something. On the chip. You can also... Have a poke around at the internal settings. So there's... For instance, that is the page table... Of the device. And... Some of these... Some of these... Pages are... For particular areas. So there's... There's one that's... Specifically for... Testing. One specifically for sending information. One for receiving. There's various areas for... Link management. And so on. And you can actually watch... The information going through. And... So... This is the... This is... I think this is Linux doing a... Some kind of... Every now and then... Ping of some kind. But... Yeah. There's a... There is also a lot of... A lot of code in the firmware. Which helps a lot with working out what's... What's going on. And these are all... Used to implement the... Quite complex... Bluetooth... Virtual computer. But we don't actually want any of that. All we want really is the... Is the baseband and the code. And... Looking at it there are... There is some... It's quite well... Quite well equipped. There's... There's an ADC. It's got a USB controller. And it uses DMA to send information... Over the USB bus. And then there's of course the... The... The page table. Which deals with circular buffers. So... There's... There's everything in there... To write... Without using libraries. To... To receive using the ADC. The problem is... The ADC... Doesn't actually... Isn't very useful. It only gives you one bit. And it takes a microsecond to get that one bit. And the symbol rate of Bluetooth is one... Symbol per... Microsecond. So... You... You'd need 16 of these devices in order to... To... Just get... The normal... Sorry. Eight... Of these devices to get the normal... Bit rate. However in a particular mode... Sorry. In a particular mode... It... It opens up... A memory map register. Which... Conveniently... Some... For some reason... There's... It's never used. But there's... A sample of the demodulated data. And this is just... Happily sitting there... Spewing it out... At this particular address. So what you have to do is... Read all that information into a buffer. Send it back over your... USB. And then... When the ADC says that... There isn't a signal... Just stop. The original... The original... Plan was to send back information... Continually. But... That doesn't work. Because of... The... The DMA controller. Completely ruins the timing. Yeah. So... I'm just gonna... Try... To... As with all demos... It's worth noting... This is Defcon. And therefore... None of them work properly. That's why we just ran... Our... Our aliasing one from file. Because... As... As we said with that one... Noise interferes. And... Well... You're in like... One of the electronically noisiest places. So... If we can't get this running... Straight off... We'll... We'll try and... Um... Which I think is room 106... In a couple of minutes. So what he's doing right now is... Generating some test traffic... Uh... Between a couple of Bluetooth devices. And... Uh... And then he's... Uh... Executing his code on the Bluetooth dongle. And... Uh... Retrieving that... Uh... Baseband... Uh... Demodulated... Uh... And dumping it to a file. As Dominic mentioned... Um... This... This device is not working at the moment. Um... Mm-hmm. It may come up. It has a habit of waiting about 15 seconds. Um... But... Uh... Yeah. Basically... Um... The... The code up... The... That's running on there at the moment... Sends it back directly over USB. And it occasionally confuses Linux. Um... Oh... Oh... They're both working now. Right. Let's just give that another go. Um... So... Uh... This is the sync. Which is receiving everything over USB. We'll make the other device send some information. And... This... Should now start sampling the data. And this information... Uh... This data can... Can plug... Yeah. This... This... Um... This sample stream can go straight into everything that Dominic and... And Mike have done. Yeah. Um... Yeah. Uh... So... Yeah. So we're actually able to use the GNU Radio libraries to do... Uh... Clock recovery. And... Uh... Bit slicing. And then just pass this in as if it came from the USLP. So... The software just... Doesn't... Well... The idea is the software doesn't care what kind of device you sniff the traffic with. Um... Whether it's the $2000 USLP2 or just a whole lot of USB hubs and 79 different Bluetooth dongles. Um... And what's actually on screen now is the raw waveform that was collected from the... Uh... From the dongle. But it is demodulated. Yeah. That's right. It's demodulated. It's... It's been run through the demodulator. But it hasn't been run through the decoder yet. So... Uh... It's... Uh... It's something that we can take and plug into the software that Dominic and I have written. And actually extract packets from. Um... So, yeah. Just... Just... Just here is the beginning of the Bluetooth packet. And then this... All of the rest here. If... If you plug it in, we'll... We'll... Um... We'll give a Bluetooth packet. Um... And the... Uh... Right. So the significant advantage of this is that it only costs $2. Um... Instead of $1000. Um... It doesn't have... Um... The advantage of the USLP of being able to... Sniff all 80 channels at a time. But in order to do that, all you really need is... Uh... 79 dongles. Um... And a lot of USB hubs. If you'd like to pass your dongles and USB hubs to the front... We will... Give it a try. Um... And then... Of course, the fact that Bluetooth is only transmitting on one channel at a time helps. Um... Because... Again... The... The... 80... Um... Devices sending back information... Of USB wouldn't work. Um... But... Actually... Sniffing on one channel seems to work well enough. Um... The randomness means that it... If you... If you listen on one particular frequency... You... Um... Uh... You get... Uh... You get a... A... Even proportion of... Um... Of packets. Um... Keep going. Yeah. I'll do this bit. Yeah. Yeah. Really, really quickly. Because I've got about 30 seconds left. Uh... The security implications are... Non-discoverable mode doesn't exist. They're lying. Uh... Feel free to... Argue with me on this one. But... By all means... If you've got your... Uh... Bluetooth devices in non-discoverable mode... Just turn Bluetooth off. It's using up the battery anyway. Um... It's not worth it. It does open the door for active attacks. Which we haven't done yet. But that's the plan. At least at some point. Um... And... We have made some... Interesting observations regarding encryption. Which we will... Uh... Have to detail... Next year at DEVCOM. So... Uh... We'll be in the... Breakout room 106. Yeah. We'll try and get that demo working... Uh... All those demos working properly. And... We'll take questions and answers in there. Um... But that's the... Address of the code if you want it.