1 00:00:01,480 --> 00:00:03,920 Greetings, RF Village. 2 00:00:07,680 --> 00:00:10,660 Man, y'all sound super excited. 3 00:00:11,240 --> 00:00:13,300 There we go! 4 00:00:14,520 --> 00:00:15,300 Hell yeah. 5 00:00:15,300 --> 00:00:17,660 Hell yeah, it's toothbrush time, my friends. 6 00:00:18,360 --> 00:00:18,720 So... 7 00:00:19,340 --> 00:00:42,900 This wonderful person, who is definitely on several lists, is intimately and on first-name basis with the TSA, Amtrak, and organizations with three-letter affiliations, and not for good reasons, who loves doing interesting projects, up to and including... 8 00:00:42,900 --> 00:00:53,160 They brought an interesting RF case to my village that looked like a pair of RF boobs, or that you could put googly eyes on it and it would work the same. 9 00:00:53,160 --> 00:00:59,520 It was an amazing contraption that I was sure was making me sterile while I was standing next to it. 10 00:01:02,480 --> 00:01:11,680 They always produce good work and do good in our village competing, so that I know this talk is actually going to have some great information in it. 11 00:01:11,680 --> 00:01:22,020 So, without further ado, I'm going to turn over the microphone to this particular person of the toothbrush botnet fashion, so that you can learn all kinds of cool things. 12 00:01:22,020 --> 00:01:22,820 Everybody ready? 13 00:01:24,680 --> 00:01:26,300 Let's do this. 14 00:01:27,100 --> 00:01:29,160 Thank you for the introduction. 15 00:01:29,160 --> 00:01:31,560 Yeah, so this is how to make a toothbrush botnet. 16 00:01:31,580 --> 00:01:34,580 Tips, tricks, tools, and process for ESP32 hacking. 17 00:01:35,920 --> 00:01:38,500 So, we'll get a little brief outline real quick. 18 00:01:38,500 --> 00:01:56,400 So, we'll get into the background a bit, the impetus for how this even became a thing, get into dumping the existing firmware, getting into some extremely basic reverse engineering, some wireless sniffing, some buzzing, how OTA updates work, self-referencing firmware. 19 00:01:56,400 --> 00:02:00,920 Unfortunately, the demo video is not going to work because the internet is not fast enough in here right now. 20 00:02:01,560 --> 00:02:03,780 And then some future work that we've got going on. 21 00:02:05,760 --> 00:02:07,740 So, yeah, I'm Lo Zanning. 22 00:02:08,440 --> 00:02:12,280 I feel like Wasabi did a pretty good job of introducing a lot of the things that I make. 23 00:02:12,280 --> 00:02:19,820 But, yeah, I like ESP32s a lot, and that's kind of my bread and butter when it comes to things that I use to compete in the RFCTF. 24 00:02:19,820 --> 00:02:27,040 So, yeah, I've been launching balloons and gluing ESP32s to circuit boards and making all kinds of stuff like that. 25 00:02:28,780 --> 00:02:30,300 So a little bit of background. 26 00:02:30,440 --> 00:02:49,800 So, like, back in January, I think it was, Fortinet, some Fortinet employee was talking to some IT trade publication, and either through something being lost in translation or perhaps maybe a bit of intentional FUD, the story that ended up coming out was that there was, 27 00:02:49,800 --> 00:02:54,560 like, 7 million toothbrush botnet that was actively attacking a Swiss bank. 28 00:02:55,700 --> 00:03:01,460 And so then there was a lot of consternation on Twitter about whether or not that was a real thing that could happen or could not happen. 29 00:03:01,680 --> 00:03:06,680 A lot of people feeling very intensely about whether or not that was even a possible thing to do. 30 00:03:08,160 --> 00:03:20,040 And eventually, UK Daniel Card on Twitter actually ended up finding a toothbrush that had, they claimed to have wireless functionality built in, which I thought was super interesting, and he went and posted a picture to Twitter. 31 00:03:20,920 --> 00:03:23,420 And within that Twitter, within that... 32 00:03:25,260 --> 00:03:28,180 Within that photo, there was actually the FCC ID. 33 00:03:28,180 --> 00:03:37,080 And so I suppose if you take one thing from this talk, is that the FCCID.io website is, like, my number one hacking resource. 34 00:03:37,540 --> 00:03:46,500 And the reason why is because they upload photos of the internal circuit boards as part of the FCC certification process. 35 00:03:46,560 --> 00:03:55,860 And so if you've got something that's FCC ID, or if you know who the manufacturer of that device is, you can plop that in there and, boy, how do you get some beautiful photos of stuff? 36 00:03:55,860 --> 00:04:00,000 And you don't even have to buy it, so you can figure out what is in the thing before you even spend any money on it. 37 00:04:00,640 --> 00:04:10,000 So I went ahead and I looked it up, and if you can see where the arrow is over there, that certainly looked like it was going to be serial UR broken out. 38 00:04:10,220 --> 00:04:13,360 So that's an exciting thing if we're trying to create a botnet. 39 00:04:13,820 --> 00:04:20,700 So I went ahead and, you know, thinking that, you know, I should be able to play with this thing if I actually buy one. 40 00:04:20,700 --> 00:04:23,440 And I went ahead and did buy one. 41 00:04:25,840 --> 00:04:29,760 So real quick, so the ESP32 tools. 42 00:04:30,240 --> 00:04:31,080 These tips are... 43 00:04:31,080 --> 00:04:33,240 Well, the tips are in everything, and for good reason. 44 00:04:33,240 --> 00:04:34,840 They are dirt cheap. 45 00:04:35,960 --> 00:04:46,140 I've got, like, an ESP32 Borg cube that I made, and, like, I got a guy on Alibaba who will sell me those for, like, 62 cents apiece. 46 00:04:46,580 --> 00:04:48,260 And so these things are ubiquitous. 47 00:04:48,260 --> 00:04:49,680 They're getting put in more and more things. 48 00:04:51,260 --> 00:04:57,180 And, at least in my opinion, granted, I've never actually programmed anything other than an ESP32. 49 00:04:57,500 --> 00:04:59,440 Sorry, STM32 fans. 50 00:05:00,040 --> 00:05:02,980 At least in my opinion, the tooling is good, or at least adequate. 51 00:05:04,020 --> 00:05:06,940 And with ESP tool, you can actually just read the flash. 52 00:05:06,940 --> 00:05:23,420 So assuming we're able to figure out how that serial UR is broken out, figure out the baud rate, all of that good stuff, you can just get the firmware, assuming no EPs have been burned in, is generally not the case, and we'll touch on that a bit in the conclusion. 53 00:05:23,440 --> 00:05:28,520 So we went ahead and bought one, and it showed up. 54 00:05:29,060 --> 00:05:34,640 And so, as you can see over there, that is, in fact, a serial UR that we have broken out there. 55 00:05:34,640 --> 00:05:42,500 So we've got the ground 3.3 volts RXTX reset, as well as boot. 56 00:05:42,500 --> 00:05:47,840 So the thing showed up, I took it apart, and I was very excited to see what I had found. 57 00:05:49,040 --> 00:05:51,800 And that's essentially when the trouble starts. 58 00:05:52,740 --> 00:06:09,420 So I don't have any of those fancy PC bytes, like probe out things, and so when it comes to me hooking up stuff to a circuit board, I'm usually just trying to solder stuff on there in the grossest way, because I'm not the world's best solderer. 59 00:06:10,940 --> 00:06:25,860 So essentially, solder up to TX RX ground, we don't need to supply 3.3 volts through this, because we can plug it in through the USB-C adapter at the bottom of it, which is how the device is normally charged. 60 00:06:27,320 --> 00:06:31,760 And that's good enough to get it turned on, and trying to start talking to it. 61 00:06:33,760 --> 00:06:42,900 And so I tried a lot of things, I had to figure out whether or not, is the RX that's printed on the board, is that its RX, or is that where I'm supposed to hook up my RX, like what's the baud rate. 62 00:06:43,660 --> 00:06:56,740 And I essentially manually fuzzed the thing for a while, it could never get it to talk to me, ended up actually writing up some Python code to try and automate that fuzzing, that unfortunately I didn't get very far with. 63 00:06:59,060 --> 00:07:10,300 And so eventually, I went back to the documentation and read that, and it's really amazing the kind of secrets that they hide away from you inside the documentation that's on the manufacturer's website. 64 00:07:10,980 --> 00:07:31,100 And so, essentially there's strapping pins on an ESP32, for those of you that might not be familiar with microcontrollers, that's essentially a kind of spell or incantation you have to do on the device using the GPIO pins, depending on what order you bring those to 3.3 volts or ground, 65 00:07:31,100 --> 00:07:35,780 is going to dictate essentially the mode that the MCU boots up into. 66 00:07:35,780 --> 00:07:50,880 And so, eventually I figured out that I need to supply power to the thing while holding the boot pin to ground, and then bring the reset to ground, and then put them both to floating. 67 00:07:51,080 --> 00:08:06,440 And with that, I'm able to get the stub from the ESP32 tool to load into the boot loader of the MCU, and then from that we're actually able to dump the firmware, using the command that I showed a couple slides back. 68 00:08:06,440 --> 00:08:11,480 So , once you've got the firmware, then we can start doing reverse engineering. 69 00:08:11,800 --> 00:08:13,620 Spoiler alert, I'm terrible at reverse engineering. 70 00:08:13,620 --> 00:08:15,200 I don't really get how Ghidra works. 71 00:08:15,760 --> 00:08:20,120 It's the thing I'm trying to get better at, but for right now it's essentially kind of magic to me. 72 00:08:20,120 --> 00:08:25,460 But, not understanding how a thing works has never stopped me from trying to, you know, fuck with that thing. 73 00:08:25,460 --> 00:08:34,920 So , essentially once you get the firmware from ESP32 tool, you need to parse that out into the various partitions. 74 00:08:34,920 --> 00:08:43,840 You need to take the partition that actually contains the code that you're interested in investigating, and you turn that into an ELF, and then once you've got your ELF file, you can load that into Ghidra for analysis. 75 00:08:43,840 --> 00:08:58,660 I think I'm also probably skipping a step that I forgot here, where because you're not looking at x86 stuff, you actually need to be able to tell Ghidra what the architecture of the chip and the code that you're looking at is using. 76 00:08:58,660 --> 00:09:00,700 And that way it can try and make sense of things. 77 00:09:01,060 --> 00:09:23,280 So , yeah, so we pop this into Ghidra, and one of the very nice things about Ghidra is that it'll actually show you kind of a code flow, and you can see here that kind of at the very beginning, one of the very first things the thing does at all when it boots is that we see that there's a loop that passes in a string of evo-era. 78 00:09:23,280 --> 00:09:25,900 Evo-era is actually the manufacturer of this toothbrush. 79 00:09:27,200 --> 00:09:31,340 And so that's a curious thing that kind of roused my suspicions. 80 00:09:33,220 --> 00:09:46,680 So then as I kept going, it turns out that there's another while loop passing in the string 1, 2, 3, 4, 5, 6, 7, 8, which if you've done Wi-Fi stuff for long enough, you recognize that 8 characters is the minimum amount of characters that you need in order to have a valid Wi-Fi password. 81 00:09:46,780 --> 00:09:54,040 And so we've got a while loop where we're doing some stuff with evo-era, and we're doing some stuff with 1, 2, 3, 4, 5, 6, 7, 8. 82 00:09:54,040 --> 00:10:00,300 If you really are scared of Geter, like I was, you can also just run strings against the binary. 83 00:10:00,420 --> 00:10:08,640 I don't know that this is actually a valid way to do reverse engineering, quite frankly, or I don't want to say invalid, but perhaps not time efficient. 84 00:10:08,920 --> 00:10:18,660 Because trying to figure out which of these strings is potentially a Wi-Fi network or password seems like you are going to be fuzzing for a very long time. 85 00:10:18,660 --> 00:10:37,140 So based on having gotten that evo-era string and the 1, 2, 3, 4, 5, 6, 7, 8 string, we've got a hypothesis that perhaps if we stand up our own Wi-Fi network with that SSID and that password, then maybe some stuff will happen. 86 00:10:37,880 --> 00:10:45,560 And so the way that I went about doing this was essentially to stand up a Raspberry Pi with two wireless networking cards. 87 00:10:45,680 --> 00:10:51,860 One of those is going to actually host the actual network that we intend the device to connect to. 88 00:10:51,860 --> 00:10:54,580 So that's the one that's going to be broadcasting the evo-era network. 89 00:10:54,580 --> 00:10:59,080 And then we've got another card that we're going to go ahead and throw into monitor mode and then pipe that into Wireshark. 90 00:11:00,440 --> 00:11:04,140 And that way we can monitor everything that's going on. 91 00:11:04,480 --> 00:11:08,980 A lot of different tools that are kind of around and available to set that up. 92 00:11:09,060 --> 00:11:16,600 I happen to be partial to RASP-AP because I'm too lazy to edit host APD manually. 93 00:11:16,600 --> 00:11:20,520 So we set that all up and we get to sniffing around. 94 00:11:20,520 --> 00:11:23,860 We turn the toothbrush on and we get them in 4K60. 95 00:11:23,860 --> 00:11:27,500 So that's probably... oh yeah, that is much too small for any of you to be able to see. 96 00:11:28,220 --> 00:11:30,360 It's much too small for even me to be able to see. 97 00:11:30,860 --> 00:11:35,580 But essentially, if you look real close, we can see that... 98 00:11:36,740 --> 00:11:44,680 not only does our device is beaconing for an evo-era network, but we can see that it connects to our network and then it actually makes several requests. 99 00:11:45,320 --> 00:11:51,360 All of which, if these were bigger, you'd be able to see that they're entirely in plain text. 100 00:11:52,100 --> 00:11:58,260 This device is making a whole bunch of API requests to the backend and they are all HTTP. 101 00:11:58,260 --> 00:11:59,920 Every single one of them. 102 00:12:03,200 --> 00:12:04,080 So what does it do? 103 00:12:04,080 --> 00:12:11,620 Essentially, it makes several calls to na-api.evo-era.com on port 80. 104 00:12:11,720 --> 00:12:14,160 And like I said, those are entirely plain text. 105 00:12:15,420 --> 00:12:27,500 And so every time one of these packets gets sent, as long as the toothbrush gets back data from the server that validates, then it'll go ahead and make the subsequent request. 106 00:12:27,880 --> 00:12:34,680 And so there's a back-and-forth, back-and-forth, and there's like four or five API requests and subsequent responses that happen. 107 00:12:34,720 --> 00:12:41,900 And then the thing that we're most particularly interested in is the second-to-last request... 108 00:12:41,900 --> 00:12:59,700 or, I'm sorry, the... eventually what ends up happening is the toothbrush responds back to the backend with its current firmware version, at which point the server evaluates whether or not it has a firmware version that's a higher version number than the version number that it was just communicated the toothbrush was running. 109 00:12:59,780 --> 00:13:15,220 If the server decides that there is, in fact, a more up-to-date firmware, then it can reply back to the toothbrush with a URL, again, over HTTP, where the toothbrush should download a new bin file from. 110 00:13:17,220 --> 00:13:19,180 So, a quick little update on... 111 00:13:19,180 --> 00:13:21,420 or info on ESP32 updates. 112 00:13:21,960 --> 00:13:27,440 Kind of one of the main selling points of these chips is that they almost all have some kind of connectivity. 113 00:13:28,360 --> 00:13:31,320 Almost always Wi-Fi, and I think everything has Bluetooth at this point. 114 00:13:31,880 --> 00:13:41,280 And so one of the very useful features of that connectivity is that we can actually load new code into the device wirelessly, so we don't need to flash everything through the Sudo UART. 115 00:13:42,800 --> 00:13:47,580 Espressif provides a lot of examples in both Arduino and their native IDF for these. 116 00:13:50,080 --> 00:13:54,620 There's a lot of different ways that they demonstrate being able to do this. 117 00:13:54,720 --> 00:14:12,260 You can download code from an S3 bucket, you can have the device itself actually stand up its own AP, and then you can connect to that and upload new firmware, or essentially you can do the same thing kind of opposite, where the ESP32 will connect to a network, 118 00:14:12,260 --> 00:14:15,500 and then a device can push firmware to it. 119 00:14:17,980 --> 00:14:28,400 So then for our Toothbrush RGE chain, what we need is to stand up a wireless network that has SSID of eVoera, and a password of 12345678. 120 00:14:28,400 --> 00:14:32,040 We also need to be running a Poison DNS server on that very same network. 121 00:14:32,040 --> 00:14:59,980 That way, when the Toothbrush makes a DNS request for that na-api.evoera.com, we can reply back with the IP address of our own web server, whereby we can essentially forge the requests, and send all those valid communications back and forth, and eventually serve that bin file that we'll also need to have a way of serving. 122 00:14:59,980 --> 00:15:06,360 So , there are libraries that do all these things for the ESP32. 123 00:15:06,680 --> 00:15:11,820 In fact, they're mostly all built into the actual framework that Espressif puts out. 124 00:15:11,820 --> 00:15:25,120 So , we need to host a network, we need to run a DNS server, we need to run a web server, host a file, and so we spoiler alert, or I suppose we're boating, just need to write our own code that runs on an ESP32 that does all of that. 125 00:15:27,060 --> 00:15:30,240 And so, as it turns out, most of this is actually, thankfully, pretty easy. 126 00:15:30,240 --> 00:15:31,620 Standing up a network, super easy. 127 00:15:31,620 --> 00:15:34,280 That's like one of the core competencies of an ESP32. 128 00:15:34,840 --> 00:15:36,700 Running a web server, again, same thing. 129 00:15:36,700 --> 00:15:39,040 That's like right in the wheelhouse of ESP32 stuff. 130 00:15:39,040 --> 00:15:40,500 Running a DNS server, same. 131 00:15:42,080 --> 00:15:50,300 Hosting a binary on a web server, like that's just a file on a web server, and, you know, we can run a web server on an ESP32, so we're looking great there. 132 00:15:51,420 --> 00:16:10,480 Unfortunately, making a binary that we host that is able, excuse me, making a binary that contains itself and is able to serve that version of itself to other devices as it turns out is kind of stupid hard. 133 00:16:11,380 --> 00:16:14,620 So, quick primer on ESP32 storage partitions. 134 00:16:14,780 --> 00:16:26,900 Most of these devices have around four megabytes worth of storage and how you allocate those, presuming that you have the ability to flash the device over its serial UART is largely left up to you. 135 00:16:27,900 --> 00:16:35,780 There's a graph over on the right that kind of goes over the various partitions that are available for you to use or not use at your leisure. 136 00:16:36,120 --> 00:16:41,320 So, OTA0 and OTA1, those are going to be both where you can store your actual sketch. 137 00:16:41,320 --> 00:16:53,800 The reasons why we have an OTA0 and an OTA1 is because when we're running our active code from one of those partitions and we want to update it, we need to have a place to store our updated code. 138 00:16:53,800 --> 00:17:12,060 So, essentially the process is that you would write your new code to the OTA partition that you're not running and then once you've validated that, you've actually gotten that firmware written to the storage, the new firmware that is essentially the device reboots and it knows to start running from the other partition. 139 00:17:13,300 --> 00:17:17,600 So, the toothbrush that we're looking at has four megabytes of total storage. 140 00:17:17,600 --> 00:17:21,820 That graph on the right is for a different device. 141 00:17:22,920 --> 00:17:24,620 It's an important thing to know. 142 00:17:24,980 --> 00:17:34,880 Being able to change your partition table is a thing that is generally only available for you to do if you are flashing the device over the serial UART. 143 00:17:34,920 --> 00:17:44,680 If you are doing an OTA update, the OTA update process in and of itself doesn't provide a mechanism through which you can change your partition table. 144 00:17:45,180 --> 00:17:54,660 If you want to change the partition table over OTA updates, what you end up having to do is essentially trample in an update. 145 00:17:54,660 --> 00:18:13,760 You would need to load code into the other OTA partition that you're not running from and then that code itself needs to modify the code that actually stores the partition table and then you would need to do another update where you could actually load code into the storage of your newly defined partition table. 146 00:18:15,820 --> 00:18:18,900 So now we get into a little bit of the challenge of self-referencing firmware. 147 00:18:19,800 --> 00:18:27,420 At least on the existing partition table of the device itself as it comes from the factory, there's no SPFs partition. 148 00:18:27,780 --> 00:18:43,620 Essentially what the SPFs partition is, is that's just essentially kind of more regularly formatted storage such that if you have a device and it's going to display a picture on its screen or whatever, you'd usually end up putting that picture in the SPFs partition. 149 00:18:49,840 --> 00:18:53,120 Essentially, in order to compile... 150 00:19:02,600 --> 00:19:11,200 There's no SPFs partition, so that means that we can't compile our worm and reference a bin file and the SPFs partition within it and then after compiling the worm, load it into the SPFs partition. 151 00:19:11,980 --> 00:19:33,920 Essentially, this sets up a terrible self-referential problem whereby our code needs to be able to reference the raw bytecode of its own compiled form which gets you into this terrible kind of nesting doll situation where our uncompiled code needs to have the exact copy of the compiled code in it and it's a chicken and egg problem. 152 00:19:34,500 --> 00:19:38,680 The way that I went about trying to solve this was very terrible, quite frankly, and very silly. 153 00:19:42,180 --> 00:19:47,100 I won't read to you the entire steps of my very heinous and harebrained tool scheme. 154 00:19:48,300 --> 00:20:05,300 The important part there is down in red at the bottom where essentially after compiling and then decompiling and then re-referencing and then re-compiling like 8 times eventually I was able to make my firmware that was able to reference a complete version of itself. 155 00:20:05,560 --> 00:20:22,820 The issue with this is the size of the final binary that gets compiled at that point has a ton of dead code inside of it and the final size of the sketch ends up being significantly larger than what we can flash on a normally partitioned ESP32C3 with 4MB of flash which is our intended starting vector to the toothbrush. 156 00:20:23,520 --> 00:20:30,860 We can change the size of the partition on our evil ESP32 it's like our initial infection vector. 157 00:20:35,900 --> 00:20:40,400 So we can control the partition table of the device that we have the ability to flash over serial. 158 00:20:40,540 --> 00:20:45,060 Our initial patient zero of the botnet if you will. 159 00:20:47,120 --> 00:21:11,020 And that'll work except that then essentially you end up trying to shove a 2.5MB worth of data into the OTA partition on the actual brush and that partition is only 1.9MB based on the partition table we got from dumping the original firmware and so unfortunately the update always fails because we're trying to put 2.5MB worth of data into a 1.9MB bag. 160 00:21:12,860 --> 00:21:18,360 Luckily there are many people on the internet and a lot of them are way smarter than I am. 161 00:21:18,500 --> 00:21:37,060 So big shout out to ATC1441 who after I was posting all the terrible things that I was trying to do with compiling my firmware like 7 times so that it could finally reference itself asked me why I wasn't just doing it the smart way and the answer is that I didn't know that there was a smart way. 162 00:21:37,060 --> 00:21:39,220 If I did I would have started that way. 163 00:21:40,820 --> 00:22:14,120 And so essentially what we can do here is if we go back to this one you can see that there's actually memory addresses on that chart and so essentially really all we've got to do is when it comes to serving our bin file we just reference starting at that pointer and then we chunk through at I think it's like 1024 bytes at a time and my little Russian nesting doll firmware experiment I think I got absolutely nowhere with getting that to actually work Tim yesterday . 164 00:22:14,120 --> 00:22:14,640 We did a lot of stuff together. 165 00:22:17,480 --> 00:22:20,940 And then ATC came along and told me how to do it for real. 166 00:22:21,400 --> 00:22:26,660 And I think I had my proof of concept working within 45 minutes. 167 00:22:26,660 --> 00:22:27,500 Thanks to Tim. 168 00:22:27,500 --> 00:22:37,020 So one of the key things here is that we need to reference the firmware from the partition that we're running. 169 00:22:44,120 --> 00:23:05,700 So essentially, every time you do an OTA update onto an ESP32, you're going to change the partition that the active sketch is being run from, and so if the device has been updated before, there's no real way to know definitively what, or rather, there's no way to know pre-run time what partition we're running from. 170 00:23:05,700 --> 00:23:22,620 Thankfully, the Arduino tool set, or rather the ESP32 tools for the Arduino core library includes some handy methods by which we can just ask it which one we're running on and then reference the memory address from there. 171 00:23:23,940 --> 00:23:33,880 Like I said, I had a really cool video to show you, but the Wi-Fi doesn't work here, which is probably partially my fault, well enough to actually be able to download that. 172 00:23:34,020 --> 00:23:40,620 But I do have the toothbrush up here if you want to come take a look on the infected toothbrush there. 173 00:23:41,940 --> 00:23:45,320 So now we have full RCE, we can run our own code on the toothbrush. 174 00:23:45,400 --> 00:23:49,980 I don't know if you can see, that's my little ransomware funny ha-ha photo. 175 00:23:51,340 --> 00:23:59,220 Quite frankly, it's very silly to try to make a toothbrush botnet for a couple of reasons. 176 00:23:59,280 --> 00:24:16,180 Mainly that the way that we're able to spread and infect subsequent toothbrushes is that we need to be running our own Wi-Fi network such that other devices will connect to it, and then we need to serve firmware to those devices, which means that at any point we're trying to attack other stuff on the internet. 177 00:24:16,600 --> 00:24:29,040 By definition, that means that we're not also attacking the things physically in the room with us, because we're just broadcasting our own network there as opposed to connecting to a network that's being broadcast to us. 178 00:24:30,420 --> 00:24:40,620 So once you have full RCE on the thing, it's not entirely that novel to write ESP32 code that'll make a HTTP GET request that could potentially be something malicious. 179 00:24:41,420 --> 00:24:43,480 But nevertheless, we write a POC anyways. 180 00:24:43,480 --> 00:24:46,840 And so essentially the code will go ahead and scan for open networks. 181 00:24:46,840 --> 00:24:50,300 If there's an open Wi-Fi network, it'll go ahead and connect to it. 182 00:24:50,300 --> 00:25:16,260 It'll then make a request to GitHub where I've set up a really terrible C2 with some JSON where you can define an IP address as well as a payload, at which point the ESP32 will download that information, send the payload to the target IP address, and then resume broadcasting the EvoEra network for... 183 00:25:16,840 --> 00:25:20,580 I want to say it's like a minute and a half, which will then... 184 00:25:20,580 --> 00:25:22,860 So you've got a minute and a half to... 185 00:25:23,780 --> 00:25:24,780 It's dark in here. 186 00:25:25,220 --> 00:25:39,420 Have a minute and a half to infect other brushes, at which point, if it doesn't find any brushes to infect, it'll go back to scanning for open Wi-Fi networks, and it'll scan for open Wi-Fi networks for a minute and a half, and essentially it just goes back and forth between scanning for Wi-Fi networks that it can connect to, 187 00:25:40,820 --> 00:25:44,120 as well as continuing to try to connect... 188 00:25:44,120 --> 00:25:48,060 or not connect to, but continuing to try to infect other devices. 189 00:25:49,860 --> 00:25:50,520 So, yeah. 190 00:25:51,360 --> 00:26:02,640 Community control here for battery-powered Wi-Fi devices is pretty terrible, so if you're aspiring botnet creator, I don't know that I would recommend battery-powered Wi-Fi devices. 191 00:26:02,640 --> 00:26:08,620 Like, hard-wired into mains voltage is probably the way that you actually want to go there. 192 00:26:10,140 --> 00:26:12,260 So to the conclusion, so... 193 00:26:12,260 --> 00:26:28,300 If you look at the App Store information on Google Play, there are definitely not 3 million of these brushes, or if there are, 3 million people bought these smart toothbrushes and then didn't bother to download the app to actually enable any of that technology. 194 00:26:28,300 --> 00:26:35,380 But there certainly are at least 3 million ESP32s out there in production, if not significantly more. 195 00:26:36,460 --> 00:26:52,220 These chips are used in extremely low-cost devices, and I don't want to besmirch the good name of Espressif, but I think essentially what ends up happening is that companies are out there, they're trying to get stuff to market as quickly and as cheaply as possible. 196 00:26:53,420 --> 00:26:55,660 ESP32s are a way to do that, but... 197 00:26:58,300 --> 00:27:12,220 At this point, it kind of feels like that if you're putting ESP32s into a real actual product that you intend to sell to the public, that I'm just going to assume that you've probably cut every possible corner, and that you went ahead and used, like you've already did, 198 00:27:12,220 --> 00:27:27,380 the HTTP methods to do the OT update, and didn't use the HTTPS one, which Espressif does provide one single example of, whereby you've got to do a whole bunch of stuff where you hard-code your own cert within your own sketch. 199 00:27:27,380 --> 00:27:37,120 And so, my suspicion is that essentially any product that has an ESP32 in it is probably vulnerable to something along the lines of what you saw here. 200 00:27:38,780 --> 00:27:54,000 So depending on the form factor of the chips that are being put into these new products, odds are better than good that the device will have to go through FCC certification, and as a part of that process, like I said earlier, companies have to send their devices into a lab, 201 00:27:54,000 --> 00:27:57,260 and have those devices be photographed. 202 00:27:57,360 --> 00:28:07,100 Those photos are included in their FCC report, and almost nobody bothers to redact any of the photos, which is a thing that the FCC will allow you to do, and no one actually bothers with. 203 00:28:07,540 --> 00:28:29,000 And so that leads me to my next project, where I'm currently working on a computer vision system that'll subscribe to the RSS feed that the FCC puts out of all of the new products that are going through certification, checks and sees if there are internal photos associated with whatever new product is going through certification, 204 00:28:29,000 --> 00:28:40,780 download those photos, and then automatically send me notifications if the computer vision system is able to determine that it thinks that there's an ESP32 on that board. 205 00:28:40,780 --> 00:28:47,200 So these chips are everywhere, they're ripe for abuse, and I heavily encourage you to go out there and find them. 206 00:28:48,220 --> 00:29:07,420 Just recently, I believe it was Bishop Fox put out some research where they ended up getting O'Day on every Traeger Wi-Fi grill they'd ever made, because their flaws weren't as low-hanging fruit as this, but weren't that complicated either. 207 00:29:07,420 --> 00:29:26,160 So I would encourage you to go forth and to find these chips and devices around your home, or hopefully you don't have them in your home yet, but buy them and play with them, because it's a lot of fun, and they are, like I said, very ripe for abuse, and you can make household objects do strange things, 208 00:29:26,160 --> 00:29:28,500 and your own bidding. 209 00:29:29,980 --> 00:29:31,780 And yeah, that's the end of the presentation. 210 00:29:31,780 --> 00:29:33,900 If anybody has any questions, I'd be happy to answer. 211 00:29:59,080 --> 00:30:09,180 Well, so I'm of the opinion that if there's two of these toothbrushes, like that meets my, I don't know, legal definition of botnet, like, is it a good botnet? 212 00:30:09,180 --> 00:30:13,040 Is it equivalent in power as the Mirai botnet? 213 00:30:13,040 --> 00:30:14,260 Like, absolutely not. 214 00:30:15,540 --> 00:30:30,540 But one of the things that I was trying to do with this, is I had a version of the firmware that was essentially doing port scanning, and I was like, oh, it would be funny if I could get my IP address to show up in gray noise, as like a port, oh, this person's doing port scanning from this IP address, 215 00:30:30,540 --> 00:30:38,380 whatever, but the speed that these things work at, like the connectivity, is god-awful. 216 00:30:38,600 --> 00:30:41,060 Like, the scalability of it is pretty bad. 217 00:30:41,120 --> 00:31:01,460 I suppose if you had some kind of real simple attack that you could do that would grant you access to whatever it was you were trying to hack, it could work, but between kind of how unreliable the connectivity is and the fact that they're battery-powered... 218 00:31:03,920 --> 00:31:07,860 I'm going to go ahead and say... I'd never say never, but I'm going to say no, probably not. 219 00:31:17,070 --> 00:31:18,150 What was that? 220 00:31:20,130 --> 00:31:24,890 Oh, so that's one of the more hilarious things about this product, is that it's a smart toothbrush. 221 00:31:24,890 --> 00:31:27,390 It is not a powered toothbrush. 222 00:31:27,930 --> 00:31:33,570 So like, I have like a Sonicare toothbrush, right, and you like hit the button, and then it like zzzz, and you like brush your teeth with it. 223 00:31:33,590 --> 00:31:35,450 This thing doesn't go zzzz. 224 00:31:36,690 --> 00:31:39,150 So yeah, no, I don't get it either. 225 00:31:39,270 --> 00:31:52,510 So like the entire selling point is that there's a load cell that's connected between the head of the brush and the body of it, and then like a nine degree of freedom IMU inside. 226 00:31:52,650 --> 00:32:05,510 And so every time you finish brushing your teeth, it'll send information about like where you were brushing and how hard you were brushing to the Alibaba cloud, which is where all of their backend infrastructure is running out of. 227 00:32:05,550 --> 00:32:13,630 And then the app on your phone connects to the Alibaba cloud to retrieve that like brush health... 228 00:32:14,350 --> 00:32:19,570 I don't know, they give you a bunch of weird metrics that no dentist that I've ever been to has ever asked me about. 229 00:32:19,570 --> 00:32:26,510 So again, it's a product that I am apparently not in the target market for, for at least its intended use. 230 00:32:39,100 --> 00:32:41,580 So I think I saw one person has a toothbrush. 231 00:32:41,580 --> 00:32:49,540 If you also have a toothbrush, you can come up, and if you set it next to mine, we can see if we can really make a... 232 00:32:49,540 --> 00:32:53,760 we'll have two toothbrushes meeting my legal definition of a botnet. 233 00:32:54,680 --> 00:33:07,200 I will say though, I am massively skeptical of being able to see it actually work just based on how absolutely malicious the RF environment is in here right now. 234 00:33:10,340 --> 00:33:25,220 So yeah, so we got the Bluetooth logo right now, and then if it'll find it, the Bluetooth logo should switch to the Wi-Fi logo, and then you'll see that there's going to be progress bar loads for the bin file to be transferred. 235 00:33:26,620 --> 00:33:38,340 If you want to just like keep mine next to yours for as long as you want to hang out in the village, and like hopefully maybe it'll work, my hopes are unfortunately not all that high. 236 00:33:39,520 --> 00:33:40,560 Okay, cool. 237 00:33:41,420 --> 00:33:42,000 Yeah. 238 00:33:52,920 --> 00:33:54,180 I mean, yeah, absolutely, right? 239 00:33:58,300 --> 00:34:12,220 You're not going to convince me that these are going to make a great botnet, but as far as bringing a device into an area, I don't know, I've never worked in a SCIF, but I get that they exist and that they're supposed to be secure. 240 00:34:12,220 --> 00:34:17,460 How many SCIF managers know that they need to be checking for people? 241 00:34:17,620 --> 00:34:22,400 It seems weird to me to bring a toothbrush into the SCIF in the first place, so that's suspicious all on its own, I think. 242 00:34:22,440 --> 00:34:37,200 But I can certainly imagine environments like, I don't know, federal correctional facilities or something, I don't know, where you may not assume that, one, a toothbrush would even have Wi-Fi, let alone be out there purposely doing malicious things. 243 00:34:37,200 --> 00:34:56,960 I think being able to hide Wi-Fi stuff into objects that you wouldn't expect it to have, that you wouldn't expect it to have Wi-Fi, is certainly an interesting thing and it touches on some of the other projects I've been working on where, like, I don't know if you all saw where, 244 00:34:56,960 --> 00:35:03,700 whatever the, I think it was the Chinese version of the NSA, it was like hot gluing ESP32s into power strips and stuff. 245 00:35:04,560 --> 00:35:11,020 So yeah, anytime you can get a Wi-Fi radio in a place where people wouldn't expect it, I think that's certainly ripe for abuse. 246 00:35:20,940 --> 00:35:25,620 All right, well, if nobody has any questions, nobody else has any other questions, I think we'll call it. 247 00:35:25,620 --> 00:35:27,500 Thanks for coming to the talk.