1 00:00:00,000 --> 00:00:01,520 All the way from France. 2 00:00:02,020 --> 00:00:06,740 One for all and all for WHD, wireless shenanigans made easy. 3 00:00:06,740 --> 00:00:10,080 Please welcome to the stage Damien and Roman. 4 00:00:13,610 --> 00:00:14,930 Hello DEF CON! 5 00:00:17,190 --> 00:00:30,110 Okay so this is uh last talk for today on this track and we are going to present you uh something we've been working on uh since more than two years now and this is what? 6 00:00:32,470 --> 00:00:34,650 Oh as usual. 7 00:00:35,110 --> 00:00:37,930 Okay so uh let me introduce ourselves. 8 00:00:37,930 --> 00:00:41,210 I'm Damien, Damien Coquille from Quarkstab. 9 00:00:41,210 --> 00:00:46,690 I'm the maintainer of a tool called BTE Jack or Beto Jack, call it what you want. 10 00:00:46,690 --> 00:00:53,090 Uh this is a BLE Swiss Army tool and uh I love reversing stuff as well on embedded systems. 11 00:00:53,090 --> 00:00:58,110 And this is Roman, the maintainer of Mirage, another BLE Swiss Army tool. 12 00:00:58,110 --> 00:01:01,930 But not only BLE does ZigBee and some other protocol as well. 13 00:01:01,930 --> 00:01:08,090 And uh he loves cross protocol attacks and we are going to talk a bit uh about this later in the talk. 14 00:01:08,510 --> 00:01:14,810 So what is what and why we had to create this uh framework? 15 00:01:14,970 --> 00:01:17,610 So basically wireless tools are a mess. 16 00:01:17,610 --> 00:01:23,270 A lot of researchers did a lot of research on wireless protocols and they create a lot of tools. 17 00:01:23,270 --> 00:01:27,830 Different tools with different protocols and different devices and different firmwares. 18 00:01:27,830 --> 00:01:34,970 Uh each firmware communicates with the host or computer with a specific protocol designed by each person. 19 00:01:34,970 --> 00:01:38,810 And basically everyone revents the wheel because why not? 20 00:01:38,890 --> 00:01:47,450 And if you are into, yep, if you are into wireless protocol hacking, you may have to use a lot of different tools. 21 00:01:47,450 --> 00:01:58,950 So for BLE, the classic tools, BTD, Mirage, uh Gattacurl, SniffID, uh are the best way to to capture information and test some devices. 22 00:01:59,090 --> 00:02:02,910 And in the end, you end up with a lot of devices. 23 00:02:02,910 --> 00:02:09,250 So if you want to be able to tackle with all these protocols, you need to buy at least all of these. 24 00:02:09,570 --> 00:02:13,210 And the problem is um that it takes a lot of space. 25 00:02:13,210 --> 00:02:15,450 It costs a lot uh as well. 26 00:02:15,450 --> 00:02:19,350 And most of this hardware uh can be discontinued at any time. 27 00:02:19,350 --> 00:02:26,630 So if you want to to hack some wireless protocol, there is this tiny hardware you didn't buy 2 years ago. 28 00:02:26,630 --> 00:02:31,010 And it's the only hardware that is supported for hacking this specific protocol. 29 00:02:31,010 --> 00:02:33,530 So that's uh that's a shame. 30 00:02:33,530 --> 00:02:36,030 And basically this is just a waste of time. 31 00:02:36,090 --> 00:02:52,610 And because uh you need to create a different uh each researcher create different firmware and uh um each researcher or each person trying to hack a wireless protocol uh is going to face the same issues other people have already had before and uh with the same solution as well. 32 00:02:52,850 --> 00:02:56,190 And uh all of this in fact creates fragmentation. 33 00:02:56,190 --> 00:03:00,610 And uh this is uh this is not good for us uh this kind of fragmentation. 34 00:03:03,120 --> 00:03:14,760 So we uh talked a lot together and uh we try to find a solution to solve this fragmentation issue. 35 00:03:14,980 --> 00:03:21,000 So uh it leads us to uh come with a three main ideas. 36 00:03:21,000 --> 00:03:33,900 So uh the first one uh would be to design uh communication protocol for the communication between the host and uh the other world that would be extensible. 37 00:03:33,900 --> 00:03:40,400 And either these that would support multiple wireless protocols, multiple physical layers uh at the same time. 38 00:03:40,400 --> 00:03:45,720 And of course uh that could be open source and easy to extend. 39 00:03:45,800 --> 00:04:06,840 Uh the second uh big idea uh would be to uh create a set of libraries, a framework, and basically a world ecosystem uh that will allow uh some use of uh values uh ready to use features for different hardware, different platforms. 40 00:04:06,840 --> 00:04:11,600 And that would be available both for the host and the firmware. 41 00:04:12,060 --> 00:04:28,300 And uh the third main uh idea we came with is uh that for uh these two works uh it must uh from the beginning encourage the interoperability and the collaboration between the researchers. 42 00:04:28,300 --> 00:04:41,900 So uh it motivated us to build everything as open source software and to uh evenly document both the use uh of the tools but also uh its design. 43 00:04:43,020 --> 00:04:54,360 So uh here comes the main uh part uh of WAD for this project, which is the WAD protocol. 44 00:04:54,360 --> 00:04:59,100 So we have several guidelines that have motivated uh its development. 45 00:04:59,100 --> 00:05:05,160 So first uh it's a standardized protocol so we we properly defined it. 46 00:05:05,160 --> 00:05:08,780 Everything uh is uh documented and explained. 47 00:05:08,840 --> 00:05:18,500 It's uh generic so it covers uh a set of wireless capabilities that are uh already uh in the ecosystem. 48 00:05:18,500 --> 00:05:23,900 It's modular so you can support multiple uh wireless protocols. 49 00:05:23,900 --> 00:05:30,480 Uh and uh if you want to add more and put your own, it's a protocol which is evolutive. 50 00:05:30,480 --> 00:05:36,360 So the protocol has been designed to be easily extended and improved over time. 51 00:05:36,700 --> 00:05:42,520 And finally uh we also tried to make it as user friendly as possible. 52 00:05:42,520 --> 00:05:56,080 So uh we developed a set of C, C++, and Python parsing libraries uh allowing to facilitate uh its integration into uh your framework uh and so on. 53 00:05:56,440 --> 00:06:08,240 So another uh key uh idea behind WAD is uh to offload most of the complexity from the firmware side to the uh outside. 54 00:06:08,480 --> 00:06:13,760 So of course on the firmware side we have some CPU uh some memory limitations. 55 00:06:13,780 --> 00:06:19,360 And so the idea was uh to keep only uh what is uh needed. 56 00:06:19,360 --> 00:06:25,260 So some atomic uh wireless primitives uh as basic as possible. 57 00:06:25,280 --> 00:06:31,800 Uh and of course the operations that are time critical and that could not be offloaded to the host. 58 00:06:31,800 --> 00:06:34,020 So for example the channel opening, this kind of stuff. 59 00:06:34,200 --> 00:06:45,560 So we keep uh a minimal logic in the firmware and all the attack, the protocol stacks, the packet detectors and so on are implemented on the host. 60 00:06:46,540 --> 00:06:59,320 So finally uh WAD has been designed uh not only uh for hackers, if any, if we are in a hacker conference, but uh also for uh everyone. 61 00:06:59,320 --> 00:07:02,720 So if you are a security researcher uh you can use it. 62 00:07:02,720 --> 00:07:18,960 If you are just a wireless uh enthusiast and you want to control uh your IoT devices uh or if you are just a curious user and you want to understand how uh your favorite wireless toy works. 63 00:07:22,000 --> 00:07:26,280 Alright so uh what is WAD in fact? 64 00:07:26,340 --> 00:07:39,860 Uh Romain introduced the main concept behind this uh this framework but in fact uh technically uh first the name because you know when you start a project you get you got to find a name and it's always a pain in the ass to find something yeah meaningful. 65 00:07:40,080 --> 00:08:05,640 Uh so WAD stands originally for Wireless Hacking Devices because it was uh supposed to support a lot of wireless uh so a lot of devices to hack into wireless protocols and after having used this projects uh during more than a year uh yeah wireless hacking for them is also a great name because it's uh makes things easier and we are going to show that in multiple demos. 66 00:08:06,200 --> 00:08:36,060 Uh like Romain said it's more than a protocol uh because designing a protocol, a communication protocol between a host and a device that's a thing and this is something uh we we already did uh two of us uh for our respective tools but in fact providing uh uh an ecosystem with uh the protocol all libraries in Python and in C and C++ that you can embed in your firmware and use to communicate with the host without having uh you know uh without worrying about how the data is encoded and so on. 67 00:08:36,060 --> 00:08:39,200 This is uh this is a lifesaver. 68 00:08:39,200 --> 00:08:51,480 Uh you when you develop a firmware compatible with this uh ecosystem you the only thing you need to worry about is the specific code that runs and that handles all the radio frequency stuff. 69 00:08:52,160 --> 00:09:01,120 And uh also we provide a lot of tools uh command line interface tools and uh maybe some are more evolved and provide more features. 70 00:09:01,120 --> 00:09:08,540 But if you want to create your own applications based on a web on this ecosystem you can do uh as do it as well. 71 00:09:08,540 --> 00:09:12,860 And you can just use the Python client library and use it uh yeah. 72 00:09:12,860 --> 00:09:15,880 It's very simple to to develop something. 73 00:09:15,880 --> 00:09:21,320 From the protocol perspective it's based on protocol buffers so yeah no surprise here. 74 00:09:21,320 --> 00:09:32,800 And um the protocol has been thought uh in a way that the uh host can query the device uh about what uh the devices or capabilities are. 75 00:09:32,800 --> 00:09:48,100 So basically each device compatible device can announce itself to the uh wild ecosystem and especially to the host telling okay I I support this protocol uh I can do this with this protocol packet injection or just sniffing scanning anything. 76 00:09:48,140 --> 00:09:55,520 And the host adapts uh the the tools based on the uh capabilities announced by the device. 77 00:09:55,520 --> 00:10:01,460 And this is a discovery protocol that has been included in wild and uh this one is mandatory for any device. 78 00:10:01,460 --> 00:10:11,620 Uh you can have uh uh some hardware on the ZigBee protocol and the BLE or or even just modulation modulation and demodulation as well. 79 00:10:11,620 --> 00:10:19,320 Uh but in fact you can have some you can have multiple protocols supported by a single device with using this uh this system. 80 00:10:20,040 --> 00:10:24,420 Um we created a lot of firmware uh a lot of firmware. 81 00:10:24,420 --> 00:10:33,500 We actually we support uh if you have a look at the top uh top half of the screen, we support basically and natively 4 devices. 82 00:10:33,520 --> 00:10:40,820 Um some of them are based on Nordic Semiconductor NRF52 uh system and chips. 83 00:10:40,860 --> 00:10:45,100 Uh so basically the there is the ESP32WROOM from Espressif. 84 00:10:45,100 --> 00:10:58,280 The Nucleo WL55 which is uh uh Lora and the Sigfox uh transceiver from STMicro uh that's supported and uh also yeah I told you about the NRF52. 85 00:10:58,280 --> 00:11:09,400 But the most interesting part is that we uh managed to create some uh adaptation layer between WAD and the old tools such as the uh Yardstick one or the Herbatools. 86 00:11:09,700 --> 00:11:15,040 And in fact we we we can use all these old devices if you can say with WAD. 87 00:11:15,040 --> 00:11:17,080 And this is totally transparent for you. 88 00:11:17,080 --> 00:11:22,540 So it's uh just it appears like a classic WAD tool or WAD device and you can use it to do whatever you want. 89 00:11:24,940 --> 00:11:31,300 The WAD protocol supports a lot of uh modulations uh file layers and other protocols. 90 00:11:31,300 --> 00:11:36,420 So basically this is the FSK, GFSK, MSK modulation on the physical layer. 91 00:11:36,420 --> 00:11:40,900 Uh so you can do demodulate and modulate signals using a specific device. 92 00:11:40,900 --> 00:11:45,020 And uh obviously the BLE protocol, ZigBee and so on also support it. 93 00:11:45,060 --> 00:11:53,380 Uh based on some previous research we made, Romain and I, we also added into WAD the result of this research. 94 00:11:53,380 --> 00:11:58,120 So Romain published in uh 2021 uh the Wasabi uh attack. 95 00:11:58,120 --> 00:12:01,440 So basically this is an attack on uh well not an attack. 96 00:12:01,440 --> 00:12:14,280 This is uh just a uh a way to divert the uh radio transceiver from an NRF50 to a system and chip to to make it able to sniff and inject ZigBee packets. 97 00:12:14,460 --> 00:12:31,900 And uh last year we presented also uh some uh research at WOOD uh which is basically how to turn an ESP32 into a uh a device uh that can sniff and inject raw PDUs in Bluetooth low energy uh communication. 98 00:12:31,900 --> 00:12:36,740 So yeah this uh this is also supported in the firmware and uh in the WAD protocol. 99 00:12:36,960 --> 00:12:39,080 Not WAD protocol but WAD ecosystem. 100 00:12:39,420 --> 00:12:43,940 Uh if you want to add new protocols to this uh like Romain said it's extensible. 101 00:12:43,940 --> 00:12:49,440 So you can uh just modify the protocol and add what you need to to implement it. 102 00:12:49,440 --> 00:12:55,820 All the uh uh all the translation between these messages and so on is performed by the framework. 103 00:12:55,820 --> 00:12:59,220 And uh the protocol is versioned as well so it is Blackboard compatible. 104 00:12:59,220 --> 00:13:07,780 If you have a device with version 1 protocol version 1 it will be supported uh as well as a device with a protocol version 2 and so on. 105 00:13:07,780 --> 00:13:22,100 And uh obviously we hope that uh many hackers may want to contribute to to WAD and add new protocols we didn't think about because we maybe don't know this protocol or so on. 106 00:13:23,400 --> 00:13:27,700 Um we also design our own flexible stack model. 107 00:13:27,700 --> 00:13:34,840 So speaking of wireless protocol we provide a specific flexible stack model sorry uh that is easy to modify. 108 00:13:34,840 --> 00:13:37,800 So basically take a BLE stack. 109 00:13:37,800 --> 00:13:42,900 You can just swap uh a specific layer and replace it with your one with your own. 110 00:13:42,900 --> 00:13:47,720 You can develop your own stack layer and replace it in a in the stack. 111 00:13:47,720 --> 00:13:55,340 So basically you can implement some very specific behavior if you want to test some uh unexpected uh behavior this is a way to to do. 112 00:13:55,380 --> 00:14:01,600 Uh there is a complete stack snapshot that is implemented from scratch uh in the in this model. 113 00:14:01,600 --> 00:14:09,240 So for each every protocol supported every protocol stack we got in WAD you can do at any time a snapshot of the old stack. 114 00:14:09,240 --> 00:14:16,780 Uh save this snapshot on the on your disk and reload this snapshot later if you want to test uh something on this uh this framework. 115 00:14:16,780 --> 00:14:25,260 And also this uh older flexible stack model uh makes uh writing unique tests very easy because you can just isolate a layer. 116 00:14:25,280 --> 00:14:31,900 Send inputs and check what outputs uh came and if it uh what you are expected from this layer. 117 00:14:32,580 --> 00:14:38,040 And um in WAD actually we provide uh multiple protocol stack. 118 00:14:38,040 --> 00:14:41,540 Uh BLE for version 4, version 5 is on its way. 119 00:14:41,540 --> 00:14:48,200 Uh Logitech Unifying, uh NShark Burst from Nordic, ZigBee, RF um RFOC, and LoRaWAN. 120 00:14:48,200 --> 00:14:57,920 So all these stacks have been uh implemented from scratch and are flexible in a way that you can make the stack behave the way it's not really expected by the specifications. 121 00:14:57,940 --> 00:15:04,720 So this uh allows uh security research uh if you want to try uh unexpected ways to to go through the stack. 122 00:15:04,720 --> 00:15:09,960 And uh if you want just want to use the protocol as well you can just use them and it works as expected. 123 00:15:09,960 --> 00:15:21,320 So this is uh this is why Romain said it was made for uh secure cyber security specialists, researchers, and also uh just uh enthusiast, wireless protocol enthusiast, or just user. 124 00:15:21,400 --> 00:15:29,880 Um and uh we also love KISS uh not the uh rug band uh obviously but the keep it simple stupid uh principle. 125 00:15:29,980 --> 00:15:40,720 And WAD provides a set of simple common tools and um a mean to combine them uh to combine all these tools into uh in order to create more complex tools. 126 00:15:41,160 --> 00:15:46,860 Uh and we also provide some full feature tools for those who want to just to experiment with uh a protocol . 127 00:15:46,940 --> 00:15:54,540 And um yeah if you're a newcomer in wireless protocol exploitation or or just if you want to play with some protocol you we got you covered. 128 00:15:56,140 --> 00:16:00,520 Uh just to give you an an idea of what's going on with WAD and this uh KISS principle. 129 00:16:00,820 --> 00:16:11,240 Um I don't know if it's really readable in the screen but uh basically we are using uh a first program called WBD connect to initiate a WBD connection into a device. 130 00:16:11,380 --> 00:16:16,600 Then there is a pipe with a W-shark which is a uh wrapper for Wireshark. 131 00:16:16,600 --> 00:16:25,220 And then another pipe with WBD central profile and basically what this command does is just tells what to first initiate a connection to the device. 132 00:16:25,460 --> 00:16:31,100 Then to ask uh the the device it's a BAD services and characteristics. 133 00:16:31,100 --> 00:16:35,180 So it's basically an enumeration performed by the uh WBD central. 134 00:16:35,320 --> 00:16:44,400 And every packet sent between the connection and the uh central which is a GATT client is monitored by Wireshark in real time. 135 00:16:44,840 --> 00:16:48,280 And you can compose all the tools this way. 136 00:16:48,280 --> 00:16:50,320 You create a processing packet chain. 137 00:16:50,560 --> 00:16:53,020 Uh yeah that's it. 138 00:16:53,020 --> 00:16:53,400 I don't know. 139 00:16:53,400 --> 00:16:55,300 Maybe I I get it wrong. 140 00:16:55,300 --> 00:17:00,100 But um you create a chain of uh of packet processing and you can do whatever you want. 141 00:17:00,100 --> 00:17:02,800 We are going to show you some other tool we developed. 142 00:17:02,800 --> 00:17:11,940 And it allows some yeah some a lot of flexibility you know in the um what can be done with this uh this uh these things. 143 00:17:11,940 --> 00:17:19,340 And obviously we also created in the framework a lot of uh um wrappers for creating uh command line applications. 144 00:17:19,340 --> 00:17:29,480 So if you need to create some command line tools or do your own tools, you you got everything you need to um wrap the connection to the hardware and so on. 145 00:17:31,240 --> 00:17:32,360 Yep. 146 00:17:32,760 --> 00:17:33,980 Uh the clicker. 147 00:17:33,980 --> 00:17:34,940 Yeah. 148 00:17:34,940 --> 00:17:37,480 So uh I'm going to start with the first demo. 149 00:17:37,480 --> 00:17:43,080 This is uh we we got uh 13 demos to to show you what what is capable of. 150 00:17:43,200 --> 00:17:46,700 Uh so the first one is the BLE exploring demo. 151 00:17:46,700 --> 00:17:52,380 So basically we are I'm going to to show you the WBD central tool. 152 00:17:52,380 --> 00:17:52,980 So this is the WBD central. 153 00:17:52,980 --> 00:18:06,940 This is basically uh a GATT client and uh and what I'm going to do here is to scan devices, connect to the device, a specific device, in a way so this is BLE services and characteristics and return what's on data from this. 154 00:18:06,940 --> 00:18:09,000 So I guess nope. 155 00:18:09,440 --> 00:18:15,220 Okay so the setup is just should be this one. 156 00:18:19,220 --> 00:18:23,660 So basically we launch a scan using WBD central. 157 00:18:23,660 --> 00:18:26,860 We are using uh an HCI adapter for BLE. 158 00:18:26,860 --> 00:18:32,820 We can get all the information, all the advertising records sent by the uh the device. 159 00:18:32,820 --> 00:18:38,420 Once you found your your device or target device you can connect to it through the connect command. 160 00:18:38,420 --> 00:18:41,440 So this is an interactive shell provided by WBD central. 161 00:18:41,440 --> 00:18:48,800 Then the connection is made and we uh launch a profile command to start enumerating services and characteristics. 162 00:18:48,800 --> 00:19:01,100 We can find uh we have found a device name characteristic uh and a manufacturer name characteristics in two different services and we're going to read the content of this characteristics using a read command. 163 00:19:01,100 --> 00:19:07,360 And we get everything and uh we can also write into characteristics and subscribe for notification. 164 00:19:07,360 --> 00:19:09,900 The basics a GATT client can do. 165 00:19:09,900 --> 00:19:14,020 Oh this is for the next demo. 166 00:19:14,160 --> 00:19:20,260 So basically this is just an example of a full feature tool uh in WAD and this is a very basic one. 167 00:19:35,310 --> 00:19:53,130 So uh second uh full feature tool we developed uh is a tool named uh ZigBee and device uh that will allow us to interact with uh ZigBee networks uh and uh emulate basically a ZigBee and device. 168 00:19:53,130 --> 00:20:16,770 So thanks to this tool you will be able to detect uh the surrounding ZigBee networks uh to join a specific network uh perform all the cryptographic operation this kind of stuff and get the network key uh associated with the network enumerate the devices on the network and interact uh with the various ZigBee devices. 169 00:20:16,990 --> 00:20:28,510 So uh here you have a small demo showing a small ZigBee network uh on the camera and you have an example of the use of this tool. 170 00:20:28,510 --> 00:20:34,470 So first we perform a scan operation to discover the surrounding networks. 171 00:20:34,510 --> 00:20:44,250 So it takes some time but uh finally uh we can see that we have one uh ZigBee network. 172 00:20:44,250 --> 00:21:01,670 So let's join uh this network and perform the association procedure so we are able to see the network key and now we are associated and we can uh interact and discover the nodes in the networks and the endpoints for every nodes. 173 00:21:02,650 --> 00:21:23,630 So then uh we have a list of clusters that allows us to uh interact with uh the nodes and we can use the cluster command to toggle uh a light bulb for example uh to get it off and so on. 174 00:21:52,180 --> 00:22:04,220 So sorry uh we have also uh another tool named what sniff which is a generic tool so it's a multi-protocol sniffing tool. 175 00:22:04,220 --> 00:22:22,860 Uh so what sniff uh works with all uh the protocols that are supported uh by WAD so ZigBee, BLE, RFC, you can even uh directly sniff uh PHY uh so uh physical layer um configured as you want. 176 00:22:22,860 --> 00:22:36,040 Uh it provide different uh output formats so you can directly display the SCAPI packets uh with the different fields uh correctly dissected uh or directly a next dump uh version of the packet. 177 00:22:36,040 --> 00:22:46,220 Uh and it allow to uh when it was a traffic and do value stuff like exporting data to a PCAP uh when it's a ring uh with Wireshark. 178 00:22:46,220 --> 00:22:55,320 So here you have uh some uh basic uh use cases of uh what sniff. 179 00:22:55,320 --> 00:23:02,520 So here we are going uh to uh display uh some BLE advertisements. 180 00:23:02,520 --> 00:23:07,980 So here you can see the SCAPI uh representation. 181 00:23:08,880 --> 00:23:16,800 Then we can switch the formats to xdump and so here we have the xdump version of our packets. 182 00:23:17,620 --> 00:23:29,020 We can uh also uh collect these uh packets using uh uh directly the physical uh layer of Bluetooth energy. 183 00:23:29,020 --> 00:23:33,600 So we provide the modulation, Gaussian frequency shift scaling, then the deviation. 184 00:23:34,700 --> 00:23:44,340 Uh we provide the frequency uh and uh uh finally the size uh of the packets. 185 00:23:44,340 --> 00:23:50,000 And here we get a raw dump uh straight out the demodulator output. 186 00:23:50,000 --> 00:23:54,300 So uh it can be useful for specific analysis. 187 00:23:55,500 --> 00:24:12,660 And uh uh finally we can also uh for with this what sniff tool uh directly export the traffic to uh PCAP for further analysis. 188 00:24:12,660 --> 00:24:19,440 So here all the traffic is simultaneously displayed on the screen and exported to PCAP. 189 00:24:36,800 --> 00:24:46,100 So uh an interesting uh feature uh of WAD is that you can combine uh several tools uh with pipes. 190 00:24:46,140 --> 00:24:50,900 So what sniff can be chained with uh several tools. 191 00:24:50,900 --> 00:24:59,640 So for example you can uh use what filter that uh may allow to apply some filtering uh on the received packets. 192 00:24:59,640 --> 00:25:07,380 Uh you can transform uh the packets on the fly uh if it matches a specific filter. 193 00:25:07,380 --> 00:25:19,920 Or you can also use some tools like uh WAD extract uh that may allow to extract uh a specific uh field uh from the packets. 194 00:25:20,000 --> 00:25:23,920 So let's go uh for an example of that. 195 00:25:23,920 --> 00:25:27,760 So here it's uh the same example with what sniff. 196 00:25:28,620 --> 00:25:33,880 And uh we are going to pipe uh what sniff with uh what filter. 197 00:25:34,000 --> 00:25:41,120 And in what filter we are going to provide a filter to keep only a specific kind of other types of packets. 198 00:25:41,120 --> 00:25:43,020 So the add and packets. 199 00:25:43,600 --> 00:25:50,180 And finally if we want uh to extract a specific field we can use uh WAD extract. 200 00:25:50,220 --> 00:25:53,480 We provide the field we want to extract. 201 00:25:53,480 --> 00:25:56,040 So here is the bid address. 202 00:25:56,040 --> 00:26:01,540 And we also export a part of the metadata so the RSSI. 203 00:26:01,880 --> 00:26:09,680 And of course you can then grab this output and provide it uh to classical Unix tool. 204 00:26:10,820 --> 00:26:22,040 So uh what sniff uh has a lot of uh usage and it may even allow to perform uh some uh complex uh attacks. 205 00:26:22,040 --> 00:26:32,000 So typically uh in this demo we are going to attack an RF4C communication between a remote uh controller and a setup box. 206 00:26:32,000 --> 00:26:39,840 So uh typically RF4C is a lightweight variant uh of ZigBee for remote controller. 207 00:26:39,840 --> 00:26:46,580 So here you have a setup uh with the remote controller on one side and what sniff on the other side. 208 00:26:47,060 --> 00:26:52,620 So here we are performing a pairing with the remote controller. 209 00:26:53,200 --> 00:26:59,940 And uh what sniff has been configured to automatically perform a brute force uh attack. 210 00:26:59,980 --> 00:27:13,820 And so in the input you can notice that the key uh has been uh automatically uh derived and extracted from the communication. 211 00:27:13,820 --> 00:27:21,580 And the packet uh which is uh normally encrypted can be uh decrypted uh on the fly. 212 00:27:21,580 --> 00:27:30,180 So it allows to sniff the various buttons that are pressed on the remote control. 213 00:27:32,020 --> 00:27:46,160 And uh it uh can also sniff the audio stream which can be transmitted uh using the mic of the remote controller. 214 00:27:46,500 --> 00:27:55,160 And uh uh we can even export uh the voice command. 215 00:27:57,940 --> 00:28:05,160 To a bad uh uh WAV file but yeah it's working. 216 00:28:09,360 --> 00:28:14,880 So uh next demonstration is about uh using Wireshark to sniff uh some traffic. 217 00:28:14,880 --> 00:28:21,520 So basically uh we showed this uh a bit earlier but uh we're going to go a bit deeper in this uh demo. 218 00:28:21,520 --> 00:28:24,320 So uh we can monitor everything with WShark. 219 00:28:24,320 --> 00:28:39,100 So this example is about BLE but it's if it could be ZigBee or even your if your if you are trying to demodulate packets through the through the file layer you can get it in Wireshark in real time and you can monitor everything you're working on. 220 00:28:39,100 --> 00:28:46,880 If you're uh use WFilter to modify your packet on the fly you can see the result in real time with the DWShark. 221 00:28:47,920 --> 00:28:49,940 So uh the demo is the following. 222 00:28:49,940 --> 00:28:53,320 I'm going to be very quick about this one. 223 00:28:54,220 --> 00:29:04,940 Yeah so basically we are again connecting to a device and so on and performing uh um uh services and characteristics is imminent uh enumeration. 224 00:29:04,980 --> 00:29:13,760 And uh everything uh can be monitored uh in Wireshark while the terminal shows you the uh results of this uh of this operation. 225 00:29:13,760 --> 00:29:17,100 So this is basically uh what WShark can do. 226 00:29:17,100 --> 00:29:24,180 And the most interesting thing is that uh we talked about uh Gatacore and BTDJuice at the beginning of the talk. 227 00:29:24,180 --> 00:29:33,640 So basically these tools are based on not on some Node.js uh library uh which are not no more maintained at the moment. 228 00:29:33,640 --> 00:29:42,900 So if you want to perform a man-in-the-middle attack on BLE with WAD this is very simple because you can combine tools. 229 00:29:42,900 --> 00:29:49,280 You can create for instance if you want to you know set up a man-in-the-middle attack on a device uh like Gatacore. 230 00:29:49,280 --> 00:30:00,200 You uh just create a command line starting with WBAD-spawn that will spawn a device with the corresponding parameters that will mimic the target device. 231 00:30:00,200 --> 00:30:08,000 And then you can pipe all the packets that will go uh from the this uh fake device or spoof device into Wireshark. 232 00:30:08,000 --> 00:30:10,260 You can so you can monitor in real time what's going on. 233 00:30:10,260 --> 00:30:20,600 And then uh once the smartphone for instance is uh is connected onto the spoof device uh then you are going to initiate a connection into the target device. 234 00:30:20,600 --> 00:30:31,160 And every packet sent by the smartphone uh or the target or the target device will be uh just forwarded as uh uh as it goes. 235 00:30:31,160 --> 00:30:32,980 And you can monitor everything in WShark. 236 00:30:32,980 --> 00:30:36,160 So this is uh the next demo I'm going to show you. 237 00:30:36,160 --> 00:30:44,100 Uh here so we are setting up uh Gatacore-like man-in-the-middle attack using uh WAD. 238 00:30:44,100 --> 00:30:46,780 Using simple tools again WBAD-spawn. 239 00:30:46,780 --> 00:30:49,400 This is a very small tool like WBAD-connect. 240 00:30:49,400 --> 00:30:59,940 And um we first the system is going to spawn a spoof device that just advertise itself like the target device. 241 00:30:59,940 --> 00:31:03,800 And the smartphone uh here is going to detect this device. 242 00:31:03,800 --> 00:31:12,500 When we initiate the connect when we push the connect button on the on the smartphone then the connection to the our spoof device is uh initiated. 243 00:31:12,500 --> 00:31:16,120 We can see on Wireshark what's going on with the BLE PDUs. 244 00:31:16,180 --> 00:31:25,460 And if you really try to read the characteristics for instance then all the PDUs are directly forwarded to the target device and back and forth and we can monitor everything. 245 00:31:25,580 --> 00:31:27,620 With Wireshark you can see what's going on. 246 00:31:27,620 --> 00:31:29,800 You can save it at the as a backup. 247 00:31:30,040 --> 00:31:40,180 And what we do here with Wireshark you can do it with any other generic tool we develop such as WFilter or WX well not WX but WFilter. 248 00:31:40,180 --> 00:31:46,220 And you can if you want make some changes into the packets using some specific filters. 249 00:31:46,220 --> 00:31:53,860 If you want to modify the answer uh the um response uh from a read operation on the characteristics you can do it on the fly. 250 00:31:53,860 --> 00:31:58,420 And you can also monitor what's going on because you can pipe WFilter with WShark as well. 251 00:31:59,260 --> 00:32:04,720 So this this is powerful even if this demo is not uh really powerful but yeah. 252 00:32:04,860 --> 00:32:05,900 Anyway. 253 00:32:06,420 --> 00:32:13,000 And if you want to emulate a BLE peripheral you can you can use uh the full feature of WBLE Perif. 254 00:32:13,000 --> 00:32:15,020 Uh so basically it goes like this. 255 00:32:15,040 --> 00:32:22,960 This is a command line tool you can use to just uh spawn a BLE device and populate the device with whatever you want. 256 00:32:22,960 --> 00:32:28,260 So basically you can change the name of the device and say that I'm going to create a device called Defcon32. 257 00:32:28,680 --> 00:32:31,840 Uh add a service and a characteristic to the device. 258 00:32:32,360 --> 00:32:36,680 Um I'm going to write the value of this characteristic as well. 259 00:32:36,680 --> 00:32:38,840 It should be Defcon32 I guess. 260 00:32:38,840 --> 00:32:44,040 And then uh I'm going to start a device on the uh right hand side of the screen. 261 00:32:44,040 --> 00:32:46,400 You got the uh screen of the smartphone. 262 00:32:47,420 --> 00:32:51,580 So let's start this uh spoof device or emulated device to be more precise. 263 00:32:51,580 --> 00:32:54,240 Uh yeah come on. 264 00:32:55,220 --> 00:33:01,640 Okay so it will pop on uh the um smartphone and we can connect to it. 265 00:33:01,780 --> 00:33:06,560 Um it will start the discovery process of services and characteristics. 266 00:33:06,560 --> 00:33:10,120 There is a single service with a single characteristic. 267 00:33:10,140 --> 00:33:12,320 And we can read the content. 268 00:33:12,320 --> 00:33:18,660 Each time we read from the smartphone the content of this characteristic this is caught by the BLE PRF uh tool. 269 00:33:18,660 --> 00:33:25,800 And uh if uh the smartphone subscribe to notification then it got nothing notified by the uh the system and so on. 270 00:33:25,800 --> 00:33:39,320 So this is a good way to play with uh uh applications and BLE applications to mimic some device if you want to see what happens when you are modifying some uh some properties of this uh of this device. 271 00:33:39,720 --> 00:33:50,960 Uh uh in practical situation this is not what we are going to use because it's uh you know just uh uh interesting when you want to play uh with uh a device. 272 00:33:50,960 --> 00:33:53,980 But uh a more interesting use is the following. 273 00:33:53,980 --> 00:34:01,800 Uh if you want to implement a very specific device with specific services and characteristics with a specific behavior for the characteristics here are a small example. 274 00:34:01,800 --> 00:34:05,660 We are going to create a battery device exposing your battery service with a battery level. 275 00:34:06,160 --> 00:34:12,060 Except that each time we are going to read the battery level we will decrease the level by 10%. 276 00:34:12,060 --> 00:34:17,060 And it goes like this when you emulate this uh peripheral. 277 00:34:17,720 --> 00:34:23,040 So basically uh we start the Python script that uh instruments everything. 278 00:34:23,040 --> 00:34:26,300 The device appears on the screen so there is a battery device. 279 00:34:26,300 --> 00:34:32,620 When the discovery goes with the services and characteristics we get one service with one battery level characteristics. 280 00:34:32,620 --> 00:34:40,580 And each time I read the characteristic value getting the percentage of uh battery level percentage then it is decreased. 281 00:34:40,580 --> 00:34:43,460 So this is just 10 lines of Python to do this. 282 00:34:47,460 --> 00:34:52,240 And uh we did the same with other protocols because we are talking a lot about BLE. 283 00:34:52,240 --> 00:34:55,200 Uh we got a lower one gateway implemented in WAD. 284 00:34:55,200 --> 00:35:05,640 So if you want to create a lower one network and get some device uh to associate with this uh with this uh fake network you can do it and it works pretty well. 285 00:35:05,640 --> 00:35:10,620 Uh I guess the demo will be a nightmare on the screens so I will skip it. 286 00:35:11,380 --> 00:35:20,360 Um but the media server of DEF CON has this uh has this demo so if you want to have a look at it uh please do. 287 00:35:20,560 --> 00:35:22,860 But uh I'm going to still skip this one. 288 00:35:22,860 --> 00:35:25,460 Uh and let Romain explain the rest. 289 00:35:25,890 --> 00:35:26,700 Yeah. 290 00:35:26,700 --> 00:35:38,860 So uh another uh example of what you can do uh with uh WAD is uh the emulation of various uh devices. 291 00:35:38,860 --> 00:35:57,460 And for example uh you can take a proprietary protocol like Logitech Unifying and you have a protocol stack which is implemented and various tools that will allow to uh perform uh a keyboard emulation, a mouse emulation uh for Logitech Unifying devices. 292 00:35:57,460 --> 00:36:05,600 So typically here we are going to use it to perform a scan uh operation of uh surrounding Unifying devices. 293 00:36:05,680 --> 00:36:09,920 Uh spoof uh the address of uh mouse. 294 00:36:09,920 --> 00:36:20,430 And then we are going to emulate the keyboard with this address to reproduce a vulnerability uh from mouse jack to inject an encrypted keystrokes to the computer. 295 00:36:20,920 --> 00:36:32,120 So here we start by uh using a small command line tool to perform a scan operation. 296 00:36:32,120 --> 00:36:44,180 It allows us to get the address of a mouse and we provide it uh in uh as argument of a Python script that will perform the injection. 297 00:36:44,180 --> 00:36:51,640 And as you can see uh we have a keystroke injection uh performed and fully emulated by WAD. 298 00:36:53,860 --> 00:36:54,720 Yeah. 299 00:36:54,720 --> 00:36:58,440 So you can see a lot of code written. 300 00:37:04,230 --> 00:37:09,390 So uh we can uh emulate a Logitech Unifying keyboard. 301 00:37:09,390 --> 00:37:13,330 We can also emulate a Logitech Unifying uh dongle. 302 00:37:13,590 --> 00:37:22,590 Uh and uh on the other uh side on BLE we are able to emulate a peripheral. 303 00:37:22,590 --> 00:37:41,610 So here comes a very useless idea which is to uh create a bridge uh which is cross protocol between a Logitech Unifying uh keyboard for example and a smartphone uh that will be connected to an emulated uh BLE keyboard. 304 00:37:41,990 --> 00:37:45,010 So uh we have a small script. 305 00:37:45,010 --> 00:37:55,970 You can see the screen uh of the smartphone and uh you can see uh a video with the keyboard uh at the bottom. 306 00:37:55,970 --> 00:37:59,970 So first we connect uh we emulate the BLE keyboard. 307 00:37:59,970 --> 00:38:06,090 We connect and pair the smartphone uh with this uh emulated BLE keyboard. 308 00:38:10,760 --> 00:38:30,740 And once the pairing uh is uh successful, now we can just press some key on the Logitech Unifying keyboard and it will be forwarded uh through the uh BLE emulated keyboard to the smartphone. 309 00:38:30,980 --> 00:38:33,100 So yeah. 310 00:38:33,100 --> 00:38:35,680 Completely useless but funny. 311 00:38:36,640 --> 00:39:00,460 And finally, our last demo uh is uh uh based on the idea that it's uh cool that WAD allows to uh access various hardware uh perform uh different operations uh but it would be even cooler if you could access it over internet. 312 00:39:00,460 --> 00:39:08,360 So uh we wrote uh a WAD server that will allow uh you to expose a WAD device uh over TCP. 313 00:39:08,780 --> 00:39:21,020 And so uh with any tool, any script, you will be able to connect uh to this WAD uh TCP server uh like if it was a local device. 314 00:39:21,400 --> 00:39:27,440 And uh for example, it can be useful to build relay attacks and that kind of stuff. 315 00:39:28,000 --> 00:39:37,260 So as uh in this next demo, so we are in two different uh cities in France. 316 00:39:37,340 --> 00:39:44,620 And I'm exposing uh my uh Bluetooth dongle uh using WAD server. 317 00:39:45,140 --> 00:39:57,420 Damien will use uh BLE central to connect to uh this uh remote devices and is able to connect to the light bulb next to me. 318 00:39:58,080 --> 00:40:01,240 Perform a profile uh discovery. 319 00:40:02,040 --> 00:40:18,000 And uh now he will be able to uh turn the light bulb on, turn the light bulb off, and modify uh the color. 320 00:40:18,240 --> 00:40:24,560 So typically uh it's interesting uh for building relay attacks. 321 00:40:24,560 --> 00:40:29,160 It can be interesting in various experiment uh setups. 322 00:40:29,380 --> 00:40:30,800 So sky is the limit here. 323 00:40:31,240 --> 00:40:38,580 Yeah uh and the interesting part here is yeah again we show it with BLE, but it can be done with any protocol as well. 324 00:40:38,580 --> 00:40:46,860 You can uh accept the Logitech unifying because you have some keep-alives that are messed up with the network. 325 00:40:46,860 --> 00:40:51,780 But in fact, you can once you are connected to a device, you can just discover everything. 326 00:40:52,500 --> 00:40:58,120 Yeah just like uh yeah it's the same if you connect the device on your computer. 327 00:40:58,120 --> 00:41:01,780 So basically it opens a wide range of possibility. 328 00:41:06,340 --> 00:41:14,520 So uh we are developing this project uh since a few years now. 329 00:41:14,520 --> 00:41:24,520 And uh it has been used uh internally so in Damien's company and in my research lab. 330 00:41:24,520 --> 00:41:45,560 So for example, one intern at Quark's lab, Baptiste Boyer, developed a BLE GAT fuzzer using WAD that leads to a CV linked to the expressive controller expressive BLE stack, sorry. 331 00:41:45,620 --> 00:41:55,620 And we also used it in a research project uh to evaluate the screaming channel attacks. 332 00:41:55,620 --> 00:42:04,020 So it allowed us to instrument the BLE protocol with custom link layer traffic. 333 00:42:04,020 --> 00:42:11,280 It's also a project which is already heavily used in some hardware CTFs. 334 00:42:11,280 --> 00:42:21,340 So for example, this year's edition of hardware IO, all the BLE challenges were fully emulated with WAD. 335 00:42:21,340 --> 00:42:28,080 And WAD has also been used in a lower one challenge to emulate a lower one gateway. 336 00:42:29,000 --> 00:42:38,820 So to conclude this talk, we are releasing today publicly this project. 337 00:42:38,820 --> 00:42:41,720 So it's available on pip. 338 00:42:41,720 --> 00:42:46,420 The documentation is available on read.docs. 339 00:42:46,420 --> 00:42:52,920 So we are going to improve the documentation and the project over time. 340 00:42:52,920 --> 00:42:55,660 Feel free to contribute to it. 341 00:42:55,660 --> 00:43:05,040 We have also the firmware files that are available on GitHub in some sub repositories. 342 00:43:05,040 --> 00:43:11,580 And globally, all the code is available on GitHub under MIT license. 343 00:43:11,580 --> 00:43:20,700 So of course, we also are making a call for contributors. 344 00:43:20,700 --> 00:43:33,260 So feel free to create compatible firmwares for your preferred hardware to report any bugs, any issues you would encounter on GitHub. 345 00:43:33,260 --> 00:43:45,120 And if you want to help us by writing some documentation, by adding support for other protocols or other devices, we would be happy to have contributors. 346 00:43:45,880 --> 00:43:50,660 And if you like it, spread the word and tell your friends. 347 00:43:51,400 --> 00:43:53,860 So two last words. 348 00:43:53,860 --> 00:43:58,600 So this is a work we initiated two years ago. 349 00:43:58,680 --> 00:44:03,040 And here it was a very high-level presentation. 350 00:44:03,040 --> 00:44:08,060 So we only scratched the surface of what WAD is capable of. 351 00:44:08,060 --> 00:44:22,680 And we also want to warmly thank the many researchers that have beta access to this project and that helped us and provided some feedback on it. 352 00:44:22,680 --> 00:44:26,120 So I won't name them all, but they know. 353 00:44:26,520 --> 00:44:28,560 Thank you very much. 354 00:44:28,720 --> 00:44:32,680 And sorry for the small technical issues. 355 00:44:32,680 --> 00:44:34,500 We are ready if you have any questions.