00:00:00.000-->00:00:12.379 >>So uh please give a warm welcome to Virtual Labs. [applause] >>Thank you all very 00:00:12.379-->00:00:18.085 much. So uh today I’m going to talk again about the Bluetooth Low Energy protocol on the- but 00:00:18.085-->00:00:25.559 also new vulnerability I’ve found in this protocol. Um who am I? I am the head of research 00:00:25.559-->00:00:29.663 and development at Econocom Digital Security. Not the Digital Secret in Russia, 00:00:29.663-->00:00:36.570 obviously. Um I’ve been studying bluetooth low energy about four years now, uh three years now 00:00:36.570-->00:00:43.310 and um I’m the developer and maintainer of BtleJuice. Maybe uh you have heard about it. This 00:00:43.310-->00:00:49.783 is uh one of the framework I I worked on. And uh I’m having a a lot of with fun with nordix and 00:00:49.783-->00:00:55.622 microcontrol’s system and chips. So let’s start with the- the agenda. So uh we are going to go 00:00:55.622-->00:01:02.763 through the BLE sniffing 101 for those of you who don’t know how to perform BLE sniffing then I’m 00:01:02.763-->00:01:10.837 going to present BtleJack, which is my new tool for BLE sniffing and much more. We are going to 00:01:10.837-->00:01:18.345 see eh what is inside this tool, why this tool, and uh the next last part of the talk I’m going 00:01:18.345-->00:01:27.054 to disclose a new attack on BLE. Alright so let’s start with some uh BLE sniffing- just wait a 00:01:27.054-->00:01:35.228 minute- oh. So BLE sniffing 101. So basically if you nowadays want to sniff uh BLE connections 00:01:35.228-->00:01:42.970 and BLE communications between two devices you need some tools. Uh and there- you’re look there 00:01:42.970-->00:01:48.742 are a lot of cheap tools out there though you may want to sniff with uh ubertooh one uh 00:01:48.742-->00:01:56.183 sniff BLE connections or you may want to use Adafruit’s Bluefruit LE Sniffer which is uh also uh a 00:01:56.183-->00:02:04.124 nifty tool or you may want to do it the SDR way with the gnuaradio software suite. So 00:02:04.124-->00:02:10.831 let’s start with the first one. The ubertooth one. So um this is a tool that allows anyone to 00:02:10.831-->00:02:17.704 sniff existing and new BLE connections. I mean if you use this tool you can find existing 00:02:17.704-->00:02:25.912 connections between devices and also listen for new connections that happen on the target 00:02:25.912-->00:02:33.820 device. Erm it did not support channel map updates so it did not, because obviously they 00:02:33.820-->00:02:42.029 updated the firmware yesterday with the DefCon release and yeah. Uh so they updated the 00:02:42.029-->00:02:47.000 firmware and it’s not supported by the ubertooth tool so this is cool. If you everyone just use 00:02:47.000-->00:02:56.643 this new firmware and try it with a try it by sniffing some BLE stuff. But the fact is that 00:02:56.643-->00:03:02.315 the even with the new firmware the ubertooth one has some issues sniffing on existing 00:03:02.315-->00:03:08.388 connections and last but not least it costs 120 bucks. So it’s um it’s cheap but not so 00:03:08.388-->00:03:17.330 cheap. The bluefruit LE sniffer made by Adafruit's it’s based on specific software written by 00:03:17.330-->00:03:25.939 Nordic Semiconductor. So it’s uh proprietary firmware that is used here. Uh it was last uh it 00:03:25.939-->00:03:33.547 was updated in November last year so it’s uh quite maintained. But this uh sniffer 00:03:33.547-->00:03:41.254 only uh allows uh new connection sniffing. You cannot uh you cannot sniff an existing 00:03:41.254-->00:03:45.225 connection between two devices. Or the established connection I mean. So this is uh very 00:03:45.225-->00:03:51.965 interesting for um you know security notices but if you want to hack into existing devices or 00:03:51.965-->00:03:58.238 already connected devices you cannot do this with this uh bluefruit LE sniffer. It costs 00:03:58.238-->00:04:06.780 around uh 30 or 40 bucks so it’s uh it’s affordable. And if you want to do the SDR way eh you 00:04:06.780-->00:04:15.522 are going to have some issues because the SDR modules existing with gnuradio are only able to 00:04:15.522-->00:04:23.997 get the BLE advertising sent by the devices so you cannot follow any BLE connection with this 00:04:23.997-->00:04:31.805 approach. The reason is very simple because of the latency. There is some kind of latency 00:04:31.805-->00:04:38.879 between the gnuradio software and the SDR device you are using and it do not allow to jump very 00:04:38.879-->00:04:46.887 quickly over all the channels used in the BLE connection. And last but least it requires a 2.4 00:04:46.887-->00:04:54.294 gigahertz compatible SDR device that costs some hundred of dollars so it’s again affordable 00:04:54.294-->00:05:04.771 but it’s um more expensive than the cheapest one I talked about. So just to summarize this BLE 00:05:04.771-->00:05:11.912 sniffing 101 part of my talk so BLE basically is designed to make sniffing difficult and it- 00:05:11.912-->00:05:18.718 it’s working you know. It’s uh not so easy to sniff BLE connections. Why? Simply because 00:05:18.718-->00:05:24.958 this uh protocol uses 3 separate advertising channels spread across the bandwidth so you 00:05:24.958-->00:05:30.263 cannot listen to these 3 channels at the same time. You got to be eh listening on each 00:05:30.263-->00:05:36.069 channel one after the other to gath- to get all the information or maybe to use 3 devices to you 00:05:36.069-->00:05:44.578 listen to this 3 channel at the same time. The- this protocol also uses some kind of frequency 00:05:44.578-->00:05:51.618 hopping mechanism so channel- what we also can also call channel hopping. So this channel 00:05:51.618-->00:05:57.591 hopping uh mechanism makes also sniffing very difficult because once a connection is created 00:05:57.591-->00:06:02.395 between two devices the- these two devices are going to jump from one channel to another and 00:06:02.395-->00:06:08.602 then you need to- to get the pattern that they are using to synchronize with this connection 00:06:08.602-->00:06:14.140 and get all the packets. So this is not very easy when you are dealing with existing BLE 00:06:14.140-->00:06:22.849 connections. And both devices can also rene- renegotiate some parameters at any time so when 00:06:22.849-->00:06:28.989 you are trying to figure out what these parameters are in order to- to sniff an existing 00:06:28.989-->00:06:34.394 connection they might change between the- what you are measuring, what you are trying 00:06:34.394-->00:06:45.038 to recover these parameters. So this will mess your sniffing. So 2 cases here. You may have a lot 00:06:45.038-->00:06:50.910 of money and you can afford a- a lot of devices and make your sniffing on the all forty 00:06:50.910-->00:06:56.750 channels for instance. Or if you want to do it the cheaper way you got to struggle with the BLE 00:06:56.750-->00:07:03.323 sniffing. You won’t be able to sniff um very easy to your connection for the first time 00:07:03.323-->00:07:13.600 for instance. You have to wait a lit bit connections to get your- your data. So 2 years ago I took 00:07:13.600-->00:07:19.906 another approach for the- for capturing BLE packets. Uh I tried some kind of man in the 00:07:19.906-->00:07:25.612 middle approach. The idea of this man the middle approach was to have some kind of device in 00:07:25.612-->00:07:32.252 between your phone for instance and a- a device its connected to and then capture the packets. 00:07:32.252-->00:07:39.592 It’s basically the same uh the same approach that we uh all do uh when we are going to perform 00:07:39.592-->00:07:46.166 some TCP man in the middle for instance. So how it works. First you have to discover a target. 00:07:46.166-->00:07:52.806 You get- you get to find a target device so obviously this device is advertising itself so 00:07:52.806-->00:07:58.745 it’s not- so there is nothing connected to this device so it is advertising you what I am 00:07:58.745-->00:08:03.450 saying so its uh its presence so you can connect to it, get all the information, all the 00:08:03.450-->00:08:10.790 services, characteristics, and so on in a way that you can er then impersonate this device. 00:08:10.790-->00:08:15.228 You connect to this device that is not advertising anymore because of- because of the 00:08:15.228-->00:08:21.000 specifications uh for BLE version 4 uh once the device is uh when they’re- when they’re- 00:08:21.000-->00:08:28.708 once the device is connected to something it only supports one connection at a time. Most of 00:08:28.708-->00:08:35.148 them- most of them do this. Um there are are a few devices out there uh that only accepts 00:08:35.148-->00:08:40.453 multiple connections but it is very difficult for the system and chip that other- other radio 00:08:40.453-->00:08:47.193 parts to- to handle two or three connections at a time. Because its very fast to jump on 00:08:47.193-->00:08:52.732 different channels and with different set up, different parameters so this is uh not 00:08:52.732-->00:08:58.138 very easy. Well you are connected to this device. Its not advertising anymore. So you 00:08:58.138-->00:09:03.109 can create uh a clone device with the exact same parameters, the exact same services, 00:09:03.109-->00:09:10.350 characteristics, even the exact same bluetooth address so you can just spoof the device to do 00:09:10.350-->00:09:17.157 in order to say this, and wait for connections. Once your phone is connected to your fake 00:09:17.157-->00:09:23.997 device, your- all you have to do is just follow the data between your connection with the device 00:09:23.997-->00:09:27.967 and the connection with the phone so you are in between and you capture everything. So this- 00:09:27.967-->00:09:33.406 this approach has been implemented in Btlejuice- one of the tools I was talking about in 00:09:33.406-->00:09:42.182 the introduction- and also in another tool called gattacker uh written by Slawomir Jasik and uh 00:09:42.182-->00:09:48.755 this 2 tools implement the man in the middle approach. Well so it was working pretty well until 00:09:48.755-->00:09:58.098 the last few years un and it had a lot of advantages because you can get rid of the 3 advertising 00:09:58.098-->00:10:05.238 channel problem uh I mean if you are using this man in the middle approach you are controlling the 00:10:05.238-->00:10:11.778 advertising of your device so you are quite sure to get the connection and not miss it. You 00:10:11.778-->00:10:18.218 can see every BLE operation performed. If there is some kind of characteristic write or read 00:10:18.218-->00:10:25.725 or discovery you can get all of this and you see everything. And also you can make you can tamper 00:10:25.725-->00:10:33.633 the data on the fly since we are in between the 2 devices we can just change data on the fly 00:10:33.633-->00:10:43.409 maybe changing some bytes and causing some troubles. Uh in the security point of view. But 00:10:43.409-->00:10:50.917 there are a lot of issues too. One year after having developed the Btlejuice software I got a 00:10:50.917-->00:10:59.626 lot of issues on github with uh people saying ack I cannot use your tool it’s quite complex to 00:10:59.626-->00:11:04.831 install because it requires one virtual machine and one host computer and some kind of 00:11:04.831-->00:11:10.270 network setup to make these machines communicate with the each other so it was a quite 00:11:10.270-->00:11:18.011 complex set up and a lot of people had a lot of issues uh putting all of this software uh 00:11:18.011-->00:11:27.487 on-on their computers and making- making it working. The other problem we have is that we 00:11:27.487-->00:11:34.627 only capture HCI events because we um work at the adaptor level. We don’t get any link layer BLE 00:11:34.627-->00:11:42.902 packets so we are one way upper- we are- we cannot get all of the information and especially um 00:11:42.902-->00:11:50.009 all the pairing packets uh so this approach- the man in the middle approach does not support 00:11:50.009-->00:11:55.848 all types of pairing and this makes it cause a lot of trouble when you are trying to intercept 00:11:55.848-->00:12:02.121 encrypted connections and obviously it’s also compatible only with 4 point O adaptors. 00:12:02.121-->00:12:08.861 Maybe you have heard about the Cambridge silicon radio USB adaptors that are some kind of 00:12:08.861-->00:12:15.101 bluetooth device address spoofing. Well we got some troubles too with the latest 00:12:15.101-->00:12:22.675 version of the USB adaptors or even the erm adaptors uh provided with the uh motherboard 00:12:22.675-->00:12:28.481 of your computer. So the stock adaptor of your computer may cause trouble um with the these 00:12:28.481-->00:12:36.055 softwares. So this all the cons of the man in the middle approach. So basically we are 00:12:36.055-->00:12:45.031 doing it wrong. Ubertooth btle okay it works but still there are some limitations even with 00:12:45.031-->00:12:50.970 the uh firmware update uh released yesterday. Nordic semiconductor sniffer is closed 00:12:50.970-->00:12:55.108 source and may be discontinued so we don’t know if this software is going to be 00:12:55.108-->00:13:02.248 maintained and we don’t know if uh if uh what will happen if uh Nordic semiconductor decides to- 00:13:02.248-->00:13:07.954 not to continue with the development of this uh this uh software so maybe a problem. And 00:13:07.954-->00:13:14.193 uh the man in the middle approach is great but it is too much difficult to use and uh it 00:13:14.193-->00:13:23.503 cause a lot of trouble for users. And also it cannot get all this link layer packets 00:13:23.503-->00:13:30.743 because we are um limited by the uh solution we update for. So it’s time to improve the BLE 00:13:30.743-->00:13:38.084 arsenal so basically what would be the ideal tool to sniff BLE connections? Well we need a tool 00:13:38.084-->00:13:45.892 able to sniff both existing and new connections. We also need a tool that uses cheap hardware in 00:13:45.892-->00:13:53.399 order to make it affordable you know to allow the ticket for BLE sniffing. And of course we need 00:13:53.399-->00:14:00.139 open source software to be able to maintain it to contribute for allowing other researchers to- 00:14:00.139-->00:14:05.978 to push new features for instance. So this is a something very very important here. This 00:14:05.978-->00:14:14.554 tool needs to sniff new connections. I’m going to go uh deeper at the protocol just to 00:14:14.554-->00:14:20.693 show you how it works and the internet very quickly. The- for new connections the goal is very 00:14:20.693-->00:14:27.400 easy. We need to get the connection request PDU which is in fact a dedicated packet sent 00:14:27.400-->00:14:32.705 by your phone for instance when you when you’re trying to connect to a BLE enabled device 00:14:32.705-->00:14:41.013 and in this packet there is everything- everything we need to monitor or to follow the BLE 00:14:41.013-->00:14:45.818 connections. We got the uh CRCInit value, we got the channel map and so on so if we 00:14:45.818-->00:14:51.691 capture this packet we are able to follow the connection and then to sniff the packets. But 00:14:51.691-->00:14:58.965 we- for sniffing these packets we got to be at the very specific moment listening on the 00:14:58.965-->00:15:05.772 specific channel when this packet is sent and as we saw this previously there are 3 00:15:05.772-->00:15:15.314 advertising channels so we you must just listen on one channel to another hoping that this 00:15:15.314-->00:15:22.455 packet will arrive at the specific moment or you may want to sniff on this 3 advertising 00:15:22.455-->00:15:29.262 channels at the same time in order to to get this packet so in order for this to work we 00:15:29.262-->00:15:36.803 need this situation. We need to listen at the same time to these 3 advertising channels. So this 00:15:36.803-->00:15:45.044 one is quite easy to sniff uh new connections. The trickiest part is the active connections 00:15:45.044-->00:15:50.817 sniffing process. So in order to sniff active connections you don’t have all of these 00:15:50.817-->00:15:57.557 parameters. You don’t know the uh connection parameters so you you have to guess them and in 00:15:57.557-->00:16:04.664 order to guess this parameters 0we made. We are going to make some measures. Mike Ryan the 00:16:04.664-->00:16:10.970 author of ubertools btle so the tool uh uh I cited just before uh created his uh own technique 00:16:10.970-->00:16:21.681 to get to recover this parameters. And his technique is the follow. First he tries to 00:16:21.681-->00:16:29.689 identify what the the protocol calls an access address. An access address is a 32 bit value 00:16:29.689-->00:16:36.929 used to identify a link between two devices. For this access address is used uh to identify a 00:16:36.929-->00:16:44.737 specific connections. Once the access address is known we can recover the CRCinit value that 00:16:44.737-->00:16:51.811 is used to computer CRC uh this is some kind of seed used to compute the CRC value for every 00:16:51.811-->00:17:00.052 packet. And this can be done very easily. Then we need to get the hopInterval. The hopInterval 00:17:00.052-->00:17:09.462 is basically the time the device was spent on each channel. So how to you uh how do we do that? 00:17:09.462-->00:17:16.135 Er very easily. We just sit on the specific channel. We are measuring the time between two 00:17:16.135-->00:17:22.441 consecutive packets on this channel and we divide it by 37 since there are 37 data channels 00:17:22.441-->00:17:32.852 used for the channel hopping pattern. And of course we can also recover the hopIncrement 00:17:32.852-->00:17:39.358 which is the number of channels added to uh the channel index each time the uh connections 00:17:39.358-->00:17:43.296 jumps from one channel to another by using some kind of look up table. So Mike Ryan 00:17:43.296-->00:17:51.771 designed a precomputer look up table and uh he ubertooth btle for instance measured the time 00:17:51.771-->00:17:58.110 between 2 consecutive packets on channel zero and one. By using this uh this technique and the 00:17:58.110-->00:18:05.451 look up table we are able to recover the hopIncrement value. So this is Mike Ryan’s technique 00:18:05.451-->00:18:12.258 as it was implemented in the ubertooth btle software and it still the case. Uh even with the 00:18:12.258-->00:18:24.036 uh update made yesterday. And of course Mike made some assumptions uh back in 2013. He 00:18:24.036-->00:18:31.978 made the assumption that all the 37 data channels are used. But it’s not the case. Now in 2018 00:18:31.978-->00:18:40.820 most of the uh most of the BLE devices don’t use all of this uh 37 data channels and the change 00:18:40.820-->00:18:47.827 that the data mine these data channels by using some kind of channel map. This is a parameter 00:18:47.827-->00:18:54.233 sent in the connection request PDU that specify which channel are going to be used and which 00:18:54.233-->00:19:03.309 would not. So um if not all the data channels are are used then you have to to keep a 37 channel 00:19:03.309-->00:19:09.415 sequence and to to do that some of these channels will be remapped will be reused if you 00:19:09.415-->00:19:17.690 prefer. So if you ever look at a hopping sequence in this specific case you will see if I 00:19:17.690-->00:19:23.229 understand that the channel 4 is used twice in the sequence in the sequence but uh normally you 00:19:23.229-->00:19:32.672 would er you will find only it would be find only once in the normal sequence if it’s not 00:19:32.672-->00:19:40.146 reused. So by um modifying the uh sequence order and making these channel appears twice if 00:19:40.146-->00:19:44.583 you just measure the time between two consecutive packets on the channel 4 we get 2 00:19:44.583-->00:19:55.428 values, 2 different values and this makes Mike’s technique useless. This does this does not 00:19:55.428-->00:20:03.469 work anymore. So how to deduce all this based on this new behavior. Well first thing to do 00:20:03.469-->00:20:12.178 is to deduce the channel map. So how it’s very easy to to deduce we just iterate over all the 00:20:12.178-->00:20:18.050 channels. We are looking for packets and if we see some some packets sent by the device okay 00:20:18.050-->00:20:22.288 the channel is used okay the channel is used. If we don’t see any packet it’s not used so 00:20:22.288-->00:20:27.626 there is some kind of timer you have to implement to get this uh this values and can takes 00:20:27.626-->00:20:35.167 sometimes uh here for instead 4 times 37 seconds to complete. Well this is a this is a 00:20:35.167-->00:20:42.241 limitation of this approach. Once you get the channel map you can deduce the hopInterval by 00:20:42.241-->00:20:46.579 finding a unique channel that is not uh repeated in the uh hopping sequence and then you 00:20:46.579-->00:20:51.917 measure the time by 2 packets and you divide it by 37 and you get the the time spent on each 00:20:51.917-->00:21:01.827 channel. Deduce the hopIncrement based on this but we don’t use precomputer look up table. We 00:21:01.827-->00:21:07.633 are going to generate it based on the based on the channel map and then we are going to measure 00:21:07.633-->00:21:14.306 and deduce the hopIncrement. This this is basically the uh more generic version of uh 00:21:14.306-->00:21:20.546 Mike’s technique but it works pretty well. There are lot more details in the uh proof of 00:21:20.546-->00:21:28.120 concept in the get the f**k out number 17 where I write a paper with all the algorithms and the 00:21:28.120-->00:21:35.961 the uh you know the math between behind this technique. Well and all of this uh is going to be 00:21:35.961-->00:21:43.102 implemented in btlejack. There is also another another trick here for uh sniffing this 00:21:43.102-->00:21:50.075 connection. In the specification there is uh uh uh parameter called the instant you know and 00:21:50.075-->00:21:55.981 a device updates on some parameters let’s say the channel map perhaps. It’s in the packet 00:21:55.981-->00:22:03.789 telling the the device that the channel map will be updated at a specific moment in the 00:22:03.789-->00:22:10.763 connection but not now. Later on, but we don’t know this value we don’t know this instant value 00:22:10.763-->00:22:15.501 when you are attacking existing connections so this might be a problem since it is used for 00:22:15.501-->00:22:22.141 updating the channel map and if the channel mao is updated we may lose our synchronization we 00:22:22.141-->00:22:29.415 may lose the uh signal and lose packets. So the fact is that the uh we we don’t really care. We 00:22:29.415-->00:22:36.655 don’t really care because uh once uh a channel map update packet is uh issued by a device- 00:22:36.655-->00:22:48.701 whoops. Sorry. So once a channel map update packet is uh sent to the device at the specific 00:22:48.701-->00:22:54.874 instant we don’t know the hopping sequence will change and then we are going to sniff on 00:22:54.874-->00:23:03.816 channel 11 in this case one of the sequence will go to channel 1. So obviously we won’t get any 00:23:03.816-->00:23:12.524 packet on channel 11 so this may be an indicator that the channel map has been updated and we can 00:23:12.524-->00:23:19.732 deduce the new hopping sequence and resynchronize with the communication. So by using this 00:23:19.732-->00:23:26.405 little trick we can just follow any connection and support the channel map update process even 00:23:26.405-->00:23:33.879 if we know- if we don’t know the instant value uh for this precise connection. So all of 00:23:33.879-->00:23:41.287 this is implemented in btlejack and uh so I decided to create this this new tool uh and I’m 00:23:41.287-->00:23:47.192 very proud to present it at DefCon this year. This is a brand new tool based on the 00:23:47.192-->00:23:52.097 microbit um Again this is a a tiny device some kind of arduino sponsored by the British 00:23:52.097-->00:23:59.605 Broadcasting company uh the original goal of this device was to you know to help UK students 00:23:59.605-->00:24:05.878 to learn how to code. But in fact we can turn it uh into some kind of hacker tool and it is 00:24:05.878-->00:24:10.683 pretty cool. It costs only 15 bucks so it’s uh quite affordable and you can buy more 00:24:10.683-->00:24:17.489 more of them 3 of them 4 of them for the uh exact same price uh for the like the bluefruit uh 00:24:17.489-->00:24:24.863 adafruit bluefruit BLE sniffer for instance. You can also stack them and uh create some sniffing 00:24:24.863-->00:24:32.871 radio if you want to do to do this so basically I modified the crystal art for raspberry pi. 00:24:32.871-->00:24:43.415 This is just a usb to usb hub but um it’s quite eh quite useful. I had to find a name 00:24:43.415-->00:24:52.358 obviously so I since I’m not a very creative person uh you know uh uh you see. Uh it’s called 00:24:52.358-->00:25:02.234 btlejack because because of the new ability I’m going to present in the next section. But anyway 00:25:02.234-->00:25:10.776 this uh this tool is quite um is quite um you know quite useful but I won’t do any live demo 00:25:10.776-->00:25:15.314 because I know you first. I know if I put some kind of BLE device you are going to connect to it 00:25:15.314-->00:25:23.322 and I won’t be able to do my demo. [laughter] And of course uh the this is a very noisy 00:25:23.322-->00:25:26.992 environment here at DefCon. I did some sniffing during some talks yesterday and it was very 00:25:26.992-->00:25:35.501 noisy. So uh I got videos. So the first video shows that the uh the sniffing of a new 00:25:35.501-->00:25:41.640 connection so I specify the B- the bluetooth device address in the parameter and as you can see 00:25:41.640-->00:25:47.246 uh we are able to to intercept the connection and get all the link layer packets. We also get 00:25:47.246-->00:25:53.819 the access address, the CRCInit value and so on. So sniffing new connection - no problem. 00:25:53.819-->00:26:00.526 Sniffing an existing connection for a specific device first you have to identify an exist- valid 00:26:00.526-->00:26:06.031 address. So there is an option in the tool to scan and identify this address. I pick a target 00:26:06.031-->00:26:12.938 here with the specific access address and then btlejack will recover all the required 00:26:12.938-->00:26:20.579 parameters to follow to be able to follow the connection and then to sniff packets. So eh it 00:26:20.579-->00:26:28.954 recovers the uh CRC Init value, the channel map obviously and then it deduce it deduces the 00:26:28.954-->00:26:37.329 hopInterval and hopIncrement. And it synchronized and if I do some read or write various 00:26:37.329-->00:26:43.635 characteristics and get all the packets. So again existing connections well not really a 00:26:43.635-->00:26:50.642 problem with btlejack. And uh to to offer some uh you know some other features there is a PCAP 00:26:50.642-->00:26:57.850 export possible so if you intercept packets with btlejack you can export these files into 00:26:57.850-->00:27:02.888 a PCAP file and well obviously this was expected for this kind of tool but uh it also support 00:27:02.888-->00:27:08.961 the uh specific format for the PCAP file that uh makes it able to use with Crackle. Crackle is 00:27:08.961-->00:27:16.602 a tool designed by Mike RYan to break the encryption keys when uh some kind of pairing is used 00:27:16.602-->00:27:24.109 uh between 2 BLE devices. So this may also be used for if you want to break encryption keys or 00:27:24.109-->00:27:37.956 pairing codes for BLE. So when I was developing this uh this tool this new sniffer I read the 00:27:37.956-->00:27:44.596 specifications a lot. I went all of the all of the details of the specifications and I stumbled 00:27:44.596-->00:27:54.439 upon a very specific uh you know not weakness but something you know that made me feel bad. I 00:27:54.439-->00:28:02.648 don’t know what it was but I found I was reading the the section about the supervision 00:28:02.648-->00:28:11.690 timeout in uh in uh this specifications and uh just to to- just to sum it- summarize it 00:28:11.690-->00:28:19.798 a bit. So the supervision timeout is uh is provided by uh a device uh in the connection 00:28:19.798-->00:28:26.905 request PDU so this is a parameter found in the connections the connection 00:28:26.905-->00:28:34.179 request PDU basically it defines a time after which a connection should consider a uh um a 00:28:34.179-->00:28:41.086 connection uh a device sorry should consider a connection lost so basically if you try to 00:28:41.086-->00:28:46.925 connect your phone with say a smart watch your phone is going to tell the smartwatch that is 00:28:46.925-->00:28:53.699 no valid packets is received it has been or is received after 20 seconds then your smartwatch and 00:28:53.699-->00:29:00.505 your phone should consider the connection lost. And this so this supervision timeout is 00:29:00.505-->00:29:13.185 enforced by both devices, And uh I had quite an idea about it. Yeah was that time out. Uh. What 00:29:13.185-->00:29:22.694 if when we uh jam some specific packet at specific time? Let’s see. So there is 3 lines in my 00:29:22.694-->00:29:28.634 slide. Central, peripheral, and attacker. Central is your phone the central device the initiator 00:29:28.634-->00:29:35.107 of the connection. The peripheral is uh obviously your smart watch or your medical 00:29:35.107-->00:29:42.347 device anyway. So uh your phone sends a regularly packets to the device and there are is some 00:29:42.347-->00:29:48.220 kind of keep alive packets sent just to be sure that the connection is still alive. So 00:29:48.220-->00:29:57.095 many packets and we decide to jam the packets sent by the peripheral to the central device 00:29:57.095-->00:30:05.771 and since then the central device consider the connection not lost but uh with nobody data 00:30:05.771-->00:30:18.550 so it starts a timer and we do this sometimes until the supervision timeout is reached. 00:30:18.550-->00:30:25.257 And then the central device considers the connection is lost. But the fun fact here is 00:30:25.257-->00:30:29.227 that the peripheral still gets packets from the master from the central device so it’s not 00:30:29.227-->00:30:37.069 disconnected and then we can have some fun. [laughter] By impersonating the central 00:30:37.069-->00:30:45.877 device, we can get the connection. So it’s based on jamming. First of all I 00:30:45.877-->00:30:52.084 implemented the jamming feature in btlejack. So this is just a short video. I don’t know how 00:30:52.084-->00:31:00.058 many time okay. So I’m connecting on a a to a specific device. I’m using btlejack to to 00:31:00.058-->00:31:08.800 jam the connection I don’t know if it’s going to it’s going to be already. No but to jam the 00:31:08.800-->00:31:14.339 connection you got to recover all the required parameters all these CRCInit, channel mapp, 00:31:14.339-->00:31:21.413 hopInterval, hopIncrement and so on. And once the btle- once btlejack is synchronized with 00:31:21.413-->00:31:28.687 the connection it starts jamming by sending bad packets and this will cause some CRC errors on 00:31:28.687-->00:31:37.629 the uh phone side and the phone is disconnected I don’t know if it’s uh very easy to see but 00:31:37.629-->00:31:43.034 here it’s disconnected. So jamming works pretty well. So the idea of this attack uh which 00:31:43.034-->00:31:50.876 I call it btlejacking because of the tool but anyway uh it’s uh this attack abuses BLE 00:31:50.876-->00:31:58.016 supervision timeout to take over a connection so basically we get a hand on the exist- exis- bluh 00:31:58.016-->00:32:06.358 bluh bluh sorry. We get a hand on the existing connection so um without changing the internal 00:32:06.358-->00:32:12.063 state of the device itself. There is no disconnection at all so it was some uh some troubles. 00:32:12.063-->00:32:19.971 It works on all versions of the bluetooth low energy protocol. Version 4 point O, 1, 2 and 5. 00:32:19.971-->00:32:26.444 But it requires proximity because you need to be close to the target to jam it. If you are 00:32:26.444-->00:32:35.954 not close, about 5 meters, uh 5 meters is good. You can jam the target. And now we demo this 00:32:35.954-->00:32:42.027 attack with some example devices. We are going to start with something everybody loves. 00:32:42.027-->00:32:50.769 Drones. So I- I found a drone on the Amazon and this drone uses BLE for the communication 00:32:50.769-->00:32:55.674 between the smart application- the smart application you install on your phone and uh and 00:32:55.674-->00:33:16.661 the drone. So I decided to test this in my testbed uh It’s too loud I guess. Yeah. So uh as you 00:33:16.661-->00:33:24.269 can see it’s difficult to keep it in the you know video but anyway I start btlejack and I- 00:33:24.269-->00:33:32.344 I- I am going to- to hijack the connection by using this this tool so we got to recover the 00:33:32.344-->00:33:38.950 CRCInit, channel map, and so on. Then we are jamming the uh the- the smart phone to disconnect 00:33:38.950-->00:33:50.996 the the smartphone and it get- it gets disconnected quite soon. So yup. The smart phone is 00:33:50.996-->00:34:01.039 disconnected so the owner of the drone cannot pilot anymore the drone but I have the- I have the 00:34:01.039-->00:34:11.149 control of the connection and I can make it land. [applause] Well I- I know this is not 00:34:11.149-->00:34:22.360 impressive so I made another video. So this- in this video I trigger the emergency mode that 00:34:22.360-->00:34:34.673 causes the cut off of the motors. So yeah. But. [applause] So it’s basically the same 00:34:34.673-->00:34:45.784 attack with two payouts. And I uh also played with uh [laughter] With uh some other 00:34:45.784-->00:34:50.755 devices and uh especially sex toys. A lot of great fun with sex toys but anyway Um, why sex 00:34:50.755-->00:34:56.828 toys? Because Pen Test Partners made some research last year uh they coined the term screwed 00:34:56.828-->00:35:04.869 wiring uh um they were performing some kind of wiring and found this uh uh ash from 00:35:04.869-->00:35:10.508 love ins and they wrote a complete post on their website stating that this is completely 00:35:10.508-->00:35:18.683 crappy and not secure and so on. Obviously the inventor of this sex toy saw this article, saw 00:35:18.683-->00:35:27.392 this post and uh fought back. They issued a statement saying that if your sex toy is on but 00:35:27.392-->00:35:34.132 if your smartphone is connected to the sex toy, you’re okay since it’s not advertising 00:35:34.132-->00:35:43.975 anymore nobody can connect to this uh this um you know this sex toy. And uh I guess we know 00:35:43.975-->00:35:53.284 what will happen in the next slide. [laughter] So the sex toy is connected to my uh to my 00:35:53.284-->00:36:01.593 smartphone uh just to make the video short I had to- to cut it off- to cut it a bit. But in 00:36:01.593-->00:36:07.298 fact I disconnect the smart phone by taking over the connection with btlejack. Takes 00:36:07.298-->00:36:14.139 some time. There is a little pop up on the smartphone. Yeah. This is disconnected so the smart 00:36:14.139-->00:36:22.480 phone has no more control of the uh of the sex toy. And since it’s you are out of BLE it is 00:36:22.480-->00:36:29.421 quite easy to make it vibrate. There is no sound here just to you know but it’s still visual. 00:36:29.421-->00:36:38.496 You’ll get my point. I found the correct characteristic and I wrote to the this characteristic 00:36:38.496-->00:36:55.180 a special strong vibrate semi colon 2. There are 10 levels. [laughter and applause] So well 00:36:55.180-->00:37:03.855 I I don’t know if uh some of you were aware of this kind of stuff [laughter] But uh. Yeah maybe 00:37:03.855-->00:37:11.429 yeah turn it off. So what are the impacts on of this uh vulnerability? So you get 00:37:11.429-->00:37:17.235 unauthorized access to the device. So obviously this was the case for the sex toy. Even 00:37:17.235-->00:37:23.208 if it’s already connected. Of course if there is some kind of authentication performed at the 00:37:23.208-->00:37:26.978 start of the connection then you can bypass it so this um may be cool for some software and so 00:37:26.978-->00:37:33.618 on. And um also since there is- since there is absolutely no modification of the internal 00:37:33.618-->00:37:40.225 state. Since there is do disconnection of the device uh this may leak valuable 00:37:40.225-->00:37:48.233 information if some characteristics are available for you know for read and write 00:37:48.233-->00:37:52.070 you can may get get back some data that have been written to this characteristic so this may 00:37:52.070-->00:38:04.616 be interesting. How to avoid this? Well the BLE specification provide a- sorry provide some 00:38:04.616-->00:38:10.955 kind of secure connections by using pairings so if you are using um if you are using the 00:38:10.955-->00:38:15.860 pairing mechanism and the encryption mechanism provided by the um bluetooth specifications 00:38:15.860-->00:38:24.569 should be okay. Um there is a some kind of uh injection protection uh there is a uh 00:38:24.569-->00:38:31.342 message integrated code added to the packets that uh avoid this kind of manipulation or this 00:38:31.342-->00:38:37.782 kind of you know consequences. But um the fact is that the couple of packets don’t have 00:38:37.782-->00:38:44.989 this message integrated code so basically you can take over the connection even if you are using 00:38:44.989-->00:38:52.463 this uh this uh this secure BLE connection. Well can do some kind of denial- denial of 00:38:52.463-->00:38:59.704 service or I don’t know. Uh or you can do it at the application level by using some kind of 00:38:59.704-->00:39:04.776 fetch map or some kind of authentication for the data you are going to exchange. So there 00:39:04.776-->00:39:14.786 are some counter measures but uh yeah uh it’s up to you to use them correctly. So the tool is- 00:39:14.786-->00:39:20.725 is available online. It was- it has been released this morning on the github. Uh it can also 00:39:20.725-->00:39:28.533 install it with uhPEAP if you if you want and so for- uh yeah I’m French. Uh it’s also available 00:39:28.533-->00:39:40.578 on PEAP. So this btlejack tool is able to sniff already established connections and new 00:39:40.578-->00:39:48.186 BLE connections. It’s also able to jam connections to perform a take over, hijacking. Uh and uh 00:39:48.186-->00:39:56.261 it is able to export in PCAP and there is also a multi sniffer support if you connect 2 or 3 of 00:39:56.261-->00:40:01.099 them microbits to your computer it will use them to power the some tasks so the channel map 00:40:01.099-->00:40:08.139 recover is sped up if you are using a lot of um microbits with um your computer. You know we 00:40:08.139-->00:40:15.813 get the 37 channels speaking 4 for instance if you are using 4 of them it speeds things a lot. 00:40:15.813-->00:40:22.787 So to conclude btlejack well may be the all in one solution for BLE sniffing uh if you want to 00:40:22.787-->00:40:28.893 drop a look at this took or to to try it you are more than welcome and also if you want to 00:40:28.893-->00:40:39.437 push some issues or if you find bugs and so on I would uh under them. So uh perform BLE sniffing 00:40:39.437-->00:40:44.742 jamming and hijacking. Hijacking works on all versions of BLE. Uh insecured BLE connections as we 00:40:44.742-->00:40:51.683 may all know are prone to sniffing and hijacking so it might get worse with further 00:40:51.683-->00:40:59.190 versions of BLE because the bluetooth is trying to extend the range of the bluetooth low 00:40:59.190-->00:41:04.128 energy protocol so um the bluetooth 5 version of the protocol is available yeah um is 00:41:04.128-->00:41:12.337 capable of uh um about 800 meters connections so you can it’s quite impressive and they 00:41:12.337-->00:41:19.544 might you know extend this range with further versions of this product. So if you are some kind 00:41:19.544-->00:41:26.150 of BLE device vendor you are more than welcome to secure your BLE connections. Yeah. Do it. 00:41:26.150-->00:00:00.000 Thank you very much. [applause]