1 00:00:00,000 --> 00:00:04,680 My name is Jeff Kitson. I'm a securities researcher with Spider Labs Trustwave. My 2 00:00:04,680 --> 00:00:09,260 presentation today is Trainwreck. Uh, today is not only my first time at DEF CON, but it's 3 00:00:09,260 --> 00:00:14,360 also my first presentation of this type. So, I think we'll do alright. If I have to take a 4 00:00:14,360 --> 00:00:24,560 couple breaths, bear with me. So, what I want to talk to you today, about today is the 5 00:00:24,560 --> 00:00:29,100 device that of course we're focusing on. How I found this device, how it sort of entered my 6 00:00:29,100 --> 00:00:35,480 realm of knowledge, uh, the vulnerability that I found, how we got the vendor to fix it, and 7 00:00:35,480 --> 00:00:38,380 then the tools that I'm going to distribute to you guys so that you guys can actually test 8 00:00:38,380 --> 00:00:42,240 these yourself and keep the pressure on this manufacturer to make sure that they stay up on 9 00:00:42,240 --> 00:00:50,480 their security stance. So, how all this got started. It's a pretty personal story. On 10 00:00:50,480 --> 00:00:55,040 December 29th my furnace failed. I'm a first time homeowner. It was a pretty big experience to 11 00:00:55,040 --> 00:00:58,200 have my furnace fail in the middle of a Michigan winter. I don't know how many of you are 12 00:00:58,200 --> 00:00:58,920 familiar with Michigan. 13 00:00:59,100 --> 00:01:03,660 Or just winter at all. But it sucks when your furnace fails. And it can be pretty dangerous, 14 00:01:03,740 --> 00:01:07,960 especially to the water pipes in your house. So, I couldn't really delay on getting it fixed. I 15 00:01:07,960 --> 00:01:13,620 had to call up a manufacturer and have them come in and evaluate the situation. The problem that I 16 00:01:13,620 --> 00:01:17,720 actually had with the furnace was my heat exchanger failed and started developing cracks. And 17 00:01:17,720 --> 00:01:20,620 that's how you get carbon dioxide in your house. So, I'm actually kind of lucky I didn't die from 18 00:01:20,620 --> 00:01:29,080 this. Yeah. You can see it about, uh, two pipes, well, not on the, not on the monitor. But 19 00:01:29,100 --> 00:01:34,680 later you'll be able to see them. So, I had to get a new furnace. I felt a lot like this kid here in 20 00:01:34,680 --> 00:01:42,200 the photo. I called up the local dealer that had worked on my unit in my house before. And they came 21 00:01:42,200 --> 00:01:47,200 out and really acknowledged that it wasn't safe to operate. How it was failing. So, by law they 22 00:01:47,200 --> 00:01:52,700 pretty much had to turn it off and I had to buy a new one. Now, the model that I selected was a 23 00:01:52,700 --> 00:01:56,800 little bit more efficient than the last furnace. Because when you're looking at replacing a 24 00:01:56,800 --> 00:01:59,080 furnace or replacing heat exchanger, it's about three to four times more efficient than the last furnace. So, 25 00:01:59,080 --> 00:02:03,460 whole day's worth of labor to get the exchanger replaced or you can buy a new furnace which is 26 00:02:03,460 --> 00:02:08,200 more efficient and it's going to get you a couple rebates, better power bills, better gas 27 00:02:08,200 --> 00:02:12,500 bills, so it was worth it to get the new furnace. The furnace that I chose was a train 28 00:02:12,500 --> 00:02:18,820 furnace because this dealer was a train dealer and it came with a smart IOT thermostat. It 29 00:02:18,820 --> 00:02:22,660 wasn't really an option, it came with it by default. They say oh you want one of our new 30 00:02:22,660 --> 00:02:27,580 furnaces, well our new packages come with smart IOT thermostats. So you get it because 31 00:02:27,580 --> 00:02:36,440 it's required for the device and it's called an XL850. So what exactly did I buy? Uh to be 32 00:02:36,440 --> 00:02:40,740 honest the day of I wasn't really sure because it just sort of pushed on you. You're in an 33 00:02:40,740 --> 00:02:43,460 emergency situation where you have to buy a new furnace, you think you're making the best 34 00:02:43,460 --> 00:02:49,340 choice. Uh I, one of the reasons I made this decision also was because I knew it was an IOT 35 00:02:49,340 --> 00:02:54,440 device and that kind of wetted my chops a little bit and I didn't go for the model uh above 36 00:02:54,440 --> 00:02:57,560 this because on that one this smart device actually might have been a little bit better. 37 00:02:57,560 --> 00:03:03,900 It modulates the gas valve. I didn't quite feel comfortable playing with that so I stuck uh 38 00:03:03,900 --> 00:03:09,320 stuck in the area where I was comfortable. So if we want to get technical and we do because this 39 00:03:09,320 --> 00:03:17,520 is DEFCON, the device is a ComfortLink 2 XL850. And this is one of about 3 or 4 models that 40 00:03:17,520 --> 00:03:22,720 Trane pushes out with their different units and you can see the manufacturer's page here and a 41 00:03:22,720 --> 00:03:26,980 couple of links that will be pretty relevant. One of the things you'll notice on this page is that, 42 00:03:26,980 --> 00:03:32,800 there is a download for software update. This manufacturer allows not only over the air updates 43 00:03:33,420 --> 00:03:38,480 but you can download it yourself, load it to a USB, hook it into the device and then it'll evaluate 44 00:03:38,480 --> 00:03:43,840 it, see if it's valid and boot the new image. Now if you go to that page today you won't see that 45 00:03:43,840 --> 00:03:49,480 link there anymore. Apparently they decided the best way to deal with uh this notice when they got 46 00:03:49,480 --> 00:03:55,680 it was to quickly remove the ability for people to upload their own software. But the link's still 47 00:03:55,680 --> 00:03:55,940 active. 48 00:03:58,100 --> 00:04:02,640 So the features this thing has, uh it's got a lot of features. Particularly it's got lots of 49 00:04:02,640 --> 00:04:08,200 interwa- uh internet. It speaks Z-Wave. So it works as a Z-Wave controller. This thing is meant 50 00:04:08,200 --> 00:04:12,800 to go out and touch the other things in your house and interact with your whole Z-Wave environment 51 00:04:12,800 --> 00:04:18,840 that you have working. It has an integrated Nexia bridge. So a Nexia bridge on its own is 52 00:04:18,840 --> 00:04:23,360 something that's meant to control a lot of different devices in your house and pro- provide a 53 00:04:23,360 --> 00:04:26,320 lot of functionality. You can remotely set your heat. 54 00:04:26,980 --> 00:04:33,920 Uh schedules and your cooling schedules either from a phone, your web interface or the Nexia admins 55 00:04:33,920 --> 00:04:39,340 can do it on their own if they really wanted to. It can also send notices. So let's say your 56 00:04:39,340 --> 00:04:44,320 furnace starts failing in a really bad way like I had with my first one. It can dial out to 57 00:04:44,320 --> 00:04:50,700 Nexia and say, hey there's a problem. It'll fire up an alarm on your device and in certain cases it 58 00:04:50,700 --> 00:04:55,680 can actually shut off functionality until you have the installer come out and fix it. Uh, 59 00:04:56,980 --> 00:05:01,240 the service that you pay for, it's about $10 a month to get all access to all these Nexia 60 00:05:01,240 --> 00:05:06,200 features. And one of the main ones that you see on the device is you get a cool weather map uh and 61 00:05:06,200 --> 00:05:10,720 local weather updates and those are all actually pulled from Weather Underground. And they 62 00:05:10,720 --> 00:05:16,500 don't really control the request, it just goes right out to Weather Underground. And one of the 63 00:05:16,500 --> 00:05:22,920 more interesting features for us is the device will do over the air updates. So it does request to 64 00:05:22,920 --> 00:05:26,960 Nexia to see if it's got, or to train, to see if it's got a new update package that's going to do an 65 00:05:26,980 --> 00:05:31,260 update. And it will download it and load it if it validates against all their checks. And then 66 00:05:31,260 --> 00:05:36,020 like I mentioned before, you can download, or you're supposed to, I think they intend to keep 67 00:05:36,020 --> 00:05:40,680 this feature. They say the new link is coming soon. Um, but you can download the software 68 00:05:40,680 --> 00:05:46,160 package, load it onto USB and when you plug that in it pretty much does a quick evaluation and 69 00:05:46,160 --> 00:05:52,900 will boot it. And it's worth four dollar signs, whatever that means. I still to this day don't 70 00:05:52,900 --> 00:05:56,300 really know how much it costs because it comes as a bundled deal and you can't buy them separately 71 00:05:56,300 --> 00:05:56,720 on the internet. 72 00:05:56,980 --> 00:06:01,040 I think roughly it's about three hundred bucks. So I was hoping not to break it in my research. 73 00:06:01,360 --> 00:06:08,640 Also because I just got the furnace replaced. So the first day that I have this, I poke around on 74 00:06:08,640 --> 00:06:15,040 it constantly. And the first thing I see is a RubyGems license in the about page. Thank you 75 00:06:15,040 --> 00:06:19,760 open source. Alright? This, this let me know that I had some ground to work with because I'm a 76 00:06:19,760 --> 00:06:25,340 Ruby guy. Most of my daily work is done in like Ruby, Python, uh, things of that type. And 77 00:06:25,340 --> 00:06:26,960 having this type of disclosure of this is a great way for me to be able to work with Ruby. 78 00:06:26,960 --> 00:06:32,420 Awesome. And you can see there's about a hundred and eighty-seven pages of open source software 79 00:06:32,420 --> 00:06:38,140 licenses that are included on this about page on the device. That was awesome. I was really 80 00:06:38,140 --> 00:06:44,400 excited to see that. Alright. Now I know this thing has code that I can work with if I can get 81 00:06:44,400 --> 00:06:49,600 into it. And I want to do a basic smell test to see what, what's available on the device. And 82 00:06:49,600 --> 00:06:54,080 there's a ton of ports open on this thing. Way more than you would expect if this thing had a good 83 00:06:54,080 --> 00:06:56,940 security policy. Uh, one of them in particular comes with a security policy. Uh, one of them in 84 00:06:56,940 --> 00:07:01,940 particular came back as Napster, according to Nmap. While the thermostat isn't running Napster, uh, 85 00:07:02,120 --> 00:07:09,820 I wouldn't be surprised if it was based on the research that I found. But this port 9999, uh, 86 00:07:09,960 --> 00:07:17,940 stood out to me as really the most interesting one of the ports that I was able to scan. So I 87 00:07:17,940 --> 00:07:23,440 start poking these things. We're just using basic N, NCAT commands and, uh, attacking these ports. 88 00:07:23,640 --> 00:07:26,920 And you can see there's two of them that just take, you know, a little bit more than a hundred 89 00:07:26,940 --> 00:07:31,080 command prompts. They say, hey, Joe, give me a command. You've connected. This is fantastic. 90 00:07:33,740 --> 00:07:37,460 Those aren't even included in this presentation. But there's lots of opportunity for them. 91 00:07:38,600 --> 00:07:43,620 Uh, but we go back to port 9999 and this thing is obviously issuing an authentication challenge. 92 00:07:43,900 --> 00:07:49,980 It's giving us a, a couple of random numbers and wants something back from us. Alright. You 93 00:07:49,980 --> 00:07:54,880 still have my interest. So now this is the focus of my research and I want to see if I can break 94 00:07:54,880 --> 00:07:56,920 into this code to find out how, how it works. So I'm going to go back to port 9999 and I'm going to 95 00:07:56,940 --> 00:08:03,900 see if this port actually uses commands. So that, uh, tarball that I mentioned earlier that 96 00:08:03,900 --> 00:08:07,480 you're supposed to be able to download from the manufacturer's website, but you can't right now, 97 00:08:07,560 --> 00:08:13,260 unless you get to the proper link, uh, cracked the thing open and it's got a couple cryptic 98 00:08:13,260 --> 00:08:17,720 files, no extensions on them. They're trying to hide this from basic, basic people with no 99 00:08:17,720 --> 00:08:22,320 knowledge of files or security or anything like that. Uh, the number is pretty much a build 100 00:08:22,320 --> 00:08:26,760 number and you can see the 850 there in the beginning of the number. That's the platform 101 00:08:26,940 --> 00:08:31,760 number and that's pretty predictable based on what thermostat you're working with. We run the 102 00:08:31,760 --> 00:08:37,040 file commands to see what this actually contains and we see a couple of things. It's got a DOS 103 00:08:37,040 --> 00:08:42,380 executable, it's got another tarball, it's got a U-boot image and a couple of ASCII text files. 104 00:08:43,560 --> 00:08:47,180 Alright, well the first thing that I did was I opened up this other tarball and what it 105 00:08:47,180 --> 00:08:54,020 contained was a utility folder with all the verification checks for the software image. They 106 00:08:54,020 --> 00:08:56,320 come shipped with the new image in this folder. 107 00:08:57,200 --> 00:09:02,760 It could just be me but I don't think that's a good way to package verification checks with a new 108 00:09:02,760 --> 00:09:08,520 image. Seems like you could really just replace those and probably get pretty far. And at the 109 00:09:08,520 --> 00:09:13,460 very least they give you good insight on to how they do the verification for the software. So it 110 00:09:13,460 --> 00:09:21,320 would be pretty easy to reverse those and try and boot your own image. Here's the manifest file. 111 00:09:21,940 --> 00:09:25,700 It's got a couple things in here that are worth noting. At the bottom you'll notice it's got a 112 00:09:25,700 --> 00:09:26,780 switch for the boot message. 113 00:09:26,940 --> 00:09:33,000 It says, am I train or American Standard? Well, I was focused on this device being my device. Mine is a 114 00:09:33,000 --> 00:09:41,020 train unit but I'm pretty confident this applies also to American Standard units. Also, uh, you can 115 00:09:41,020 --> 00:09:47,840 see the checksums. It's really just sizes and a couple, uh, easy things that are pretty quick to 116 00:09:47,840 --> 00:09:54,680 pick out from the verification checks noticed in the other files. So this makes it really easy to 117 00:09:54,680 --> 00:09:56,360 understand how the software is packaged. 118 00:09:56,940 --> 00:10:04,880 And how to build a new one. And like I said, it takes over the air updates and USB uploads. My main 119 00:10:04,880 --> 00:10:10,100 focus turned toward the actual UBI image. There's a number of ways to mount a UBI image or to 120 00:10:10,100 --> 00:10:15,540 interact with it, but I was able to find this tool and if you guys know this guy or if he's here, 121 00:10:15,620 --> 00:10:19,920 I'd like to buy him a couple beers because I owe him. It made it really easy to do a point and 122 00:10:19,920 --> 00:10:26,840 click tool, tear out the file system, and then I had a folder containing all the, uh, the entire file system. 123 00:10:26,940 --> 00:10:32,760 So it was a Linux file system with a bunch of UBI gems and it had a BusyBox ARM binary buried in there as well. 124 00:10:37,520 --> 00:10:43,900 Well, now I've got the entire file system exposed. And this is make, makes it pretty easy to search 125 00:10:43,900 --> 00:10:50,240 through it and look for key strings and vulnerable issues. Uh, I searched for things that you would 126 00:10:50,240 --> 00:10:56,840 think of right away. Passwords, users, uh, enrollment, alarms, registrations. These are all things that 127 00:10:56,940 --> 00:11:01,100 I had a bunch of hits for. These weren't things that I tried. These are things that are very common in 128 00:11:01,100 --> 00:11:07,840 the source code. This slide is a little bit ugly for the eyes, but it gives you a great idea of just 129 00:11:07,840 --> 00:11:13,440 what looking for the Ruby matcher, like a regex matcher, will return. You see a lot of calls for 130 00:11:13,440 --> 00:11:20,660 constants, the schedules, alarm histories, uh, registration call out. This really lets you know how, 131 00:11:20,780 --> 00:11:26,920 uh, vulnerable these calls are to reverse, reverse engineering. Just by searching for these, uh, 132 00:11:26,940 --> 00:11:34,260 searching for these particular strings. You also find a lot of samples and passwords. Particularly 133 00:11:34,260 --> 00:11:41,200 they even have old commented out passwords. I don't know if this is some guy's dev password or if 134 00:11:41,200 --> 00:11:46,340 this is a password still used on a production machine, but it seems like this is sort of a pretty 135 00:11:46,340 --> 00:11:51,320 common approach for how they would handle issues. I'm going to guess that this is probably their 136 00:11:51,320 --> 00:11:56,920 patch for a previous security problem. And hard-coded passwords are our obvious 137 00:11:56,940 --> 00:12:04,220 always a bad idea. And they definitely are. The command up there at the top, you'll notice is 138 00:12:04,220 --> 00:12:09,120 actually a sample command for how to set the heat. It's not one to one. They changed it a little 139 00:12:09,120 --> 00:12:13,120 bit. So it's not copy and paste in order to be able to update the thermostat temperature or 140 00:12:13,120 --> 00:12:19,340 something like that. But it gives you a really good idea on where to start. Now like I said, this 141 00:12:19,340 --> 00:12:24,920 thing was written in Ruby. That means it comes with gems. Gems come with specs. Specs tell you what 142 00:12:24,920 --> 00:12:26,920 everything does. So, uh, I'm going to go ahead and show you how to do this. So, uh, I'm going to go 143 00:12:26,940 --> 00:12:27,420 ahead and show you how to do this. So, uh, I'm going to go ahead and show you how to do this. So, in most of the 144 00:12:27,420 --> 00:12:32,880 instances I could change into the directory of the gem, do bundle install, and I was able to 145 00:12:32,880 --> 00:12:38,460 download all the production gems that they had on their GitHub. And in most of the instances I can 146 00:12:38,460 --> 00:12:43,800 actually kick up those specs and recreate the protocols and all the faceplate messages. Anything 147 00:12:43,800 --> 00:12:49,180 that this did and they wanted to check, it was included in these gems and it was reproducible, 148 00:12:49,320 --> 00:12:56,920 simply by running specs. So, uh, I'm going to go ahead and show you how to do this. So, uh, I'm going to 149 00:13:07,360 --> 00:13:08,280 demonstrate a bit here how to do this and we're going to show you a bit what kind of 150 00:13:08,280 --> 00:13:12,980 Jesus Box. So, anyway, before we begin this tutorial, I wanted to mention, they actually published 151 00:13:12,980 --> 00:13:21,580 a lot of extensions and actually created unique extents where you can just download 있었 cannabis 152 00:13:21,580 --> 00:13:26,920 apps and so on and so forth and you can actually record those and have them on your computer and 153 00:13:26,940 --> 00:13:32,900 results, production machine configs, and all this publicly available on your GitHub. The 154 00:13:32,900 --> 00:13:38,380 first response we got was, no, we intended that. And then we had to go back and be, are you 155 00:13:38,380 --> 00:13:43,640 sure? And then they actually pulled down a lot of these repositories, and these are the ones 156 00:13:43,640 --> 00:13:52,040 that are actually still up there today. Not the ones that they pulled down. So we've got a good 157 00:13:52,040 --> 00:13:57,640 idea of what this thing does, and all the features that we can probably get out of it. We know 158 00:13:57,640 --> 00:14:02,160 everything Nexia can do. We've had a good look at the source code. We've found a lot of valuable 159 00:14:02,160 --> 00:14:07,560 information from the source code that we've been able to examine. And it all sort of comes back to 160 00:14:07,560 --> 00:14:15,140 this language called SMILE, or perhaps SMIL. I'm not too sure. I found some examples of it in 161 00:14:15,140 --> 00:14:20,700 documentation on the internet. They loosely fit with how Nexia actually implements this 162 00:14:20,700 --> 00:14:22,020 protocol, or this code. So we're going to go ahead and take a look at the source code. 163 00:14:22,020 --> 00:14:25,840 And so again, we're still in the early stages of this system, and it was the best correlation I 164 00:14:25,840 --> 00:14:31,320 could find. But as far as we're concerned for Trane and Nexia, they really use it in a way that 165 00:14:31,320 --> 00:14:36,380 we could consider proprietary. There's not too much correlation with outside sources that I 166 00:14:36,380 --> 00:14:43,980 found, so it's a pretty loose correlation. Again, I'm not exactly sure what the acronym other 167 00:14:46,700 --> 00:14:51,560 than this stands for. I assume that this is the best correlation. It's a synchronize multimedia 168 00:14:51,560 --> 00:14:57,560 integration language. The RFCs and documentation I was able to find online point to XML files 169 00:14:57,560 --> 00:15:03,120 with really customizable nodes, and I found a few of those that actually have an inventory of 170 00:15:03,120 --> 00:15:08,660 all the features and models contained within this device. So what does it do? Everything. 171 00:15:09,180 --> 00:15:13,780 Anything this device can do, and that includes not just the stuff the user can do, but 172 00:15:13,780 --> 00:15:21,540 anything the remote administrators from Nexia can do, is available from this protocol. And 173 00:15:21,540 --> 00:15:25,080 you're going to see how much other features were included in this device that weren't even 174 00:15:25,080 --> 00:15:29,560 visible from the user interface, and as a user you would never know that it just sends 175 00:15:29,560 --> 00:15:40,480 analytic data no matter what. So this is one of their regex expressions taken from the code, 176 00:15:40,500 --> 00:15:45,440 and it's the first barrier for evaluating this plain text protocol that we saw in the 177 00:15:45,440 --> 00:15:51,440 challenge issued earlier. This is theirs, not mine. If it passes this test, the device 178 00:15:51,540 --> 00:15:55,220 will start evaluating it. That doesn't mean you're going to be able to necessarily fire a 179 00:15:55,220 --> 00:16:00,500 command simply by bypassing this check, but it will consider it, and it will start considering it 180 00:16:00,500 --> 00:16:06,420 valid data, and it will compare the information you give it to the models contained in the 181 00:16:06,420 --> 00:16:18,120 device. I would expect a little bit better checks than that. The constants file that they use, 182 00:16:18,280 --> 00:16:21,360 and they use constants everywhere, it's not just a pattern of having 183 00:16:21,540 --> 00:16:28,320 hard-coded passwords, hard-coded server endpoints. Uh, you can see here they have things for 184 00:16:29,040 --> 00:16:35,460 the alarm sessions, chat sessions, registration and enrollment. These are all the core features of 185 00:16:35,460 --> 00:16:42,680 this thermostat. And they go to all the features that you pay ten bucks a month for. And I 186 00:16:42,680 --> 00:16:51,520 remind you that a private GitHub repository is what, like seven dollars? Okay, so this is the 187 00:16:53,740 --> 00:16:59,120 app. So let's log in already. We know a lot about the port, we know a lot about the file system. We 188 00:16:59,120 --> 00:17:02,440 have a good idea of all the features we can do. Remember, you can remotely administrate 189 00:17:02,440 --> 00:17:07,240 everything on this from an app, from a website, you can change your temperature, change your 190 00:17:07,240 --> 00:17:11,360 schedules. If we can log in and start playing with this, we should be able to gain a lot of control 191 00:17:11,360 --> 00:17:21,300 over the device. So to get past the challenge that you saw earlier is actually pretty simple. In fact, 192 00:17:21,300 --> 00:17:28,320 this command up at the top is how Nexia manufactures the authentication command that it sends 193 00:17:28,320 --> 00:17:35,300 the device. So we do a SHA-1 hex digest of a couple of the values that we get back from that initial 194 00:17:35,300 --> 00:17:42,460 challenge, spit it back to the device, and we authenticate. It's hard-coded passwords, done with 195 00:17:42,460 --> 00:17:47,460 a, a SHA-1, you spit it back, and you're in. So this is the same for every single one of these 196 00:17:47,460 --> 00:17:51,280 thermostats running this version of the software. Hard-coded production of the device, it's not a 197 00:17:51,280 --> 00:17:55,280 hard-coded command, it's just that the credentials always come back to bite you. And when you 198 00:17:55,280 --> 00:18:02,060 authenticate, and you issue a basic command, you get flooded with data. You can see here that 199 00:18:02,060 --> 00:18:05,700 there's a number of different model IDs that we get back. There's a lot of different types of 200 00:18:05,700 --> 00:18:09,940 data. Some of it's plain text, some of it's wrapped in protocol buffers, and is a little bit 201 00:18:09,940 --> 00:18:21,180 difficult to understand. Subscribe true. This floored me. When I ran this command, of course I 202 00:18:21,280 --> 00:18:25,940 wanted to start with the most basic thing. So I was able to authenticate with the device, I know the 203 00:18:25,940 --> 00:18:31,060 basic model structure of how the IDs work and the type of commands that it expects. So I start from 204 00:18:31,060 --> 00:18:36,540 the bottom. I give it a one. I give it subscribe, which I know is a valid command. And I put in 205 00:18:36,540 --> 00:18:42,060 true, because I had, I noticed a couple switches in the logic that seemed to evaluate whether or 206 00:18:42,060 --> 00:18:47,320 not true was the entire payload. And what I found out was that if you give it true, it will dump 207 00:18:47,320 --> 00:18:51,260 every recursive element and every child node for the ID. And it'll tell me what I've already done, 208 00:18:51,260 --> 00:18:58,560 ID, you give it. So this thing has sort of like a domain structure, so it'll be like 1, 1.2, 209 00:18:58,700 --> 00:19:03,700 you know, it goes on from there. So when you give it 1 subscribe 2, you see the type of mess 210 00:19:03,700 --> 00:19:07,660 that you saw on the last slide. It gives you everything. That includes all the plain text 211 00:19:07,660 --> 00:19:15,240 information about the device, um, sensor readings, dealer diagnostic data, alarm history, 212 00:19:15,240 --> 00:19:21,900 everything. I don't know why they would actually enable this on a device other than simply for 213 00:19:21,900 --> 00:19:27,100 ease of use, of their own use, but it was horrible. I was flooded with data after I uh, 214 00:19:27,240 --> 00:19:33,460 actually fired this command. And when you do subscribe, you stay connected. So as far as this 215 00:19:33,460 --> 00:19:39,880 thing was concerned, I was now an authenticated valid server and I was properly requesting all 216 00:19:39,880 --> 00:19:45,000 the information this thing had. And it was just constantly spitting it out to me. So I'm 217 00:19:45,000 --> 00:19:48,420 flooded with data. I want to get a good understanding of how these model IDs actually 218 00:19:48,420 --> 00:19:57,060 work. So what I did is I built a script and I let it run for about a day or two and I played with 219 00:19:57,060 --> 00:20:02,060 my thermostat and I swallowed up every single payload that I got from this socket and saved it 220 00:20:02,060 --> 00:20:07,740 to a Redis database, breaking it apart with the regex matchers that I saw in their code. So 221 00:20:07,740 --> 00:20:13,140 now I have an overtime inventory of all the different permutations of the device IDs, the 222 00:20:13,140 --> 00:20:14,500 different commands that it will issue. 223 00:20:15,000 --> 00:20:21,400 At least report from this port. And also the command payloads. So I can go back and do analysis 224 00:20:21,400 --> 00:20:26,300 on how frequently a certain ID occurred, what type of commands are the most popular, and what 225 00:20:26,300 --> 00:20:30,740 type of payload structures are the most popular. Or perhaps the most powerful. Because remember 226 00:20:30,740 --> 00:20:35,780 we've got different levels of things we can access like alarms, the temperature, chat history, 227 00:20:37,180 --> 00:20:44,980 also authenticated callouts. So the things that I of course tracked were the authentication 228 00:20:45,000 --> 00:20:50,080 IDs. Every time you connect with this device, you get a new auth ID. So those were worth 229 00:20:50,080 --> 00:20:54,900 tracking to see if they were predictable. The command IDs themselves, so that domain, that 230 00:20:54,900 --> 00:20:59,860 domain system that I mentioned earlier that will recursively dump all of its elements, we 231 00:20:59,860 --> 00:21:04,100 tracked those as well. And then the command payloads. We want to know how these things are 232 00:21:04,100 --> 00:21:09,680 built and this made it super easy. It was, I mean, this really took a lot of the research out 233 00:21:09,680 --> 00:21:14,440 of it simply by being able to interact with the device over a couple of days and have all that data 234 00:21:14,440 --> 00:21:24,060 as an inventory. And this is how we process that. This is really all it takes to probe this 235 00:21:24,060 --> 00:21:32,120 socket, this 9999 socket and get back intelligible data. So this is the regex and the method 236 00:21:32,120 --> 00:21:36,240 that I use to actually interact with the socket, get back the data and save out the stuff that I 237 00:21:36,240 --> 00:21:40,060 got so that I can analyze it later. And I didn't really have to change it at all when I changed 238 00:21:40,060 --> 00:21:43,700 this to an active script because it was so spot on useful. 239 00:21:48,020 --> 00:21:57,340 So causing real trouble. This is what everyone wants, right? We're dealing with an IOT thermostat. 240 00:21:57,400 --> 00:22:04,040 We want to know if we can change the temperature, heat point, cold point. And if, like I 241 00:22:04,040 --> 00:22:08,660 mentioned earlier, I'm in Michigan. So if someone plays with my thermostat and sets off my heat 242 00:22:09,320 --> 00:22:13,900 to zero in the middle of winter, I'm screwed. When your pipes freeze it's a really expensive problem. 243 00:22:14,740 --> 00:22:20,320 And when your house burns down it's a more expensive problem. And we saw earlier with how my 244 00:22:20,320 --> 00:22:24,880 past furnace failed, the heat exchanger failed, it could even be a deadly problem before your house 245 00:22:24,880 --> 00:22:29,060 burns down. If someone keeps your burner going and is constantly working on the heat exchanger, 246 00:22:29,520 --> 00:22:34,500 that might fail and start pumping carbon dioxide into the house. And if you have controls over the 247 00:22:34,500 --> 00:22:40,500 alarms that set off on this device, you could prevent it from actually raising an error or dialing 248 00:22:40,500 --> 00:22:41,160 out to back home. 249 00:22:44,440 --> 00:22:50,660 You guys probably remember this command that we saw earlier, this sample. It's a good indication that we 250 00:22:50,660 --> 00:22:56,700 can set the heat simply because we see the type of IDs that we've been talking about already. And then 251 00:22:56,700 --> 00:23:02,080 the set hold command. And I was able to track this down to the models included in the XML file that I 252 00:23:02,080 --> 00:23:09,040 referenced earlier and start analyzing their structure in order to recreate this command. This 253 00:23:09,040 --> 00:23:13,780 command here at the bottom is the one that I actually used to set the heat and the cold. And it works. 254 00:23:16,480 --> 00:23:23,700 Um, every single function on this device is inventoried in this file. Anything this can possibly do is 255 00:23:23,700 --> 00:23:30,400 set up in this file. And there's a couple of interesting things that illustrate why the Redis, uh, 256 00:23:30,520 --> 00:23:35,760 script that stored all those data, all that data was relevant. You notice the N here in the model ID? 257 00:23:36,020 --> 00:23:42,500 They use dynamic IDs for a number of elements in this device. So you can't just really copy and paste, 258 00:23:42,640 --> 00:23:43,680 you have to have uh, 259 00:23:43,900 --> 00:23:44,420 indentations. 260 00:23:44,440 --> 00:23:47,800 You have to have intelligence on what you're actually working with. And that's why it's so 261 00:23:47,800 --> 00:23:53,480 important to be able to process the data you get back, identify certain parameters, and then you can 262 00:23:53,480 --> 00:23:59,040 use that to actually set these update commands. So to get this command to work, you actually have to 263 00:23:59,040 --> 00:24:04,960 query for the zone that you want to update. You can't just say, set the heat. You have to say, 264 00:24:05,060 --> 00:24:09,820 well, what, what do you have? Do you have one zone? Do you have two? Because these things are 265 00:24:09,820 --> 00:24:14,180 definitely in a bunch of homes, private homes, which is pretty scary. But they're also in a lot of 266 00:24:14,180 --> 00:24:18,400 commercial buildings, things like transportation hubs, pretty much everywhere you wouldn't want 267 00:24:18,400 --> 00:24:29,960 them to be. And this is the code that actually does that. So you can see we have the set points 268 00:24:29,960 --> 00:24:37,200 code, and then we have a couple of other methods as well. We have the derail and the rerail. One of 269 00:24:37,200 --> 00:24:43,580 the functions that we have on this device is we can set and remove authenticated servers. An authenticated 270 00:24:43,580 --> 00:24:49,940 server is Nexia. This thing has a backbone. It will dial home and set off alarms, ask for support, 271 00:24:50,480 --> 00:24:57,460 all this. And it stores its trusted server as Nexia as one of these values. So you can get in 272 00:24:57,460 --> 00:25:02,680 there and you can actually pluck out Nexia, and this is all using the same structure that we've 273 00:25:02,680 --> 00:25:13,560 already used, and you can put in your own persistent connection. So let's see it in action. So 274 00:25:13,580 --> 00:25:21,860 this is Nexia. Hopefully you can see it well. We get the challenge. We smash it together with the 275 00:25:21,860 --> 00:25:26,920 default credentials, and then we start issuing a set hold command for the native zone that we got 276 00:25:26,920 --> 00:25:32,000 back every second. This thing doesn't have rate limiting. It has a fire and forget model. So 277 00:25:32,000 --> 00:25:36,800 whatever the most recent command was takes precedent. And as you can see, it doesn't matter if 278 00:25:36,800 --> 00:25:40,100 you're standing in front of it hitting the button, you're less important than the command that's 279 00:25:40,100 --> 00:25:43,440 receiving. So now you're stuck in front of your 280 00:25:43,580 --> 00:25:47,860 expensive IoT thermostat trying to change your temperature, and it's not listening to you. It 281 00:25:47,860 --> 00:25:54,140 doesn't care. And you can tell by the marketing prompt up at the top, this thing isn't enrolled in 282 00:25:54,140 --> 00:26:02,680 Nexia service. It's pretty much vulnerable out of the box. This is, this is a bit 283 00:26:02,680 --> 00:26:08,380 frightening. And again, it doesn't matter how many buttons you click or what functions you try 284 00:26:08,380 --> 00:26:13,500 and enable from the device interface, you will never be more powerful than the command that it's 285 00:26:13,500 --> 00:26:19,840 receiving. Because as far as this thing is concerned, the administrative commands that it gets 286 00:26:19,840 --> 00:26:27,560 remotely are the end all, be all. And we'll let it finish up. I think eventually the furnace 287 00:26:27,560 --> 00:26:31,700 itself starts throwing a fitness. It says, wait, hold on, my burner is building up with gas or 288 00:26:31,700 --> 00:26:39,380 something like that. But it will always go back to heat mode. And you can set it to 90 degrees. You 289 00:26:39,380 --> 00:26:43,480 can set it, set it to pretty much have the heat shut off. And then it will start to run. And you can 290 00:26:43,500 --> 00:26:47,520 these are both like life-threatening problems depending on where you live in the world. If you 291 00:26:47,520 --> 00:26:51,760 live in Las Vegas and I set your heat to 90 degrees, that's a problem, right? If you live in 292 00:26:51,760 --> 00:27:05,180 Michigan and I turn off your heat, that's a bigger problem. Okay. So this method of issuing 293 00:27:05,180 --> 00:27:10,660 commands works for everything, like I said. And it works for all the different models that are 294 00:27:10,660 --> 00:27:15,280 included in the device. And that includes sensitive information. So yeah, I can update your 295 00:27:15,280 --> 00:27:21,140 heat, I can shut off your heat, but I can also find out what your heating schedule is, so when 296 00:27:21,140 --> 00:27:25,800 you leave for work, when you get back from work, what the authenticated IDs for your device are, 297 00:27:25,960 --> 00:27:32,440 your serial numbers, your registration PIN with Nexia, current temperature, so I can check up on 298 00:27:32,440 --> 00:27:39,720 you as Mr. Bad Guy and see if my commands are actually doing what I expect them to do. And 299 00:27:39,720 --> 00:27:40,460 then of course, 300 00:27:40,660 --> 00:27:46,160 active trusted connections and active trusted servers. So we can query this thing for read only 301 00:27:46,160 --> 00:27:52,320 data and find out all the sensitive information. And it's pretty scary. And that includes 302 00:27:52,320 --> 00:27:58,500 chat logs too. So you have the ability to actually chat with a Nexia rep, I believe, over this 303 00:27:58,500 --> 00:28:04,820 device, because they can remotely provide service and control. They can actually enable SSH if 304 00:28:04,820 --> 00:28:09,660 they want to, to get in your device and see what's going on. And that's all accessible. So we 305 00:28:09,660 --> 00:28:10,400 can read chat logs. 306 00:28:10,660 --> 00:28:17,880 Uh, the platform information, everything we need. And this one particular element, the AUID, 307 00:28:18,780 --> 00:28:24,480 that's a privileged ID that they generate off of the device's MAC address and a couple other 308 00:28:24,480 --> 00:28:29,720 factors. That's incorporated to pretty much anything they encrypt, is encrypt with this ID. 309 00:28:30,260 --> 00:28:40,640 And this ID is queryable from this port that uses a plain text protocol. Okay, so now we have 310 00:28:40,660 --> 00:28:43,700 a list of all the available devices. Okay, well, clearly I've been able to write a couple scripts for 311 00:28:43,700 --> 00:28:49,100 this, and I want to make sure that people are able to audit these devices and have the ability to see 312 00:28:49,100 --> 00:28:58,320 if a device is vulnerable. So, building a new tool. Building a point and click tool after all 313 00:28:58,320 --> 00:29:02,880 this research was pretty easy. Obviously, the research itself was pretty much building these tools 314 00:29:02,880 --> 00:29:10,640 in order to reverse engineer this protocol, mess with it, set the heat, set your own server as a trusted server, so that it never contacts, so that it never does not contact your device. 315 00:29:10,660 --> 00:29:19,560 Nexia. This is all available within a couple tools that I was able to build. And I've split 316 00:29:19,560 --> 00:29:24,680 them into two sections so that you actually have a safe read only script that if you're a 317 00:29:24,680 --> 00:29:28,960 homeowner or perhaps a pen tester working with a client and you don't want to burn down 318 00:29:28,960 --> 00:29:33,900 their corporate building, you can query the device, get all the information from it, 319 00:29:34,920 --> 00:29:38,560 improve. Yeah, this is vulnerable. And I still know when you guys are away from the building 320 00:29:38,560 --> 00:29:44,540 or at work, but I didn't change your heat. I didn't, you know, disconnect you permanently 321 00:29:44,540 --> 00:29:55,260 from Nexia. But we've proven that you're vulnerable. Alright, it's called TrainRec. The 322 00:29:55,260 --> 00:29:59,760 GitHub repository was opened up about an hour or two ago. So these tools are publicly available 323 00:29:59,760 --> 00:30:06,660 right now for you. And TrainRec is a Ruby script. Well, it's a collection of Ruby scripts. 324 00:30:06,780 --> 00:30:08,160 And I included a gem file. 325 00:30:08,700 --> 00:30:12,420 So even if you're not a Ruby guy and you don't have Ruby installed on your system, it's pretty 326 00:30:12,420 --> 00:30:17,560 easy. You install Ruby. The second step is you do a bundle install, you'll have to install maybe a 327 00:30:17,560 --> 00:30:22,560 gem or two. And then after that you're good to use command line scripts to execute these 328 00:30:22,560 --> 00:30:27,000 functions against the device. And these things, a lot of them are publicly available. Remember, 329 00:30:27,140 --> 00:30:34,400 um, these are ports that are used to communicate with the back end service. So I didn't just find 330 00:30:34,400 --> 00:30:38,540 this one on my own home network, but they're available throughout the country. And so it's a 331 00:30:45,760 --> 00:30:51,000 very, very simple device. So your iPhone will install those ports let alone the middle too, 332 00:30:51,100 --> 00:30:52,360 so it won't even have to work and if you verify the internet won't even get back. But that's 333 00:30:52,360 --> 00:30:53,200 also how it works and it never works. But so, we've been over a year and a half now and 334 00:30:53,200 --> 00:30:54,200 everything that we've glitched and won't work is just not working. We've been fraudulent in 335 00:30:54,200 --> 00:30:55,460 that way. We need to come up with a solution so far to get that hacked. And I won't give Father 336 00:30:55,460 --> 00:31:02,460 icho the heated loader. This is a really good way to break è inceint fermat call c freby m 337 00:31:02,460 --> 00:31:02,680 dur of number of times or an effort to get是我 to come up with the Answert Mario. If your 338 00:31:02,680 --> 00:31:05,380 mobile device is bad, you get a data search error here. It's a super request. This is the 339 00:31:05,380 --> 00:31:08,520 files that are literally arriving on anthenper browser. So we're going to open this off am end 340 00:31:08,520 --> 00:31:13,320 remember we have the subscribe command that will constantly feed us data. So this will connect to 341 00:31:13,320 --> 00:31:17,360 a device, parse out all the information that I listed before, and then if you want it to stay 342 00:31:17,360 --> 00:31:22,900 subscribed, you can maintain that connection and either, I don't know, output it to a file if 343 00:31:22,900 --> 00:31:27,500 you want, or send it to a Redis database. At that point it's really up to you. But you can do 344 00:31:27,500 --> 00:31:36,040 additional research simply by having all this extra data. And then derailer is the script that's 345 00:31:36,040 --> 00:31:42,300 a bit more fun. When I say fun, I should say dangerous. The functions that are included in 346 00:31:42,300 --> 00:31:47,980 this, you can set the heat point, you can set the cold point, and you can actually derail or 347 00:31:47,980 --> 00:31:53,780 rerail, which means you can remove Nexia as a trusted server from the device. So this thing 348 00:31:53,780 --> 00:32:00,540 essentially goes dark from the backbone servers that are meant to control it from Nexia and 349 00:32:00,540 --> 00:32:05,920 Trane. So this thing will never set off an alarm to the home server. It will 350 00:32:06,040 --> 00:32:11,440 never call and raise a problem. You'll never be able to get tech support if it's disconnected 351 00:32:11,440 --> 00:32:17,780 from this server because it will have no knowledge of it. And I was able to set one of my 352 00:32:17,780 --> 00:32:24,300 computers at home as a trusted server. And this thing just started spitting data to it. Now, 353 00:32:24,900 --> 00:32:29,860 that's bad. And you can actually set different parameters for whether or not you want the data 354 00:32:29,860 --> 00:32:34,700 connection to be encrypted with that idea I mentioned earlier or not. Not that that's the 355 00:32:34,700 --> 00:32:35,440 best level of encryption. 356 00:32:36,300 --> 00:32:42,980 But you have that ability. And I preface this, this is a pretty dangerous one. Of course, you 357 00:32:42,980 --> 00:32:47,760 only want to use this on devices you own or that you have the permission to test simply because 358 00:32:47,760 --> 00:32:52,000 you're using default logging credentials as a part of this script. And that's something to be 359 00:32:52,000 --> 00:32:53,500 considering, or something to consider. 360 00:33:00,220 --> 00:33:05,000 So the scope of the problem and more problems. Why do we really care? 361 00:33:06,700 --> 00:33:11,840 Well, there's a number of things that are really bad about this. First, uh, you can pretty 362 00:33:11,840 --> 00:33:17,360 much set the heat and cold for somebody's private house or corporate building. That's bad. I 363 00:33:17,360 --> 00:33:22,440 mean, that's, that's bad enough. That's, that's a lot of people's worst nightmare. In addition 364 00:33:22,440 --> 00:33:26,060 to that, you get the privileged information of when your family's gone from their house or when 365 00:33:26,060 --> 00:33:30,360 the corporate building is empty. And there's a couple of other things that are cause for 366 00:33:30,360 --> 00:33:36,020 concern. This is also shipped with private keys for the backbone server. And, uh, the 367 00:33:36,720 --> 00:33:42,700 package that you download from Trane, the way this thing actually calls back to Trane and says, 368 00:33:42,840 --> 00:33:47,880 hey, here's my port, how to communicate with me, is it will SSH back to their corporate 369 00:33:47,880 --> 00:33:54,340 server. It will then execute a shell script, giving it a port number. And then it will dial 370 00:33:54,340 --> 00:33:59,580 back and try and connect through that port number. So there's private keys hidden in this 371 00:33:59,580 --> 00:34:04,720 software package and that's a problem. And there's a lot of social engineering stuff that 372 00:34:04,720 --> 00:34:06,000 comes with having access to a private key. And, uh, there's a lot of social engineering stuff 373 00:34:06,020 --> 00:34:10,160 that comes with having access to, uh, really specific privileged information, like the hardware 374 00:34:10,160 --> 00:34:13,900 serial numbers. And I don't mean just the device. You can also get information on the electronic 375 00:34:13,900 --> 00:34:20,440 relays in the furnace. You can update the functionality, like I said. So it would be really 376 00:34:20,440 --> 00:34:26,220 easy to silence the device from the corporate server. Make your server the authenticated 377 00:34:26,220 --> 00:34:31,400 server. Change it so that it's not operating correctly. Silence the alarms. And then you can 378 00:34:31,400 --> 00:34:36,000 show up as helpful Mr. Handyman and say, hey, you've got furnace XYZ, right? And then you can 379 00:34:36,000 --> 00:34:41,160 with these serial numbers and your temperature is out of whack, I'm here to fix it for you. 380 00:34:41,360 --> 00:34:46,400 Because that's a feature that this is supposed to have. They're supposed to be able to fax or 381 00:34:46,400 --> 00:34:50,920 dial out to the people that actually installed your furnace and that information is available 382 00:34:50,920 --> 00:34:56,640 in the scripts also. So you can just show up and mimic these people. In addition to that, 383 00:34:58,560 --> 00:35:05,020 we're all familiar with ransomware, right? What if your house gets ransomed? 384 00:35:06,000 --> 00:35:11,080 We now have the ability to cut this off from the corporate network. We can set the heat and we 385 00:35:11,080 --> 00:35:16,420 can actually set messages. Remember the banner on the top? We can set our own alarms. So you 386 00:35:16,420 --> 00:35:21,640 really could say, alright, you're no longer connected to Nexia. Your heat is 90 degrees and 387 00:35:21,640 --> 00:35:27,940 until you deposit this bitcoin address, your heat doesn't get turned back on. So now we've 388 00:35:27,940 --> 00:35:35,060 taken ransomware into actual physical implementation. It's pretty scary. Now the vendor claims 389 00:35:35,060 --> 00:35:35,900 that this was patched. 390 00:35:36,000 --> 00:35:40,800 We did disclose this to the vendor. It's been a good process. I had some help from good folks at 391 00:35:40,800 --> 00:35:48,420 work like Carl. And they claim everything that's connected to their backbone system is patched. 392 00:35:48,520 --> 00:35:54,220 But remember the passwords that we saw commented out earlier? What we heard was that they 393 00:35:54,220 --> 00:35:59,320 simply disabled this port. And we've evaluated that there's a lot of problems with this device. 394 00:36:00,460 --> 00:36:05,580 So knowing that these things are everywhere and that they've patched it, probably how they have 395 00:36:05,580 --> 00:36:05,940 patched 396 00:36:06,000 --> 00:36:10,500 other problems in the past, doesn't really give me much, much comfort at all. 397 00:36:16,740 --> 00:36:23,160 And remember with the basic insecure structure of this device, or the lack of a good security 398 00:36:23,160 --> 00:36:31,300 bedrock in their approach, every other feature listed here is ripe for exploit. So you've got 399 00:36:31,300 --> 00:36:35,980 software updates that can be pushed over the wire and you can also do DNS spoofing. You can also do 400 00:36:35,980 --> 00:36:38,000 network support and you can also do network security. It pulls from servers that aren't 401 00:36:38,000 --> 00:36:43,920 really under the control of NXEA or TRAIN like Weather Underground. So you have 3rd party 402 00:36:43,920 --> 00:36:48,360 servers that could be exploited or compromised and then they represent a way into the device. 403 00:36:50,060 --> 00:36:55,060 Like I said, it ships with private keys for corporate servers. That's usually a very bad thing. 404 00:36:56,360 --> 00:37:01,800 And then the NXEA backbone itself touches a lot. So NXEA's service, or NXEA's business is being in 405 00:37:01,800 --> 00:37:05,960 your business. They want to touch and integrate with as many things as they can. When they do this, they 406 00:37:05,960 --> 00:37:10,740 in your house. Their backbone servers are meant to interface with door locks, light switches, 407 00:37:11,100 --> 00:37:18,380 cameras, thermostats. So if there's devices shipped with things that make it easier to 408 00:37:18,380 --> 00:37:22,680 compromise those systems, it has a ripple effect that could affect a lot more devices. 409 00:37:27,020 --> 00:37:32,200 There's more every day. So this is a quick search from Shodan a little while ago, when I 410 00:37:32,200 --> 00:37:37,020 first started the research. And it's pretty easy to find these things. You remember the very 411 00:37:37,020 --> 00:37:46,920 unique authentication challenge that we got? Those show up really easy on Shodan. And you find 412 00:37:46,920 --> 00:37:50,200 these places, or you find these things, like I said, really everywhere you wouldn't want them to 413 00:37:50,200 --> 00:37:55,380 be. So private homes are scary enough, but they're also in corporate buildings, transportation 414 00:37:55,380 --> 00:38:01,960 areas, probably utility areas. It's pretty frightening. And they're really easy to locate. 415 00:38:01,960 --> 00:38:11,320 So a bad guy could just walk around, poke on Shodan, and look for a target. And they've been 416 00:38:11,320 --> 00:38:16,280 getting noisy. So when I first started the research, it wasn't this bad. You weren't getting 417 00:38:16,280 --> 00:38:22,160 massive data dumps, output of JSON data on a different port. But it seems like since the patch 418 00:38:22,160 --> 00:38:28,960 has arrived, or been deployed, that these things are really just dumping the data out. So this 419 00:38:28,960 --> 00:38:31,940 poor guy, we can read what his temperature is set at. If he's on the ground, he's going to be 420 00:38:31,960 --> 00:38:37,840 in trouble. So we've got a bunch of pieces of information that we should not have access to. And 421 00:38:37,840 --> 00:38:44,620 this is just available online. It shouldn't be. At the very least, it seems like encrypting this 422 00:38:44,620 --> 00:38:49,820 information would go a long way. There's a lot of other problems in the device that are 423 00:38:49,820 --> 00:38:54,700 problems in themselves. But protecting your customers' data is really key, especially when 424 00:38:54,700 --> 00:39:01,940 everyone's paying 10 bucks a month for features that they never really asked for. So, we've got a 425 00:39:01,960 --> 00:39:07,280 bunch of things that we can do. Like I said, there's a lot more opportunity. The problem is 426 00:39:07,280 --> 00:39:12,080 that these things are really everywhere. And the people that have built this package, with an 427 00:39:12,080 --> 00:39:17,000 idea of what can we do, rather than how can we do it properly and have our customers ask for 428 00:39:17,000 --> 00:39:23,960 this, they touch a lot of other devices. Schlage door locks, thermostats, lighting modules, 429 00:39:24,440 --> 00:39:31,800 security sensors, alarms. And then Trane itself is owned by a parent company, Ingersoll-Rand. 430 00:39:31,960 --> 00:39:39,280 Which owns Thermo King, a lot of air conditioning services, golf carts. It's a really ripe field 431 00:39:39,280 --> 00:39:44,420 for exploit. And like I mentioned before, these insecure devices are shipped with things that 432 00:39:44,420 --> 00:39:49,980 could make it possible to compromise the corporate structures that administer these devices. 433 00:39:50,720 --> 00:39:55,780 So, we might have a vulnerable thermostat, but that could end up in a compromised backbone. And 434 00:39:55,780 --> 00:39:57,580 the backbone interfaces with all these devices. 435 00:40:03,580 --> 00:40:08,000 So, when I started Googling for some of these hardware numbers that I found when querying 436 00:40:08,000 --> 00:40:14,200 information from the device, I found that actually their secure area is directory indexed on 437 00:40:14,200 --> 00:40:22,620 Google. And, by the way, I found this was pretty innocent because I found the hardware numbers for 438 00:40:23,100 --> 00:40:28,040 the tools in use on my actual device. And I started Googling them, looking for simply what they 439 00:40:28,040 --> 00:40:31,940 were. And all these PDFs from the secure area started popping up. And I started looking for 440 00:40:31,960 --> 00:40:37,240 them. And I realized that their entire, entire directories were, uh, indexed. And that 441 00:40:37,240 --> 00:40:42,820 represents a pretty bad security posture. And it's another example of how one part of the company 442 00:40:42,820 --> 00:40:47,560 can have a bad problem with security. And that will affect the rest of the company. Remember we 443 00:40:47,560 --> 00:40:53,960 had Nexia. They had open GitHub repositories with database salts, database passwords. It was 444 00:40:53,960 --> 00:40:58,080 bad. You have all these different companies in play and working with each other. Because 445 00:40:58,080 --> 00:41:01,940 everyone wants to integrate. And you really have the weakness of the security posture. And, uh, it's, uh, 446 00:41:01,940 --> 00:41:10,480 the weakest link of the chain is where it's going to break. So here's the GitHub repository for 447 00:41:10,480 --> 00:41:16,520 the tools. I hope you guys make use of them. These are for everyone to use in their audits. Check 448 00:41:16,520 --> 00:41:20,720 out your own home thermostats. That's why I made this a safe one so that people can actually look 449 00:41:20,720 --> 00:41:25,160 at their own thermostat and see if it's vulnerable without, uh, risking their home or their 450 00:41:25,160 --> 00:41:31,920 furnace. And then so you guys can contact me. Here's my Twitter. I'm also on Keybase. So if you 451 00:41:31,920 --> 00:41:37,220 have any feedback, any ideas, or if you get to test these in the wild on your own devices or ones 452 00:41:37,220 --> 00:41:41,620 you have, uh, permission to use, I would love to hear how they work. And I'm more than willing to 453 00:41:41,620 --> 00:41:51,180 integrate features or accept, uh, pull requests from anyone who submits them. And that's it. 454 00:42:00,780 --> 00:42:01,900 Thanks. So if anybody has any questions, please feel free to reach out to me at 455 00:42:02,420 --> 00:42:09,500 gmail.com. I can try and answer them now. So, um, first off, great talk, right? Um, you saw, like, 456 00:42:09,580 --> 00:42:13,680 a lot of logic-type problems, stuff like that. Inside the Ruby scripts, did you find any kind of, 457 00:42:13,740 --> 00:42:18,300 like, other insecure methods, like eval being used? Any other ways to kind of get, like, access 458 00:42:18,300 --> 00:42:23,120 to devices besides just, like, probing the, the temperature in your case? Um, I used a couple 459 00:42:23,120 --> 00:42:28,020 tools to try and evaluate it, like Flay and, uh, some other syntax evaluators. But I didn't find 460 00:42:28,020 --> 00:42:31,900 anything that it raised really as a, a red flag. If you have some idea, particularly in, you know, 461 00:42:31,920 --> 00:42:35,080 things we should look for, I would love to hear that, and we can definitely go back and take a 462 00:42:35,080 --> 00:42:41,920 look. Yeah. Cool. Thanks. Yeah. Go on. So you, uh, managed to derail the thermostat 463 00:42:41,920 --> 00:42:46,840 from an excess backbone. Mm-hmm. What about the other way? Can you, uh, authenticate 464 00:42:46,840 --> 00:42:54,840 yourself to the backbone and, and impersonate another thermostat? Is that, uh, reasonable or 465 00:42:54,840 --> 00:43:01,900 probable? I didn't... In my research, I didn't take the step to spoof information from the 466 00:43:01,920 --> 00:43:06,580 mission or really go far into the backbone servers, because that was sort of territory I wasn't 467 00:43:06,580 --> 00:43:10,440 really comfortable with. But given what I saw, I have no reason to believe that wouldn't be 468 00:43:10,440 --> 00:43:16,760 possible. Because really, you're using a, uh, private key and a hard-coded user to authenticate 469 00:43:16,760 --> 00:43:21,260 with the backbone server, and you're really just providing commands, and it's all available right 470 00:43:21,260 --> 00:43:25,920 there in the code. So there's no reason why you couldn't have the server dialed to your port, 471 00:43:26,440 --> 00:43:31,680 expecting to connect to a thermostat and getting something else instead. So both Bob can connect? 472 00:43:32,420 --> 00:43:32,840 Yes. 473 00:43:36,200 --> 00:43:39,300 Yep. I would, I would expect that to be possible, certainly. 474 00:43:49,240 --> 00:43:53,920 Yep. I saw that, uh, there was some work done on a different software package on the XL950 475 00:43:53,920 --> 00:43:59,900 that dealt with a buffer overflow, but we were really focused on exploiting the heating, 476 00:43:59,960 --> 00:44:01,800 cooling, and the actual functions of thermostats. 477 00:44:01,920 --> 00:44:06,440 itself. But I did notice that. I noticed that some of these default passwords were included 478 00:44:06,440 --> 00:44:10,700 in a blog post from a number of years ago. But I did take, take knowledge of that. I 479 00:44:10,700 --> 00:44:14,540 just tried to take a different route so we could get additional research. One more. 480 00:44:14,760 --> 00:44:19,620 How exactly, sorry, I missed the slide, I think. How exactly was the device getting 481 00:44:19,620 --> 00:44:25,360 to the Ethernet? The device is wirelessly connected and some of them have the ability 482 00:44:25,360 --> 00:44:31,380 to be connected via Ethernet cord. So when you get this, the first thing the installer 483 00:44:31,380 --> 00:44:34,820 will do is ask for your Wi-Fi password, they'll put it in and hook this thing up to your 484 00:44:34,820 --> 00:44:39,900 network. If you don't want to do that, you either have to have it sign up on your own, so 485 00:44:39,900 --> 00:44:44,180 there's a whole network interface on the device and you can select which Wi-Fi network to 486 00:44:44,180 --> 00:44:48,320 attach it to. Or you could really take the thing off the wall and hook it in with an Ethernet 487 00:44:48,320 --> 00:44:54,100 cord. And I think some of them, from what I read, are built more to work off an Ethernet 488 00:44:54,100 --> 00:44:59,040 cord exclusively. But pretty much everything seems to have Wi-Fi capability as well. And 489 00:44:59,040 --> 00:45:01,360 neither one of them I expect to really protect this feature. So I'm going to go ahead and 490 00:45:01,380 --> 00:45:05,160 talk about that in a little bit. I think you implied that the software update routine 491 00:45:05,160 --> 00:45:12,140 is basically packaged with the update. Could you essentially put in your own update package 492 00:45:12,140 --> 00:45:16,500 if you wanted to? I didn't have time to finish that part of the research, but everything 493 00:45:16,500 --> 00:45:21,440 I've seen makes me think that that's really possible. So that would then imply if you 494 00:45:21,440 --> 00:45:25,800 could handle somebody's Ethernet connection, you could... You could force your own package 495 00:45:25,800 --> 00:45:29,620 on it. Okay. Yeah. Run whatever you want on that purpose, then. Yep. And like I said, 496 00:45:29,760 --> 00:45:31,360 the validation scripts are going to have to be in the same network interface. So you can 497 00:45:31,360 --> 00:45:35,540 see that the updates are shipped with the package, and you can also hot-plug it via USB. So 498 00:45:35,540 --> 00:45:38,880 even if someone has a strict security posture where this isn't even hooked up to the Internet 499 00:45:38,880 --> 00:45:43,660 and it's air-gapped, you could walk in and, boop, hook up a USB, and if you had the right 500 00:45:43,660 --> 00:45:49,220 checks, it would validate and upload. Yeah, I had a question. Was there any, like, built-in 501 00:45:49,220 --> 00:45:53,580 thresholds for the temperatures? Like, what if I wanted to set an arbitrary value of 800 502 00:45:53,580 --> 00:46:01,320 degrees? You... Yeah. So 90 degrees was the heat threshold, and, uh... I think it was 503 00:46:01,320 --> 00:46:05,980 probably around 50. I'm not exactly sure for, uh, the low one. But, uh, yeah, 90 degrees 504 00:46:05,980 --> 00:46:09,520 was definitely the highest that you can set it at. But that's still on a hot day, something 505 00:46:09,520 --> 00:46:13,500 I would consider, like, a failing temperature if you're set to a constant hold of 90 degrees. 506 00:46:13,720 --> 00:46:17,780 Um, sorry, just a little follow-up on that. So if I... Did you try... If you send, like, 507 00:46:17,800 --> 00:46:21,160 something like 800 degrees, would it just truncate it to 90, or just flat-out reject 508 00:46:21,160 --> 00:46:25,360 it? It... It rejects it, or it labels it as, like, a dead band. So if you send it 509 00:46:25,360 --> 00:46:28,420 invalid parameters, it'll actually say, like, well, I'm going to be running the air conditioning 510 00:46:28,420 --> 00:46:31,300 and the heating at the same time. This doesn't make sense. So, yeah, that's... That's... That's... 511 00:46:31,300 --> 00:46:35,420 So it has some attempts to validate the... The temperatures you send in. But the ranges, 512 00:46:35,600 --> 00:46:37,540 given natural environments, are still pretty dangerous. 513 00:46:38,620 --> 00:46:41,080 I'm not sure if I missed it in the first part of your talk. 514 00:46:41,200 --> 00:46:41,440 Mm-hmm. 515 00:46:41,480 --> 00:46:43,420 What was the vendor... What was the vendor's response? 516 00:46:43,820 --> 00:46:47,140 The vendor's response, it took them a while to actually take us seriously. 517 00:46:48,180 --> 00:46:52,700 So we, uh... Uh, Carl Sigler, a guy that... A great guy that I work with, reached out 518 00:46:52,700 --> 00:46:56,580 to them and let them know, hey, we've got a security researcher who found a vulnerability in 519 00:46:56,580 --> 00:47:01,120 this. We'd like to work with you on fixing it. The first responses we got back include, 520 00:47:01,300 --> 00:47:05,260 uh, our research and development department is so big there's no possible way that you've 521 00:47:05,260 --> 00:47:11,080 found a vulnerability in our thermostat. After that, and we started sending them things like 522 00:47:11,080 --> 00:47:15,840 that video, we got their attention pretty quickly. Uh, they still haven't provided me 523 00:47:15,840 --> 00:47:19,840 the patch to test, although they say that they've patched 100% of the devices that they 524 00:47:19,840 --> 00:47:25,800 have access to, which itself means that not all of the devices are patched. But it was, 525 00:47:25,800 --> 00:47:31,000 uh... It was a struggle to get a good relationship with them in order to get the thing fixed. 526 00:47:31,000 --> 00:47:34,860 And to this day, I'm still not confident this is completely addressed. And that's part of 527 00:47:34,860 --> 00:47:38,840 the reason that I put tools out to help and apply pressure to make sure that research on this 528 00:47:38,840 --> 00:47:39,220 continues. 529 00:47:40,100 --> 00:47:45,980 So you mentioned they fixed, uh, part of it or potentially fixed part of it, um, but don't 530 00:47:45,980 --> 00:47:51,340 have much confidence considering some of the bad comments and so forth. Is this, in your 531 00:47:51,340 --> 00:47:58,720 opinion, ultimately fixable? Or, I mean, is it so riddled that it's just a right from 532 00:47:58,720 --> 00:47:59,680 scratch, forget it? 533 00:48:00,080 --> 00:48:00,980 That's... That's a good question. 534 00:48:01,000 --> 00:48:05,640 I saw a number... I mean, we went over a number of problems that this thing has, and these 535 00:48:05,640 --> 00:48:10,260 all developed from really thinking first about what you can do instead of thinking about 536 00:48:10,260 --> 00:48:14,720 security. It would definitely be much more of a nightmare going back and retrofitting 537 00:48:14,720 --> 00:48:19,120 this to a secure position today, rather than... It'd probably be cheaper to start from 538 00:48:19,120 --> 00:48:23,800 scratch and have this thing riddled with secure code. But, uh, it may be possible. I'd never 539 00:48:23,800 --> 00:48:24,160 say never. 540 00:48:26,920 --> 00:48:30,900 Uh, I started reverse engineering the code. 541 00:48:30,900 --> 00:48:34,940 And looking into these ports as soon as I got the thermostat, and as soon as I got the furnace 542 00:48:34,940 --> 00:48:39,740 back in December. But to be honest, considering I just replaced one furnace, and it was still the 543 00:48:39,740 --> 00:48:44,340 middle of winter in Michigan, I waited a while before, uh, trying to exploit the actual set heat 544 00:48:44,340 --> 00:48:44,620 commands. 545 00:48:45,540 --> 00:48:48,380 I didn't want to have to call up people that just installed a new furnace and say, 546 00:48:48,500 --> 00:48:50,720 hey, I broke it, come get me a new one. 547 00:48:51,040 --> 00:48:55,220 Can you read my answers? Because I just need to question this stuff here. You're doing this 548 00:48:55,220 --> 00:48:59,640 research, and you'll find it's not a good idea. Just as the, like, episode number of Mr. 549 00:48:59,640 --> 00:49:02,860 Robot came out on that scene where they missed the thermostat. 550 00:49:03,020 --> 00:49:06,880 Yeah, I actually started watching that show after I started this, uh, research, and I was thrilled 551 00:49:06,880 --> 00:49:07,620 to see that episode. 552 00:49:09,680 --> 00:49:14,300 You said there are two other ports where it just took in commands immediately. Is it the 553 00:49:14,300 --> 00:49:16,140 same type of command, or is it something different? 554 00:49:16,460 --> 00:49:21,940 So, those ports are clearly a different service, and it's not included in this research, but it 555 00:49:21,940 --> 00:49:28,080 does have validation. So, these are, these are ports that are wrapped up in the BusyBox binary 556 00:49:28,700 --> 00:49:29,620 that's, uh, you know... 557 00:49:31,200 --> 00:49:35,200 They're not included in the general source code package, and they have validation on them, 558 00:49:35,240 --> 00:49:39,420 so they will definitely kick back commands and say, no, that's not valid. In fact, everything 559 00:49:39,420 --> 00:49:44,020 that I tried fuzzing, it was like, no, no, no. I didn't try straight-up buffer overflow. 560 00:49:44,100 --> 00:49:49,140 I was trying to actually get within their, their proprietary protocols and such, but having a 561 00:49:49,140 --> 00:49:52,920 plain text, uh, port that says enter command is just asking for trouble. 562 00:49:56,300 --> 00:49:59,240 So, if you disconnect from the network, 563 00:49:59,240 --> 00:50:05,960 do you lose enough functionality that it's no longer worth the premium price or whatever? 564 00:50:06,440 --> 00:50:11,340 Um, and does that ultimately keep you kind of secure? 565 00:50:11,780 --> 00:50:12,640 You won't... 566 00:50:12,640 --> 00:50:13,260 Using the functions manually? 567 00:50:13,640 --> 00:50:18,400 Well, even if you disconnect from the backbone server, this port and this service will still be 568 00:50:18,400 --> 00:50:23,660 available, uh, because it's available either locally or remotely, depending on your network 569 00:50:23,660 --> 00:50:28,280 configuration. You probably won't lose every service on the device, though, because, like I said, 570 00:50:28,380 --> 00:50:29,220 it calls out to everything. 571 00:50:29,240 --> 00:50:31,380 Uh, third-party servers that aren't affiliated with Nexi at all. 572 00:50:31,600 --> 00:50:33,940 But if you've never configured it to work with your Wi-Fi? 573 00:50:34,680 --> 00:50:40,320 If you never configured it to work with your Wi-Fi in the first place, there wouldn't really be 574 00:50:40,320 --> 00:50:44,760 as much opportunity to exploit it anyways. The only opportunity to exploit the thermostat at that 575 00:50:44,760 --> 00:50:50,320 point would be to hot-plug a USB with a poison package, simply because these ports aren't available. 576 00:50:52,580 --> 00:50:57,180 And would you then lose so much functionality that it's kind of not worth having that? 577 00:50:57,400 --> 00:50:59,120 If you were able to load your own software pack, 578 00:50:59,120 --> 00:50:59,440 package? 579 00:50:59,700 --> 00:51:01,080 Yeah, we can assume you'd lose everything. 580 00:51:02,200 --> 00:51:02,720 Yeah. 581 00:51:03,600 --> 00:51:04,380 Anyone else? 582 00:51:04,900 --> 00:51:04,920 Sure. 583 00:51:14,680 --> 00:51:19,300 I think the installers are actually instructed to connect it as part of the installation process. 584 00:51:19,640 --> 00:51:23,260 Uh, but you could totally request that, hey, don't connect this to the Internet. 585 00:51:24,360 --> 00:51:29,020 Everything about this is intended to basically force you to connect the device. 586 00:51:29,020 --> 00:51:33,720 I mean, you really are required to use this device to have the furnace work correctly, 587 00:51:33,840 --> 00:51:36,800 and every feature on it is expecting that you're hooked up to the Internet. 588 00:51:37,040 --> 00:51:41,020 It won't even give you the weather from a weather underground or your local temperature, 589 00:51:41,200 --> 00:51:46,020 which isn't from Nexia, but it'll withhold that until you sign up for their $10 a month service. 590 00:51:47,080 --> 00:51:50,640 So every chance they get, they want you to sign up for their integration. 591 00:51:54,220 --> 00:51:54,940 Anyone else? 592 00:51:55,600 --> 00:51:56,160 All right. 593 00:51:56,220 --> 00:51:56,820 Thanks, guys. 594 00:51:59,020 --> 00:51:59,660 Thank you so much.