[00:00.000 --> 00:06.740] All the way from France. One for all and all for WHD, wireless shenanigans made easy. [00:06.740 --> 00:10.080] Please welcome to the stage Damien and Roman. [00:13.610 --> 00:14.930] Hello DEF CON! [00:17.190 --> 00:23.410] Okay so this is uh last talk for today on this track and we are going to present you uh [00:23.410 --> 00:30.110] something we've been working on uh since more than two years now and this is what? [00:32.470 --> 00:41.210] Oh as usual. Okay so uh let me introduce ourselves. I'm Damien, Damien Coquille from Quarkstab. [00:41.210 --> 00:46.690] I'm the maintainer of a tool called BTE Jack or Beto Jack, call it what you want. [00:46.690 --> 00:53.090] Uh this is a BLE Swiss Army tool and uh I love reversing stuff as well on embedded systems. [00:53.090 --> 00:59.230] And this is Roman, the maintainer of Mirage, another BLE Swiss Army tool. But not only BLE [00:59.230 --> 01:05.150] does ZigBee and some other protocol as well. And uh he loves cross protocol attacks and we are [01:05.150 --> 01:13.310] going to talk a bit uh about this later in the talk. So what is what and why we had to create [01:13.310 --> 01:19.490] this uh framework? So basically wireless tools are a mess. A lot of researchers did a lot of [01:19.490 --> 01:24.670] research on wireless protocols and they create a lot of tools. Different tools with different [01:24.670 --> 01:29.430] protocols and different devices and different firmwares. Uh each firmware communicates with [01:29.430 --> 01:36.190] the host or computer with a specific protocol designed by each person. And basically everyone [01:36.190 --> 01:44.070] revents the wheel because why not? And if you are into, yep, if you are into wireless protocol [01:44.070 --> 01:50.350] hacking, you may have to use a lot of different tools. So for BLE, the classic tools, BTD, [01:51.110 --> 01:58.070] Mirage, uh Gattacurl, SniffID, uh are the best way to to capture information and test some [01:58.070 --> 02:05.410] devices. And in the end, you end up with a lot of devices. So if you want to be able to tackle [02:05.410 --> 02:12.050] with all these protocols, you need to buy at least all of these. And the problem is um that it [02:12.050 --> 02:18.030] takes a lot of space. It costs a lot uh as well. And most of this hardware uh can be [02:18.030 --> 02:23.950] discontinued at any time. So if you want to to hack some wireless protocol, there is this tiny [02:23.950 --> 02:29.650] hardware you didn't buy 2 years ago. And it's the only hardware that is supported for hacking [02:29.650 --> 02:35.130] this specific protocol. So that's uh that's a shame. And basically this is just a waste of [02:35.130 --> 02:39.890] time. And because uh you need to create a different uh each researcher create different [02:39.890 --> 02:47.450] firmware and uh um each researcher or each person trying to hack a wireless protocol uh is [02:47.450 --> 02:51.810] going to face the same issues other people have already had before and uh with the same [02:51.810 --> 02:57.530] solution as well. And uh all of this in fact creates fragmentation. And uh this is uh this is [02:57.530 --> 03:10.560] not good for us uh this kind of fragmentation. So we uh talked a lot together and uh we try to [03:10.560 --> 03:19.080] find a solution to solve this fragmentation issue. So uh it leads us to uh come with a [03:19.080 --> 03:28.680] three main ideas. So uh the first one uh would be to design uh communication protocol for the [03:28.680 --> 03:34.780] communication between the host and uh the other world that would be extensible. And either [03:34.780 --> 03:39.880] these that would support multiple wireless protocols, multiple physical layers uh at the same [03:39.880 --> 03:48.840] time. And of course uh that could be open source and easy to extend. Uh the second uh big idea [03:49.080 --> 03:57.340] uh would be to uh create a set of libraries, a framework, and basically a world ecosystem uh that [03:57.340 --> 04:05.620] will allow uh some use of uh values uh ready to use features for different hardware, different [04:05.620 --> 04:14.780] platforms. And that would be available both for the host and the firmware. And uh the third main [04:14.780 --> 04:23.240] uh idea we came with is uh that for uh these two works uh it must uh from the beginning [04:23.240 --> 04:30.940] encourage the interoperability and the collaboration between the researchers. So uh it motivated us [04:30.940 --> 04:38.860] to build everything as open source software and to uh evenly document both the use uh of the tools [04:38.860 --> 04:52.820] but also uh its design. So uh here comes the main uh part uh of WAD for this project, which is the [04:52.820 --> 05:00.480] WAD protocol. So we have several guidelines that have motivated uh its development. So first uh [05:00.480 --> 05:07.680] it's a standardized protocol so we we properly defined it. Everything uh is uh documented and [05:07.680 --> 05:17.400] explained. It's uh generic so it covers uh a set of wireless capabilities that are uh already uh in [05:17.400 --> 05:25.480] the ecosystem. It's modular so you can support multiple uh wireless protocols. Uh and uh if you [05:25.480 --> 05:31.700] want to add more and put your own, it's a protocol which is evolutive. So the protocol has been [05:31.700 --> 05:41.200] designed to be easily extended and improved over time. And finally uh we also tried to make it as user [05:41.200 --> 05:49.040] friendly as possible. So uh we developed a set of C, C++, and Python parsing libraries uh allowing to [05:49.040 --> 06:00.380] facilitate uh its integration into uh your framework uh and so on. So another uh key uh idea behind WAD [06:00.380 --> 06:09.420] is uh to offload most of the complexity from the firmware side to the uh outside. So of course on the [06:09.420 --> 06:17.520] firmware side we have some CPU uh some memory limitations. And so the idea was uh to keep only uh [06:17.520 --> 06:26.260] what is uh needed. So some atomic uh wireless primitives uh as basic as possible. Uh and of [06:26.260 --> 06:32.140] course the operations that are time critical and that could not be offloaded to the host. So for [06:32.140 --> 06:39.120] example the channel opening, this kind of stuff. So we keep uh a minimal logic in the firmware and all [06:39.120 --> 06:47.100] the attack, the protocol stacks, the packet detectors and so on are implemented on the host. So [06:47.100 --> 06:55.440] finally uh WAD has been designed uh not only uh for hackers, if any, if we are in a hacker [06:55.440 --> 07:03.140] conference, but uh also for uh everyone. So if you are a security researcher uh you can use it. If you [07:03.140 --> 07:12.300] are just a wireless uh enthusiast and you want to control uh your IoT devices uh or if you are just a [07:12.300 --> 07:18.960] curious user and you want to understand how uh your favorite wireless toy works. [07:22.000 --> 07:28.820] Alright so uh what is WAD in fact? Uh Romain introduced the main concept behind this uh this [07:28.820 --> 07:34.820] framework but in fact uh technically uh first the name because you know when you start a project you [07:34.820 --> 07:40.560] get you got to find a name and it's always a pain in the ass to find something yeah meaningful. Uh [07:40.560 --> 07:46.100] so WAD stands originally for Wireless Hacking Devices because it was uh supposed to support a lot [07:46.100 --> 07:52.960] of wireless uh so a lot of devices to hack into wireless protocols and after having used this [07:52.960 --> 08:00.440] projects uh during more than a year uh yeah wireless hacking for them is also a great name because [08:00.440 --> 08:07.020] it's uh makes things easier and we are going to show that in multiple demos. Uh like Romain said [08:07.020 --> 08:11.900] it's more than a protocol uh because designing a protocol, a communication protocol between a host [08:11.900 --> 08:18.020] and a device that's a thing and this is something uh we we already did uh two of us uh for our [08:18.020 --> 08:24.900] respective tools but in fact providing uh uh an ecosystem with uh the protocol all libraries in Python [08:24.900 --> 08:30.800] and in C and C++ that you can embed in your firmware and use to communicate with the host without [08:30.800 --> 08:38.120] having uh you know uh without worrying about how the data is encoded and so on. This is uh this is a [08:38.120 --> 08:45.420] lifesaver. Uh you when you develop a firmware compatible with this uh ecosystem you the only thing [08:45.420 --> 08:50.920] you need to worry about is the specific code that runs and that handles all the radio frequency [08:50.920 --> 08:57.800] stuff. And uh also we provide a lot of tools uh command line interface tools and uh maybe some are [08:57.800 --> 09:05.400] more evolved and provide more features. But if you want to create your own applications based on a web [09:05.400 --> 09:11.660] on this ecosystem you can do uh as do it as well. And you can just use the Python client library and [09:11.660 --> 09:18.060] use it uh yeah. It's very simple to to develop something. From the protocol perspective it's based [09:18.060 --> 09:25.080] on protocol buffers so yeah no surprise here. And um the protocol has been thought uh in a way that [09:25.080 --> 09:33.740] the uh host can query the device uh about what uh the devices or capabilities are. So basically each [09:33.740 --> 09:40.060] device compatible device can announce itself to the uh wild ecosystem and especially to the host [09:40.060 --> 09:46.340] telling okay I I support this protocol uh I can do this with this protocol packet injection or just [09:46.340 --> 09:54.200] sniffing scanning anything. And the host adapts uh the the tools based on the uh capabilities [09:54.200 --> 09:59.340] announced by the device. And this is a discovery protocol that has been included in wild and uh [09:59.340 --> 10:04.720] this one is mandatory for any device. Uh you can have uh uh some hardware on the ZigBee protocol [10:04.720 --> 10:13.220] and the BLE or or even just modulation modulation and demodulation as well. Uh but in fact you can [10:13.220 --> 10:18.400] have some you can have multiple protocols supported by a single device with using this uh this [10:18.400 --> 10:27.360] system. Um we created a lot of firmware uh a lot of firmware. We actually we support uh if you have a [10:27.360 --> 10:35.100] look at the top uh top half of the screen, we support basically and natively 4 devices. Um some of [10:35.100 --> 10:42.540] them are based on Nordic Semiconductor NRF52 uh system and chips. Uh so basically the there is the [10:43.560 --> 10:52.760] ESP32WROOM from Espressif. The Nucleo WL55 which is uh uh Lora and the Sigfox uh transceiver from [10:52.760 --> 10:58.840] STMicro uh that's supported and uh also yeah I told you about the NRF52. But the most [10:58.840 --> 11:05.660] interesting part is that we uh managed to create some uh adaptation layer between WAD and the old [11:05.660 --> 11:12.780] tools such as the uh Yardstick one or the Herbatools. And in fact we we we can use all these old [11:12.780 --> 11:18.580] devices if you can say with WAD. And this is totally transparent for you. So it's uh just it appears [11:18.580 --> 11:22.540] like a classic WAD tool or WAD device and you can use it to do whatever you want. [11:24.940 --> 11:31.300] The WAD protocol supports a lot of uh modulations uh file layers and other protocols. So [11:31.300 --> 11:37.480] basically this is the FSK, GFSK, MSK modulation on the physical layer. Uh so you can do [11:37.480 --> 11:42.920] demodulate and modulate signals using a specific device. And uh obviously the BLE protocol, [11:42.920 --> 11:49.960] ZigBee and so on also support it. Uh based on some previous research we made, Romain and I, we [11:49.960 --> 11:56.800] also added into WAD the result of this research. So Romain published in uh 2021 uh the Wasabi [11:56.800 --> 12:04.460] uh attack. So basically this is an attack on uh well not an attack. This is uh just a uh a way to [12:04.460 --> 12:12.360] divert the uh radio transceiver from an NRF50 to a system and chip to to make it able to sniff and [12:12.360 --> 12:19.840] inject ZigBee packets. And uh last year we presented also uh some uh research at WOOD uh [12:21.000 --> 12:28.960] which is basically how to turn an ESP32 into a uh a device uh that can sniff and inject raw [12:28.960 --> 12:34.260] PDUs in Bluetooth low energy uh communication. So yeah this uh this is also supported in the [12:34.260 --> 12:40.480] firmware and uh in the WAD protocol. Not WAD protocol but WAD ecosystem. Uh if you want to [12:40.480 --> 12:46.460] add new protocols to this uh like Romain said it's extensible. So you can uh just modify the [12:46.460 --> 12:53.220] protocol and add what you need to to implement it. All the uh uh all the translation between [12:53.220 --> 12:57.800] these messages and so on is performed by the framework. And uh the protocol is versioned as [12:57.800 --> 13:02.460] well so it is Blackboard compatible. If you have a device with version 1 protocol version 1 it [13:02.460 --> 13:09.200] will be supported uh as well as a device with a protocol version 2 and so on. And uh obviously [13:09.200 --> 13:16.380] we hope that uh many hackers may want to contribute to to WAD and add new protocols we didn't [13:16.460 --> 13:26.340] think about because we maybe don't know this protocol or so on. Um we also design our own [13:26.340 --> 13:32.140] flexible stack model. So speaking of wireless protocol we provide a specific flexible stack [13:32.140 --> 13:40.260] model sorry uh that is easy to modify. So basically take a BLE stack. You can just swap uh a [13:40.260 --> 13:44.420] specific layer and replace it with your one with your own. You can develop your own stack layer [13:44.980 --> 13:50.240] and replace it in a in the stack. So basically you can implement some very specific behavior if [13:50.240 --> 13:57.760] you want to test some uh unexpected uh behavior this is a way to to do. Uh there is a complete [13:57.760 --> 14:02.400] stack snapshot that is implemented from scratch uh in the in this model. So for each every [14:02.400 --> 14:08.420] protocol supported every protocol stack we got in WAD you can do at any time a snapshot of the [14:08.420 --> 14:13.380] old stack. Uh save this snapshot on the on your disk and reload this snapshot later if you want [14:13.380 --> 14:19.980] to test uh something on this uh this framework. And also this uh older flexible stack model uh [14:19.980 --> 14:26.160] makes uh writing unique tests very easy because you can just isolate a layer. Send inputs and [14:26.160 --> 14:34.380] check what outputs uh came and if it uh what you are expected from this layer. And um in WAD [14:34.380 --> 14:41.940] actually we provide uh multiple protocol stack. Uh BLE for version 4, version 5 is on its way. Uh [14:41.940 --> 14:48.820] Logitech Unifying, uh NShark Burst from Nordic, ZigBee, RF um RFOC, and LoRaWAN. So all these [14:48.820 --> 14:53.840] stacks have been uh implemented from scratch and are flexible in a way that you can make the [14:53.840 --> 14:59.700] stack behave the way it's not really expected by the specifications. So this uh allows uh [14:59.700 --> 15:05.080] security research uh if you want to try uh unexpected ways to to go through the stack. And [15:05.080 --> 15:09.120] uh if you want just want to use the protocol as well you can just use them and it works as [15:09.120 --> 15:14.540] expected. So this is uh this is why Romain said it was made for uh secure cyber security [15:14.540 --> 15:20.440] specialists, researchers, and also uh just uh enthusiast, wireless protocol enthusiast, or just [15:20.440 --> 15:28.280] user. Um and uh we also love KISS uh not the uh rug band uh obviously but the keep it simple [15:28.280 --> 15:34.600] stupid uh principle. And WAD provides a set of simple common tools and um a mean to combine [15:34.600 --> 15:42.100] them uh to combine all these tools into uh in order to create more complex tools. Uh and we [15:42.100 --> 15:46.560] also provide some full feature tools for those who want to just to experiment with uh a [15:46.560 --> 15:51.940] protocol. And um yeah if you're a newcomer in wireless protocol exploitation or or just if you [15:51.940 --> 15:58.240] want to play with some protocol you we got you covered. Uh just to give you an an idea of [15:58.240 --> 16:02.820] what's going on with WAD and this uh KISS principle. Um I don't know if it's really [16:02.820 --> 16:09.200] readable in the screen but uh basically we are using uh a first program called WBD connect to [16:09.200 --> 16:14.980] initiate a WBD connection into a device. Then there is a pipe with a W-shark which is a uh [16:14.980 --> 16:20.900] wrapper for Wireshark. And then another pipe with WBD central profile and basically what this [16:20.900 --> 16:27.360] command does is just tells what to first initiate a connection to the device. Then to ask uh [16:27.360 --> 16:32.300] the the device it's a BAD services and characteristics. So it's basically an enumeration [16:32.300 --> 16:39.420] performed by the uh WBD central. And every packet sent between the connection and the uh [16:39.420 --> 16:47.060] central which is a GATT client is monitored by Wireshark in real time. And you can compose all [16:47.060 --> 16:53.400] the tools this way. You create a processing packet chain. Uh yeah that's it. I don't know. [16:53.400 --> 16:59.360] Maybe I I get it wrong. But um you create a chain of uh of packet processing and you can do [16:59.360 --> 17:04.480] whatever you want. We are going to show you some other tool we developed. And it allows some [17:04.480 --> 17:11.460] yeah some a lot of flexibility you know in the um what can be done with this uh this uh these [17:11.460 --> 17:18.040] things. And obviously we also created in the framework a lot of uh um wrappers for creating [17:18.040 --> 17:22.880] uh command line applications. So if you need to create some command line tools or do your own [17:22.880 --> 17:29.480] tools, you you got everything you need to um wrap the connection to the hardware and so on. [17:31.240 --> 17:39.000] Yep. Uh the clicker. Yeah. So uh I'm going to start with the first demo. This is uh we we got [17:39.000 --> 17:45.780] uh 13 demos to to show you what what is capable of. Uh so the first one is the BLE exploring [17:45.780 --> 17:52.860] demo. So basically we are I'm going to to show you the WBD central tool. So this is the WBD [17:52.880 --> 17:59.160] central. This is basically uh a GATT client and uh and what I'm going to do here is to scan [17:59.160 --> 18:03.760] devices, connect to the device, a specific device, in a way so this is BLE services and [18:03.760 --> 18:11.340] characteristics and return what's on data from this. So I guess nope. Okay so the setup is just [18:13.560 --> 18:25.480] should be this one. So basically we launch a scan using WBD central. We are using uh an HCI [18:25.480 --> 18:32.120] adapter for BLE. We can get all the information, all the advertising records sent by the uh the [18:32.120 --> 18:37.720] device. Once you found your your device or target device you can connect to it through the [18:37.720 --> 18:42.400] connect command. So this is an interactive shell provided by WBD central. Then the connection [18:42.400 --> 18:48.800] is made and we uh launch a profile command to start enumerating services and characteristics. [18:48.800 --> 18:55.120] We can find uh we have found a device name characteristic uh and a manufacturer name [18:55.120 --> 18:59.160] characteristics in two different services and we're going to read the content of this [18:59.160 --> 19:04.480] characteristics using a read command. And we get everything and uh we can also write into [19:04.480 --> 19:12.080] characteristics and subscribe for notification. The basics a GATT client can do. Oh this is for [19:12.080 --> 19:18.660] the next demo. So basically this is just an example of a full feature tool uh in WAD and this [19:18.660 --> 19:42.610] is a very basic one. So uh second uh full feature tool we developed uh is a tool named uh ZigBee [19:42.610 --> 19:50.230] and device uh that will allow us to interact with uh ZigBee networks uh and uh emulate [19:50.230 --> 19:56.870] basically a ZigBee and device. So thanks to this tool you will be able to detect uh the [19:56.870 --> 20:03.050] surrounding ZigBee networks uh to join a specific network uh perform all the cryptographic [20:03.050 --> 20:09.910] operation this kind of stuff and get the network key uh associated with the network enumerate the [20:09.910 --> 20:18.850] devices on the network and interact uh with the various ZigBee devices. So uh here you have a [20:18.850 --> 20:27.730] small demo showing a small ZigBee network uh on the camera and you have an example of the use of [20:27.730 --> 20:37.050] this tool. So first we perform a scan operation to discover the surrounding networks. So it takes [20:37.050 --> 20:46.290] some time but uh finally uh we can see that we have one uh ZigBee network. So let's join uh this [20:46.290 --> 20:53.350] network and perform the association procedure so we are able to see the network key and now we are [20:53.350 --> 21:01.010] associated and we can uh interact and discover the nodes in the networks and the endpoints for every [21:01.010 --> 21:13.130] nodes. So then uh we have a list of clusters that allows us to uh interact with uh the nodes and we [21:13.130 --> 21:55.240] can use the cluster command to toggle uh a light bulb for example uh to get it off and so on. So sorry uh we [21:55.240 --> 22:03.220] have also uh another tool named what sniff which is a generic tool so it's a multi-protocol sniffing [22:03.220 --> 22:14.200] tool. Uh so what sniff uh works with all uh the protocols that are supported uh by WAD so ZigBee, BLE, RFC, you can [22:14.200 --> 22:25.220] even uh directly sniff uh PHY uh so uh physical layer um configured as you want. Uh it provide different uh [22:25.220 --> 22:30.920] output formats so you can directly display the SCAPI packets uh with the different fields uh correctly [22:30.920 --> 22:40.740] dissected uh or directly a next dump uh version of the packet. Uh and it allow to uh when it was a traffic and do value [22:40.740 --> 22:54.140] stuff like exporting data to a PCAP uh when it's a ring uh with Wireshark. So here you have uh some uh basic uh use cases of uh [22:54.140 --> 23:10.300] what sniff. So here we are going uh to uh display uh some BLE advertisements. So here you can see the SCAPI uh representation. Then we can [23:10.300 --> 23:23.360] switch the formats to xdump and so here we have the xdump version of our packets. We can uh also uh collect these uh packets [23:23.360 --> 23:32.440] using uh uh directly the physical uh layer of Bluetooth energy. So we provide the modulation, Gaussian frequency shift scaling, then the [23:32.440 --> 23:48.200] deviation. Uh we provide the frequency uh and uh uh finally the size uh of the packets. And here we get a raw dump uh straight out the [23:48.200 --> 24:07.300] demodulator output. So uh it can be useful for specific analysis. And uh uh finally we can also uh for with this what sniff tool uh directly [24:07.300 --> 24:17.500] export the traffic to uh PCAP for further analysis. So here all the traffic is simultaneously displayed on the screen and [24:17.500 --> 24:47.960] exported to PCAP. So uh an interesting uh feature uh of WAD is that you can combine uh several tools uh with pipes. So what sniff can be [24:47.960 --> 24:58.540] chained with uh several tools. So for example you can uh use what filter that uh may allow to apply some filtering uh on the received [24:58.540 --> 25:10.900] packets. Uh you can transform uh the packets on the fly uh if it matches a specific filter. Or you can also use some tools like uh WAD [25:10.900 --> 25:25.600] extract uh that may allow to extract uh a specific uh field uh from the packets. So let's go uh for an example of that. So here it's uh the [25:25.600 --> 25:37.100] same example with what sniff. And uh we are going to pipe uh what sniff with uh what filter. And in what filter we are going to provide a [25:37.100 --> 25:48.080] filter to keep only a specific kind of other types of packets. So the add and packets. And finally if we want uh to extract a specific field we [25:48.080 --> 26:00.240] can use uh WAD extract. We provide the field we want to extract. So here is the bid address. And we also export a part of the metadata so the [26:00.240 --> 26:17.160] RSSI. And of course you can then grab this output and provide it uh to classical Unix tool. So uh what sniff uh has a lot of uh usage and it may even [26:17.160 --> 26:29.480] allow to perform uh some uh complex uh attacks. So typically uh in this demo we are going to attack an RF4C communication between a remote uh [26:29.480 --> 26:43.620] controller and a setup box. So uh typically RF4C is a lightweight variant uh of ZigBee for remote controller. So here you have a setup uh with the remote [26:43.620 --> 26:55.340] controller on one side and what sniff on the other side. So here we are performing a pairing with the remote controller. And uh what sniff has been [26:55.340 --> 27:11.560] configured to automatically perform a brute force uh attack. And so in the input you can notice that the key uh has been uh automatically uh derived and [27:11.560 --> 27:25.420] extracted from the communication. And the packet uh which is uh normally encrypted can be uh decrypted uh on the fly. So it allows to sniff the various [27:25.420 --> 27:45.160] buttons that are pressed on the remote control. And uh it uh can also sniff the audio stream which can be transmitted uh using the mic of the remote [27:45.160 --> 28:12.820] controller. And uh uh we can even export uh the voice command. To a bad uh uh WAV file but yeah it's working. So uh next demonstration is about uh using [28:12.820 --> 28:22.860] Wireshark to sniff uh some traffic. So basically uh we showed this uh a bit earlier but uh we're going to go a bit deeper in this uh demo. So uh we can monitor [28:22.860 --> 28:31.940] everything with WShark. 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 [28:31.940 --> 28:42.340] the through the file layer you can get it in Wireshark in real time and you can monitor everything you're working on. If you're uh use WFilter to modify your packet [28:42.340 --> 28:55.400] on the fly you can see the result in real time with the DWShark. So uh the demo is the following. I'm going to be very quick about this one. Yeah so basically [28:55.400 --> 29:07.080] we are again connecting to a device and so on and performing uh um uh services and characteristics is imminent uh enumeration. And uh everything uh can be [29:07.080 --> 29:17.900] monitored uh in Wireshark while the terminal shows you the uh results of this uh of this operation. So this is basically uh what WShark can do. And the most [29:17.900 --> 29:27.680] interesting thing is that uh we talked about uh Gatacore and BTDJuice at the beginning of the talk. So basically these tools are based on not on some [29:27.680 --> 29:41.160] Node.js uh library uh which are not no more maintained at the moment. So if you want to perform a man-in-the-middle attack on BLE with WAD this is very simple [29:41.160 --> 29:50.300] because you can combine tools. 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. You uh just [29:50.300 --> 30:01.060] create a command line starting with WBAD-spawn that will spawn a device with the corresponding parameters that will mimic the target device. And then you can [30:01.060 --> 30:11.760] pipe all the packets that will go uh from the this uh fake device or spoof device into Wireshark. You can so you can monitor in real time what's going on. And then uh once [30:11.760 --> 30:22.720] 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. And every packet sent by [30:22.720 --> 30:34.080] the smartphone uh or the target or the target device will be uh just forwarded as uh uh as it goes. And you can monitor everything in WShark. So this is uh the next [30:34.080 --> 30:47.420] demo I'm going to show you. Uh here so we are setting up uh Gatacore-like man-in-the-middle attack using uh WAD. Using simple tools again WBAD-spawn. This is a very small [30:47.420 --> 31:02.220] tool like WBAD-connect. And um we first the system is going to spawn a spoof device that just advertise itself like the target device. And the smartphone uh here is [31:02.220 --> 31:11.720] going to detect this device. 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 [31:11.720 --> 31:21.280] initiated. We can see on Wireshark what's going on with the BLE PDUs. And if you really try to read the characteristics for instance then all the PDUs are directly [31:21.280 --> 31:29.040] forwarded to the target device and back and forth and we can monitor everything. With Wireshark you can see what's going on. You can save it at the as a [31:29.040 --> 31:42.520] backup. 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. And you can if you want make some [31:42.520 --> 31:52.980] changes into the packets using some specific filters. If you want to modify the answer uh the um response uh from a read operation on the characteristics you can do it [31:52.980 --> 31:58.420] on the fly. And you can also monitor what's going on because you can pipe WFilter with WShark as well. [31:59.260 --> 32:11.360] So this this is powerful even if this demo is not uh really powerful but yeah. Anyway. And if you want to emulate a BLE peripheral you can you can use uh the full [32:11.360 --> 32:22.220] feature of WBLE Perif. Uh so basically it goes like this. This is a command line tool you can use to just uh spawn a BLE device and populate the device with [32:22.220 --> 32:30.540] whatever you want. So basically you can change the name of the device and say that I'm going to create a device called Defcon32. Uh add a service and a [32:30.540 --> 32:42.220] characteristic to the device. Um I'm going to write the value of this characteristic as well. It should be Defcon32 I guess. And then uh I'm going to start a device on [32:42.220 --> 32:51.580] the uh right hand side of the screen. You got the uh screen of the smartphone. So let's start this uh spoof device or emulated device to be more precise. [32:51.580 --> 33:05.880] Uh yeah come on. Okay so it will pop on uh the um smartphone and we can connect to it. Um it will start the discovery process of services and [33:05.880 --> 33:14.820] characteristics. There is a single service with a single characteristic. And we can read the content. Each time we read from the smartphone the content of this [33:14.820 --> 33:25.020] characteristic this is caught by the BLE PRF uh tool. And uh if uh the smartphone subscribe to notification then it got nothing notified by the uh the system [33:25.020 --> 33:35.340] and so on. 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 [33:35.340 --> 33:44.800] modifying some uh some properties of this uh of this device. Uh uh in practical situation this is not what we are going to use because it's uh [33:44.800 --> 33:55.380] you know just uh uh interesting when you want to play uh with uh a device. But uh a more interesting use is the following. Uh if you want to implement a very [33:55.380 --> 34:02.780] specific device with specific services and characteristics with a specific behavior for the characteristics here are a small example. We are going to create a [34:02.780 --> 34:12.060] battery device exposing your battery service with a battery level. Except that each time we are going to read the battery level we will decrease the level by 10%. [34:12.060 --> 34:24.540] And it goes like this when you emulate this uh peripheral. So basically uh we start the Python script that uh instruments everything. The device appears on the [34:24.540 --> 34:31.540] screen so there is a battery device. When the discovery goes with the services and characteristics we get one service with one battery level [34:31.540 --> 34:41.240] characteristics. And each time I read the characteristic value getting the percentage of uh battery level percentage then it is decreased. So this is just [34:41.240 --> 34:53.840] 10 lines of Python to do this. And uh we did the same with other protocols because we are talking a lot about BLE. Uh we got a lower one gateway [34:53.840 --> 35:04.480] implemented in WAD. 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 [35:04.480 --> 35:16.440] and it works pretty well. Uh I guess the demo will be a nightmare on the screens so I will skip it. Um but the media server of DEF CON has this uh has this [35:16.440 --> 35:25.460] demo so if you want to have a look at it uh please do. But uh I'm going to still skip this one. Uh and let Romain explain the rest. [35:25.890 --> 35:42.880] Yeah. So uh another uh example of what you can do uh with uh WAD is uh the emulation of various uh devices. And for example uh you can take a proprietary protocol like [35:42.880 --> 35:55.500] 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 [35:55.500 --> 36:09.920] Logitech Unifying devices. So typically here we are going to use it to perform a scan uh operation of uh surrounding Unifying devices. Uh spoof uh the address of uh mouse. [36:09.920 --> 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. [36:20.920 --> 36:39.640] So here we start by uh using a small command line tool to perform a scan operation. It allows us to get the address of a mouse and we provide it uh in uh [36:39.640 --> 36:51.640] as argument of a Python script that will perform the injection. And as you can see uh we have a keystroke injection uh performed and fully emulated by WAD. [36:53.860 --> 36:58.440] Yeah. So you can see a lot of code written. [37:04.230 --> 37:13.330] So uh we can uh emulate a Logitech Unifying keyboard. We can also emulate a Logitech Unifying uh dongle. [37:13.590 --> 37:41.610] Uh and uh on the other uh side on BLE we are able to emulate a peripheral. 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. [37:41.990 --> 37:55.970] So uh we have a small script. You can see the screen uh of the smartphone and uh you can see uh a video with the keyboard uh at the bottom. [37:55.970 --> 38:06.090] So first we connect uh we emulate the BLE keyboard. We connect and pair the smartphone uh with this uh emulated BLE keyboard. [38:10.760 --> 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. [38:30.980 --> 38:35.680] So yeah. Completely useless but funny. [38:36.640 --> 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. [39:00.460 --> 39:08.360] So uh we wrote uh a WAD server that will allow uh you to expose a WAD device uh over TCP. [39:08.780 --> 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. [39:21.400 --> 39:27.440] And uh for example, it can be useful to build relay attacks and that kind of stuff. [39:28.000 --> 39:37.260] So as uh in this next demo, so we are in two different uh cities in France. [39:37.340 --> 39:44.620] And I'm exposing uh my uh Bluetooth dongle uh using WAD server. [39:45.140 --> 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. [39:58.080 --> 40:01.240] Perform a profile uh discovery. [40:02.040 --> 40:09.260] And uh now he will be able to uh turn the light bulb on, [40:10.840 --> 40:13.200] turn the light bulb off, [40:14.580 --> 40:18.000] and modify uh the color. [40:18.240 --> 40:24.560] So typically uh it's interesting uh for building relay attacks. [40:24.560 --> 40:29.160] It can be interesting in various experiment uh setups. [40:29.380 --> 40:30.800] So sky is the limit here. [40:31.240 --> 40:36.460] Yeah uh and the interesting part here is yeah again we show it with BLE, [40:36.460 --> 40:38.580] but it can be done with any protocol as well. [40:38.580 --> 40:46.860] You can uh accept the Logitech unifying because you have some keep-alives that are messed up with the network. [40:46.860 --> 40:51.780] But in fact, you can once you are connected to a device, you can just discover everything. [40:52.500 --> 40:58.120] Yeah just like uh yeah it's the same if you connect the device on your computer. [40:58.120 --> 41:01.780] So basically it opens a wide range of possibility. [41:06.340 --> 41:14.520] So uh we are developing this project uh since a few years now. [41:14.520 --> 41:24.520] And uh it has been used uh internally so in Damien's company and in my research lab. [41:24.520 --> 41:29.580] So for example, one intern at Quark's lab, [41:29.580 --> 41:38.120] Baptiste Boyer, developed a BLE GAT fuzzer using WAD that leads to a CV [41:39.420 --> 41:45.560] linked to the expressive controller expressive BLE stack, sorry. [41:45.620 --> 41:51.280] And we also used it in a research project [41:51.280 --> 41:55.620] uh to evaluate the screaming channel attacks. [41:55.620 --> 42:04.020] So it allowed us to instrument the BLE protocol with custom link layer traffic. [42:04.020 --> 42:11.280] It's also a project which is already heavily used in some hardware CTFs. [42:11.280 --> 42:19.760] So for example, this year's edition of hardware IO, all the BLE challenges were fully emulated [42:19.760 --> 42:21.340] with WAD. [42:21.340 --> 42:28.080] And WAD has also been used in a lower one challenge to emulate a lower one gateway. [42:29.000 --> 42:32.340] So to conclude this talk, [42:33.160 --> 42:38.820] we are releasing today publicly this project. [42:38.820 --> 42:41.720] So it's available on pip. [42:41.720 --> 42:46.420] The documentation is available on read.docs. [42:46.420 --> 42:52.920] So we are going to improve the documentation and the project over time. [42:52.920 --> 42:55.660] Feel free to contribute to it. [42:55.660 --> 43:05.040] We have also the firmware files that are available on GitHub in some sub repositories. [43:05.040 --> 43:11.580] And globally, all the code is available on GitHub under MIT license. [43:11.580 --> 43:20.700] So of course, we also are making a call for contributors. [43:20.700 --> 43:27.680] So feel free to create compatible firmwares for your preferred hardware [43:28.080 --> 43:33.260] to report any bugs, any issues you would encounter on GitHub. [43:33.260 --> 43:38.360] And if you want to help us by writing some documentation, [43:38.360 --> 43:42.180] by adding support for other protocols or other devices, [43:42.540 --> 43:45.120] we would be happy to have contributors. [43:45.880 --> 43:50.660] And if you like it, spread the word and tell your friends. [43:51.400 --> 43:53.860] So two last words. [43:53.860 --> 43:58.600] So this is a work we initiated two years ago. [43:58.680 --> 44:03.040] And here it was a very high-level presentation. [44:03.040 --> 44:08.060] So we only scratched the surface of what WAD is capable of. [44:08.060 --> 44:12.840] And we also want to warmly thank the many researchers [44:12.840 --> 44:16.240] that have beta access to this project [44:16.240 --> 44:22.680] and that helped us and provided some feedback on it. [44:22.680 --> 44:26.120] So I won't name them all, but they know. [44:26.520 --> 44:28.560] Thank you very much. [44:28.720 --> 44:32.680] And sorry for the small technical issues. [44:32.680 --> 44:34.500] We are ready if you have any questions.