1 00:00:00,000 --> 00:00:04,760 I'm Ryan. I'm going to be talking to you about a little project I did. I released it a couple 2 00:00:04,760 --> 00:00:10,860 months ago. It's a CTF based on BLE. I'll kind of tell you a little bit in depth about why I 3 00:00:10,860 --> 00:00:16,040 did it and kind of some of the components of it and the makeup. So it's my Twitter handle at 4 00:00:16,040 --> 00:00:23,800 hacknar if you want to send me anything. So the de facto who am I slide before I get 5 00:00:23,800 --> 00:00:30,360 started. I work at Atlassian. I run the security intelligence team which is our DFIR team 6 00:00:30,360 --> 00:00:36,920 globally and our red team. I'm an advisor for an endpoint security company named Zipton. It was 7 00:00:36,920 --> 00:00:41,640 kind of like a past life of mine when I worked there but I'm happy at Atlassian now. I do a lot 8 00:00:41,640 --> 00:00:46,480 of Bluetooth stuff in my spare time. I'm an old man skateboarder. I like to skateboard a lot. 9 00:00:46,720 --> 00:00:52,780 There's a picture of me trying to teach my kid to drop in on a quarter pipe. Anyone else here 10 00:00:52,780 --> 00:00:53,360 like to skateboard? 11 00:00:54,800 --> 00:00:59,340 If you do, there's a really cool skate park about 15 minutes from here that I went to the 12 00:00:59,340 --> 00:01:04,500 other day. It's called like Arroyo Grand Skate Park. It's like a really unique park that's all 13 00:01:04,500 --> 00:01:10,640 like pump tracks. It killed my legs in about 20 minutes but it was a lot of fun. And then I'm a 14 00:01:10,640 --> 00:01:14,800 regular member of AHA as well which is an Austin thing. A bunch of security nerds that get 15 00:01:14,800 --> 00:01:22,780 together once a month. Okay. So on with this. The important stuff. What is this thing? So 16 00:01:23,800 --> 00:01:34,520 the BLE CTF is a Bluetooth low energy CTF. It's built on an ESP32 chipset. So I did nothing with 17 00:01:34,520 --> 00:01:38,780 the hardware, right? I just wrote all the firmware for this thing that kind of hosts the whole 18 00:01:38,780 --> 00:01:45,440 entire CTF. So there's my little disclaimer there that this chipset is not my creation design 19 00:01:45,440 --> 00:01:50,040 or manufacturer or anything like that. I just flashed the CTF to the firmware. You can even 20 00:01:50,040 --> 00:01:53,780 flash it on the DC darknet badge as well. You can even flash it on the DC darknet badge as well. 21 00:01:53,800 --> 00:01:59,840 It's pretty cool. I was glad to get my hands on one of those. It's all written in C. I actually 22 00:01:59,840 --> 00:02:04,060 got the ESP32 because I heard you could do it in Micro Python. You could run Micro Python on it. 23 00:02:04,140 --> 00:02:07,540 And I was like, oh, that would be super quick. I can do this like in five minutes. But you 24 00:02:07,540 --> 00:02:11,080 can't do a Micro Python stack and keep the Bluetooth stack at the same time. So I just wrote 25 00:02:11,080 --> 00:02:17,220 it all in C. The GAT server itself, basically the firmware creates a GAT server which hosts 26 00:02:17,220 --> 00:02:23,540 the CTF. And there's about 20 flags in total. And they're all meant to kind of step you 27 00:02:23,540 --> 00:02:29,780 through editorively like from beginning to more advanced steps in Bluetooth low energy. So 28 00:02:29,780 --> 00:02:34,500 why did I create this thing? Right? I think like throughout the years I've done a lot of Bluetooth 29 00:02:34,500 --> 00:02:39,560 talks and just a lot of Bluetooth research. And there wasn't like a de facto standard way to 30 00:02:39,560 --> 00:02:45,140 educate people on Bluetooth low energy. Even in Bluetooth classic it's the same problem. So I 31 00:02:45,140 --> 00:02:52,260 created this CTF. And it's really kind of like an entry level learning platform in order to get 32 00:02:52,260 --> 00:02:53,520 you ramped up to the skill set. And it's really kind of like an entry level learning platform in 33 00:02:53,520 --> 00:02:55,260 order to get you ramped up to the skill set that you can start tinkering and hacking on 34 00:02:55,260 --> 00:03:00,800 Bluetooth low energy GAT servers. Low cost of entry. Right? You can get these chips from China 35 00:03:00,800 --> 00:03:06,480 for about $5. So I didn't want to make anything that was super expensive. You need no prior 36 00:03:06,480 --> 00:03:10,720 Bluetooth experience if you want to get started with this. Don't think that, you know, like I've 37 00:03:10,720 --> 00:03:15,140 had my colleague Christian who's in the audience, he had no Bluetooth experience before. I used 38 00:03:15,140 --> 00:03:19,340 him as a guinea pig on the CTF to make sure that people could actually go through this thing 39 00:03:19,340 --> 00:03:23,400 from start to finish without knowing Bluetooth. And I wanted to get more people involved. 40 00:03:23,400 --> 00:03:27,160 I do a lot of Bluetooth talks and a lot of times I just see people's eyes glaze over and 41 00:03:27,160 --> 00:03:32,840 they have no idea what I'm talking about. So I just wanted more people involved in this. And 42 00:03:32,840 --> 00:03:38,560 I've never written a GAT server before. So it was a challenge to myself. So what do you need 43 00:03:38,560 --> 00:03:43,340 to get started? As I mentioned, you'll need an ESP32 of any form, shape, whatever 44 00:03:43,340 --> 00:03:47,820 manufacturer. You can buy them on eBay for $5. You can buy them on Prime if you're impatient 45 00:03:47,820 --> 00:03:52,640 and get it the next day for $10. Or if you don't want to flash it at all, I sell overpriced 46 00:03:52,640 --> 00:04:00,640 ones for either $20 or a beer. And they're just pre-flashed with the CTF. And if you are 47 00:04:00,640 --> 00:04:05,420 getting one that's not pre-flashed, you'll need the source code which is in my repo that I'll 48 00:04:05,420 --> 00:04:11,360 share later. Basically you just compile it up and then you flash it to the ESP32. And then I 49 00:04:11,360 --> 00:04:15,320 would recommend that you have a Linux box in order to do the CTF. A lot of people have 50 00:04:15,320 --> 00:04:20,860 contacted me and they're like, oh, I just did it on my phone with NRF connect. You can. But I 51 00:04:20,860 --> 00:04:22,620 think you're better off with a GAT server. So I would recommend that you have a Linux box in 52 00:04:24,660 --> 00:04:27,720 order to do the CTF. So from the software side, like I mentioned, if you're using standard 53 00:04:27,720 --> 00:04:34,300 Linux box, you can really do the entire CTF with HCI util and GAT tool. There's other tools that 54 00:04:34,300 --> 00:04:41,400 help. Evil socket, Simone evil socket's tool, blah, if I'm pronouncing it wrong, let me know. 55 00:04:42,320 --> 00:04:47,600 It's really useful for visualizing a GAT server and seeing everything that's running on it. So 56 00:04:47,600 --> 00:04:51,640 really great tool for it. You don't need it. You can't actually do the whole CTF and blah. But it's 57 00:04:51,640 --> 00:04:56,780 really nice in order to just kind of visualize what's going on. And then I provide a vagrant 58 00:04:56,780 --> 00:05:01,280 script in the source repository as well that will just spin up a new bot2 box with all the tools 59 00:05:01,280 --> 00:05:04,000 that you need on it if you're not running a Linux box and you're doing it on something like 60 00:05:04,000 --> 00:05:11,960 OSX. Cool. What will you learn? If you do the CTF from start to finish, it teaches you all the 61 00:05:11,960 --> 00:05:15,860 basics of Bluetooth low energy like in interacting with a GAT server. So you'll learn how to do 62 00:05:15,860 --> 00:05:20,200 reads in many ways. You'll learn how to do writes in many ways. Notifications and notification 63 00:05:20,200 --> 00:05:21,620 tricks. Indication, internet. You'll learn how to do a lot of things. You'll learn how to do a lot of 64 00:05:21,620 --> 00:05:25,560 communication tricks. You'll learn to tinker with a lot of the client settings on a Bluetooth 65 00:05:25,560 --> 00:05:30,880 dongle and like HCI util and things like that. And you'll learn a lot of the server structures 66 00:05:30,880 --> 00:05:34,540 that you will see in a GAT server. And there's a lot of other stuff in there. But these are kind 67 00:05:34,540 --> 00:05:43,280 of like the basics that you'll take away after you finish the CTF. Cool. So I embedded a video 68 00:05:43,280 --> 00:05:50,500 demo. See if it even works. All right. So here's me. Cool. It's going over there but not over 69 00:05:51,620 --> 00:05:55,460 there. So this is just showing getting started, right? Like doing a HCI util scan and finding the 70 00:05:55,460 --> 00:06:01,780 CTF. So basically after you plug in the ESP32 and it's live, you'll do a scan and you'll find the 71 00:06:01,780 --> 00:06:12,920 MAC address that you'll need in order to just kind of poke around with it. And the next one is flag 72 00:06:12,920 --> 00:06:20,360 1. This is not like a spoiler. You can only get flag 1 by actually sorry the text is a little small 73 00:06:21,620 --> 00:06:25,260 here. So I'm just going to take a few slides to my Git repo afterwards. Let's see if I can make a 74 00:06:25,260 --> 00:06:46,260 good start. Screw this. I'll just do it this way. Cool. So here I have the Git repo up and oh, 75 00:06:46,320 --> 00:06:51,600 God, it's not working over there. Hang on. Demo error. So I'm just going to go ahead and do a 76 00:07:07,920 --> 00:07:12,240 quick test. Okay. So flag 1 is a gimme. You can only get it from reading the documentation and 77 00:07:12,240 --> 00:07:16,980 the whole purpose of it is to actually just make sure that you know how to properly do a get 78 00:07:16,980 --> 00:07:21,600 read and a get write. So here on your left side you'll see the 79 00:07:21,620 --> 00:07:25,800 repo. The repo hosts a hint for every single flag. None of the hints will actually give you a 80 00:07:25,800 --> 00:07:32,380 straight take away on how to actually get the flag. Except for flag 1 because flag 1 is just 81 00:07:32,380 --> 00:07:36,420 meant to be like kind of cut and paste. You swap out your MAC address and then you submit your 82 00:07:36,420 --> 00:07:41,120 flag value to the GAT server. So here in the bottom I'm just kind of going to read one 83 00:07:41,120 --> 00:07:45,540 character handle. There's one handle inside of the GAT server that will basically tell you your 84 00:07:45,540 --> 00:07:50,400 score out of 20. So you have a 0 out of 20 or you have a 1 out of 20, what not. Depends on how 85 00:07:50,400 --> 00:07:51,600 many flags you've submitted. And then you'll see here on the right side you'll see the number of the 86 00:07:51,600 --> 00:07:53,400 flags you've submitted. So the first thing we're going to do here is we're going to read that. 87 00:07:53,520 --> 00:07:57,900 We'll see that we have a 0 out of 20 score. Then after that we're going to take the value for 88 00:07:57,900 --> 00:08:02,680 flag 1 which is given to you in the documentation and we're going to do a GAT tool write of that 89 00:08:02,680 --> 00:08:19,600 value. And uh do do do do. You can do these GAT writes with either GAT tool or you can use 90 00:08:19,600 --> 00:08:23,860 uh Blaz really nice way to do it. Especially for a lot of the ASCII values because you can 91 00:08:23,860 --> 00:08:28,020 submit the ASCII straight and not have to convert the hex to ASCII. Um so it's a nice way to do it. 92 00:08:28,820 --> 00:08:32,260 And then after that we're just going to go ahead and we're going to read the flag handle again 93 00:08:32,260 --> 00:08:37,960 and we'll see that we have a score of 1 out of 20 instead of 0 out of 20. Uh and then just for 94 00:08:37,960 --> 00:08:43,120 kind of clarity as well. Um we'll go ahead and we'll read the GAT server with Blaz in order to 95 00:08:43,120 --> 00:08:49,120 show all the values which is a lot more nice way to actually visualize the whole thing. Um so it's 96 00:08:49,120 --> 00:09:03,060 going to be coming next. He's got cooler ASCII graphics than me too. So. But here you can 97 00:09:03,060 --> 00:09:09,660 see um we now have a you know 1 out of 20 because we submitted the first flag. Cool. 98 00:09:21,600 --> 00:09:27,040 As for extras. Um there's kind of like some extras here. Um as I mentioned you can do this 99 00:09:27,040 --> 00:09:33,020 whole CTF with just basics. Um using HCI util and GAT tool. Um but I had a lot of people say 100 00:09:33,020 --> 00:09:36,340 hey you know like I wanted something that was more complex and I needed an uber tooth or 101 00:09:36,340 --> 00:09:40,440 anything like that. Um I didn't make that as a requirement because you know as I mentioned 102 00:09:40,440 --> 00:09:46,740 before I wanted this to be very entry level and cheap. Um and so um but it is a great utility for 103 00:09:46,740 --> 00:09:53,220 learning to tinker with your uber tooth or uh nrf sniffer firmware. Um so as you kind of do the 104 00:09:53,220 --> 00:09:57,320 whole entire CTF you know the values that you're submitting from the client to the server. Um so 105 00:09:57,320 --> 00:10:03,620 sniffing the traffic with an uber tooth or an mi or nordic semi semiconductor sniffer 106 00:10:03,620 --> 00:10:07,580 firmware. Um you know what values you're looking for in the PCAP files so it makes for a 107 00:10:07,580 --> 00:10:11,380 really nice tool. And a lot of people have trouble when they first get into sniffing traffic 108 00:10:11,380 --> 00:10:16,720 with an uber tooth or nrf connect or nrf nordic firmware sniffer firm blah blah blah. Um so 109 00:10:16,720 --> 00:10:22,120 because um it's kind of fickle sometimes when you try to first sniff that you know that initial 110 00:10:22,120 --> 00:10:27,020 connection in order to follow all the packets and dump all your data into PCAP. Um so this is a 111 00:10:27,020 --> 00:10:32,540 really nice way to kind of learn how to hone your skills in in those tools as well. Um another 112 00:10:32,540 --> 00:10:38,360 little easter egg too is there's actually two LEDs on this version of the uh ESP32 development 113 00:10:38,360 --> 00:10:44,280 uh hardware that I'm using. Um and so anytime anyone like when you first fire it up only the 114 00:10:44,280 --> 00:10:46,700 red light's on and then anytime anyone ever does a uh a test run of the uh the uh the uh the 115 00:10:46,700 --> 00:10:51,520 um like a a gat read on any of your characteristics the blue light turns on. Um so it's a 116 00:10:51,520 --> 00:10:54,940 really fun way to just like walk around the conference and see if anyone's actually looking at 117 00:10:54,940 --> 00:10:59,540 your Bluetooth. Um I've actually had a couple of them like running the whole entire time uh 118 00:10:59,540 --> 00:11:04,960 through besides Defcon and Blackhat and I haven't had a blue light turn on once. Um so it 119 00:11:04,960 --> 00:11:08,760 kind of gives you a little idea of how many people are actually just actively you know scanning 120 00:11:08,760 --> 00:11:15,920 all Bluetooth devices out there. Um and as I mentioned I released this a few months ago and I've 121 00:11:16,700 --> 00:11:19,800 gotten a lot of feedback a lot of people just saying that it's a great tool to learn Bluetooth 122 00:11:19,800 --> 00:11:24,220 from the ground up. Um I was actually impressed with all the feedback I've gotten. Um so if you 123 00:11:24,220 --> 00:11:29,480 have done the CTF and you've given me feedback thank you very much I appreciate it. Um but my 124 00:11:29,480 --> 00:11:35,660 favorite feedback is this one. Um there's an intern who I think lives in Minnesota that's his 125 00:11:35,660 --> 00:11:42,720 GitHub repo there. Um he wrote a he forked the whole project to a fantasy RPG Bluetooth low 126 00:11:42,720 --> 00:11:49,360 energy um CTF. So basically as you complete flags you kill like goblins and trolls and you know 127 00:11:49,360 --> 00:11:54,440 get cool swords and stuff. Um so I was like dude you're so amazing. That's a a really cool 128 00:11:54,440 --> 00:11:59,280 project. Um so I don't know him but if you want to check out his stuff it's there. I think his 129 00:11:59,280 --> 00:12:07,080 repo name is just BTLECTF under bar fun. Cool. Future work. So I really love feedback. I love 130 00:12:07,080 --> 00:12:12,320 critical feedback as well and I realize that a lot of people want um more advanced 131 00:12:12,320 --> 00:12:16,760 versions of the CTF. Um so here's some of the future work that I'm working on and some of the 132 00:12:16,760 --> 00:12:21,060 timelines that I kind of gave myself. Um so some of the stuff that I want to do for this 133 00:12:21,060 --> 00:12:25,520 version is to randomize all the flag values so every time that you do a make and make flash you 134 00:12:25,520 --> 00:12:30,840 have randomized values in the the actual uh GAT server. Um and then I submitted this to a 135 00:12:30,840 --> 00:12:35,700 couple CTFs for upcoming conferences and if I get accepted then I want to write a CTFD harness 136 00:12:35,700 --> 00:12:40,820 for it. So uh the ESP32s are actually dual band you can do wifi and Bluetooth on it. Um so 137 00:12:40,820 --> 00:12:42,300 it'd actually be really easy to just kind of run through it and see what's going on. Um and then 138 00:12:42,300 --> 00:12:46,380 you can kind of hook up a networking harness to CTFD so you can actually keep scores and have 139 00:12:46,380 --> 00:12:50,460 like 20 of these things spread out and then everyone can actually do uh their own CTF and then 140 00:12:50,460 --> 00:12:55,760 you can see the scores and and and the competition. So um so those are the two things for 141 00:12:55,760 --> 00:13:01,060 version one I'm going to be adding. And then in late September I've uh started work on V2. I 142 00:13:01,060 --> 00:13:06,300 hope to have it done by late September. Um and this one's just evil. I took like every single 143 00:13:06,300 --> 00:13:10,840 like evil GAT trick that I've learned and could think of and I've kind of started iterating it 144 00:13:10,840 --> 00:13:15,700 into um pox right now and I'm gonna just plug it all together and then have something uh in 145 00:13:15,700 --> 00:13:19,940 late September. Um a lot of people it's probably gonna make you bang your head on the table and 146 00:13:19,940 --> 00:13:23,680 pull out all your hair and you'll think that it's broken. Um but there's a lot of evil GAT 147 00:13:23,680 --> 00:13:29,000 stuff you can do that you just don't see in in any device. Um but once you start using the APIs 148 00:13:29,000 --> 00:13:32,480 and coding it all in C and getting low level with it there's a lot of really nasty stuff you can 149 00:13:32,480 --> 00:13:39,860 do. Um and then in in uh late January probably around shmoo time um I'm trying to get a V3 out 150 00:13:40,840 --> 00:13:45,600 of V2 ESP32s. Um so that would actually have a requirement that you would need some type of 151 00:13:45,600 --> 00:13:50,780 sniffer hardware. Um whether it be an uber tooth or uh the nordic semiconductor sniffer firmware. 152 00:13:51,100 --> 00:13:57,280 So. So those are my rough deadlines and I hope to get them done by then. Couple of shoutouts. 153 00:13:57,380 --> 00:14:01,760 Thanks to everyone that's actually done it. Um I I really appreciate the feedback. Um my 154 00:14:01,760 --> 00:14:05,660 friend Alec who I was drinking beers with at shmoo con and kind of came up with this idea for 155 00:14:05,660 --> 00:14:10,820 the CTF. Uh Christian for making BTLE uh CTF stickers for me. Um I'm really happy to be able to 156 00:14:10,840 --> 00:14:11,560 share this with you guys. Um and then my friend Nick for helping me because it's something I 157 00:14:11,560 --> 00:14:16,260 probably would have never done. Um and he was a good guinea pig. And then all uh my aha aha 158 00:14:16,260 --> 00:14:24,760 people for listening to all my Bluetooth talks. And then uh here's the resources uh if you want 159 00:14:24,760 --> 00:14:29,680 to check out the project uh the repo's on the bottom uh or you can just ping me um read my blog 160 00:14:29,680 --> 00:14:35,020 I have a couple write ups on it as well. Um but yeah. That's it. Questions? 161 00:14:42,280 --> 00:14:56,120 I got a bag full of these things too if you want one just come talk to me. How did I get 162 00:14:56,120 --> 00:15:03,900 into attacking Bluetooth? I don't know. I started working on the Ubertooth firmware back when 163 00:15:03,900 --> 00:15:11,260 it was released. I did a DEF CON talk about it before Dominic did. So I have that one on him. 164 00:15:11,700 --> 00:15:18,300 He's not paying attention to me. Anywho. But that's how I got into it. I just started playing 165 00:15:18,300 --> 00:15:21,740 around with Ubertooth and then had a lot of fun with it and started just playing with 166 00:15:21,740 --> 00:15:33,880 Bluetooth. Yeah, the question is what is the tool chain I'm using? I'm using the 167 00:15:33,900 --> 00:15:39,860 flash to ESPs. It's just the, what is the manufacturer for them? Just the typical APK for 168 00:15:39,860 --> 00:15:48,280 it. The expressive software development kit. So that's it. For a couple of these you can actually 169 00:15:48,280 --> 00:15:53,340 use like, I've never done it, but apparently you can flash a lot of the ESPs with like Arduino 170 00:15:53,340 --> 00:15:59,040 and stuff like that. But I don't know if it will work or not. I just use the expressive SDK. 171 00:16:01,380 --> 00:16:02,060 Other questions? 172 00:16:06,300 --> 00:16:09,400 All right. That's it. Thank you for coming.