My name is Jeff Kitson. I'm a securities researcher with Spider Labs Trustwave. My presentation today is Trainwreck. Uh, today is not only my first time at DEF CON, but it's also my first presentation of this type. So, I think we'll do alright. If I have to take a couple breaths, bear with me. So, what I want to talk to you today, about today is the device that of course we're focusing on. How I found this device, how it sort of entered my realm of knowledge, uh, the vulnerability that I found, how we got the vendor to fix it, and then the tools that I'm going to distribute to you guys so that you guys can actually test these yourself and keep the pressure on this manufacturer to make sure that they stay up on their security stance. So, how all this got started. It's a pretty personal story. On December 29th my furnace failed. I'm a first time homeowner. It was a pretty big experience to have my furnace fail in the middle of a Michigan winter. I don't know how many of you are familiar with Michigan. Or just winter at all. But it sucks when your furnace fails. And it can be pretty dangerous, especially to the water pipes in your house. So, I couldn't really delay on getting it fixed. I had to call up a manufacturer and have them come in and evaluate the situation. The problem that I actually had with the furnace was my heat exchanger failed and started developing cracks. And that's how you get carbon dioxide in your house. So, I'm actually kind of lucky I didn't die from this. Yeah. You can see it about, uh, two pipes, well, not on the, not on the monitor. But 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 the photo. I called up the local dealer that had worked on my unit in my house before. And they came out and really acknowledged that it wasn't safe to operate. How it was failing. So, by law they pretty much had to turn it off and I had to buy a new one. Now, the model that I selected was a little bit more efficient than the last furnace. Because when you're looking at replacing a furnace or replacing heat exchanger, it's about three to four times more efficient than the last furnace. So, whole day's worth of labor to get the exchanger replaced or you can buy a new furnace which is more efficient and it's going to get you a couple rebates, better power bills, better gas bills, so it was worth it to get the new furnace. The furnace that I chose was a train furnace because this dealer was a train dealer and it came with a smart IOT thermostat. It wasn't really an option, it came with it by default. They say oh you want one of our new furnaces, well our new packages come with smart IOT thermostats. So you get it because it's required for the device and it's called an XL850. So what exactly did I buy? Uh to be honest the day of I wasn't really sure because it just sort of pushed on you. You're in an emergency situation where you have to buy a new furnace, you think you're making the best choice. Uh I, one of the reasons I made this decision also was because I knew it was an IOT device and that kind of wetted my chops a little bit and I didn't go for the model uh above this because on that one this smart device actually might have been a little bit better. It modulates the gas valve. I didn't quite feel comfortable playing with that so I stuck uh stuck in the area where I was comfortable. So if we want to get technical and we do because this is DEFCON, the device is a ComfortLink 2 XL850. And this is one of about 3 or 4 models that Trane pushes out with their different units and you can see the manufacturer's page here and a couple of links that will be pretty relevant. One of the things you'll notice on this page is that, there is a download for software update. This manufacturer allows not only over the air updates but you can download it yourself, load it to a USB, hook it into the device and then it'll evaluate it, see if it's valid and boot the new image. Now if you go to that page today you won't see that link there anymore. Apparently they decided the best way to deal with uh this notice when they got it was to quickly remove the ability for people to upload their own software. But the link's still active. So the features this thing has, uh it's got a lot of features. Particularly it's got lots of interwa- uh internet. It speaks Z-Wave. So it works as a Z-Wave controller. This thing is meant to go out and touch the other things in your house and interact with your whole Z-Wave environment that you have working. It has an integrated Nexia bridge. So a Nexia bridge on its own is something that's meant to control a lot of different devices in your house and pro- provide a lot of functionality. You can remotely set your heat. Uh schedules and your cooling schedules either from a phone, your web interface or the Nexia admins can do it on their own if they really wanted to. It can also send notices. So let's say your furnace starts failing in a really bad way like I had with my first one. It can dial out to Nexia and say, hey there's a problem. It'll fire up an alarm on your device and in certain cases it can actually shut off functionality until you have the installer come out and fix it. Uh, the service that you pay for, it's about $10 a month to get all access to all these Nexia features. And one of the main ones that you see on the device is you get a cool weather map uh and local weather updates and those are all actually pulled from Weather Underground. And they don't really control the request, it just goes right out to Weather Underground. And one of the more interesting features for us is the device will do over the air updates. So it does request to 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 update. And it will download it and load it if it validates against all their checks. And then like I mentioned before, you can download, or you're supposed to, I think they intend to keep this feature. They say the new link is coming soon. Um, but you can download the software package, load it onto USB and when you plug that in it pretty much does a quick evaluation and will boot it. And it's worth four dollar signs, whatever that means. I still to this day don't really know how much it costs because it comes as a bundled deal and you can't buy them separately on the internet. I think roughly it's about three hundred bucks. So I was hoping not to break it in my research. Also because I just got the furnace replaced. So the first day that I have this, I poke around on it constantly. And the first thing I see is a RubyGems license in the about page. Thank you open source. Alright? This, this let me know that I had some ground to work with because I'm a Ruby guy. Most of my daily work is done in like Ruby, Python, uh, things of that type. And having this type of disclosure of this is a great way for me to be able to work with Ruby. Awesome. And you can see there's about a hundred and eighty-seven pages of open source software licenses that are included on this about page on the device. That was awesome. I was really excited to see that. Alright. Now I know this thing has code that I can work with if I can get into it. And I want to do a basic smell test to see what, what's available on the device. And there's a ton of ports open on this thing. Way more than you would expect if this thing had a good security policy. Uh, one of them in particular comes with a security policy. Uh, one of them in particular came back as Napster, according to Nmap. While the thermostat isn't running Napster, uh, I wouldn't be surprised if it was based on the research that I found. But this port 9999, uh, stood out to me as really the most interesting one of the ports that I was able to scan. So I start poking these things. We're just using basic N, NCAT commands and, uh, attacking these ports. And you can see there's two of them that just take, you know, a little bit more than a hundred command prompts. They say, hey, Joe, give me a command. You've connected. This is fantastic. Those aren't even included in this presentation. But there's lots of opportunity for them. Uh, but we go back to port 9999 and this thing is obviously issuing an authentication challenge. It's giving us a, a couple of random numbers and wants something back from us. Alright. You still have my interest. So now this is the focus of my research and I want to see if I can break 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 see if this port actually uses commands. So that, uh, tarball that I mentioned earlier that you're supposed to be able to download from the manufacturer's website, but you can't right now, unless you get to the proper link, uh, cracked the thing open and it's got a couple cryptic files, no extensions on them. They're trying to hide this from basic, basic people with no knowledge of files or security or anything like that. Uh, the number is pretty much a build number and you can see the 850 there in the beginning of the number. That's the platform number and that's pretty predictable based on what thermostat you're working with. We run the file commands to see what this actually contains and we see a couple of things. It's got a DOS executable, it's got another tarball, it's got a U-boot image and a couple of ASCII text files. Alright, well the first thing that I did was I opened up this other tarball and what it contained was a utility folder with all the verification checks for the software image. They come shipped with the new image in this folder. It could just be me but I don't think that's a good way to package verification checks with a new image. Seems like you could really just replace those and probably get pretty far. And at the very least they give you good insight on to how they do the verification for the software. So it would be pretty easy to reverse those and try and boot your own image. Here's the manifest file. It's got a couple things in here that are worth noting. At the bottom you'll notice it's got a switch for the boot message. It says, am I train or American Standard? Well, I was focused on this device being my device. Mine is a train unit but I'm pretty confident this applies also to American Standard units. Also, uh, you can see the checksums. It's really just sizes and a couple, uh, easy things that are pretty quick to pick out from the verification checks noticed in the other files. So this makes it really easy to understand how the software is packaged. And how to build a new one. And like I said, it takes over the air updates and USB uploads. My main focus turned toward the actual UBI image. There's a number of ways to mount a UBI image or to interact with it, but I was able to find this tool and if you guys know this guy or if he's here, I'd like to buy him a couple beers because I owe him. It made it really easy to do a point and click tool, tear out the file system, and then I had a folder containing all the, uh, the entire file system. 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. Well, now I've got the entire file system exposed. And this is make, makes it pretty easy to search through it and look for key strings and vulnerable issues. Uh, I searched for things that you would think of right away. Passwords, users, uh, enrollment, alarms, registrations. These are all things that I had a bunch of hits for. These weren't things that I tried. These are things that are very common in the source code. This slide is a little bit ugly for the eyes, but it gives you a great idea of just what looking for the Ruby matcher, like a regex matcher, will return. You see a lot of calls for constants, the schedules, alarm histories, uh, registration call out. This really lets you know how, uh, vulnerable these calls are to reverse, reverse engineering. Just by searching for these, uh, searching for these particular strings. You also find a lot of samples and passwords. Particularly they even have old commented out passwords. I don't know if this is some guy's dev password or if this is a password still used on a production machine, but it seems like this is sort of a pretty common approach for how they would handle issues. I'm going to guess that this is probably their patch for a previous security problem. And hard-coded passwords are our obvious always a bad idea. And they definitely are. The command up there at the top, you'll notice is actually a sample command for how to set the heat. It's not one to one. They changed it a little bit. So it's not copy and paste in order to be able to update the thermostat temperature or something like that. But it gives you a really good idea on where to start. Now like I said, this thing was written in Ruby. That means it comes with gems. Gems come with specs. Specs tell you what everything does. So, uh, I'm going to go ahead and show you how to do this. So, uh, I'm going to go 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 instances I could change into the directory of the gem, do bundle install, and I was able to download all the production gems that they had on their GitHub. And in most of the instances I can actually kick up those specs and recreate the protocols and all the faceplate messages. Anything that this did and they wanted to check, it was included in these gems and it was reproducible, 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 demonstrate a bit here how to do this and we're going to show you a bit what kind of Jesus Box. So, anyway, before we begin this tutorial, I wanted to mention, they actually published a lot of extensions and actually created unique extents where you can just download 있었 cannabis apps and so on and so forth and you can actually record those and have them on your computer and results, production machine configs, and all this publicly available on your GitHub. The first response we got was, no, we intended that. And then we had to go back and be, are you sure? And then they actually pulled down a lot of these repositories, and these are the ones that are actually still up there today. Not the ones that they pulled down. So we've got a good idea of what this thing does, and all the features that we can probably get out of it. We know everything Nexia can do. We've had a good look at the source code. We've found a lot of valuable information from the source code that we've been able to examine. And it all sort of comes back to this language called SMILE, or perhaps SMIL. I'm not too sure. I found some examples of it in documentation on the internet. They loosely fit with how Nexia actually implements this protocol, or this code. So we're going to go ahead and take a look at the source code. And so again, we're still in the early stages of this system, and it was the best correlation I could find. But as far as we're concerned for Trane and Nexia, they really use it in a way that we could consider proprietary. There's not too much correlation with outside sources that I found, so it's a pretty loose correlation. Again, I'm not exactly sure what the acronym other than this stands for. I assume that this is the best correlation. It's a synchronize multimedia integration language. The RFCs and documentation I was able to find online point to XML files with really customizable nodes, and I found a few of those that actually have an inventory of all the features and models contained within this device. So what does it do? Everything. Anything this device can do, and that includes not just the stuff the user can do, but anything the remote administrators from Nexia can do, is available from this protocol. And you're going to see how much other features were included in this device that weren't even visible from the user interface, and as a user you would never know that it just sends analytic data no matter what. So this is one of their regex expressions taken from the code, and it's the first barrier for evaluating this plain text protocol that we saw in the challenge issued earlier. This is theirs, not mine. If it passes this test, the device will start evaluating it. That doesn't mean you're going to be able to necessarily fire a command simply by bypassing this check, but it will consider it, and it will start considering it valid data, and it will compare the information you give it to the models contained in the device. I would expect a little bit better checks than that. The constants file that they use, and they use constants everywhere, it's not just a pattern of having hard-coded passwords, hard-coded server endpoints. Uh, you can see here they have things for the alarm sessions, chat sessions, registration and enrollment. These are all the core features of this thermostat. And they go to all the features that you pay ten bucks a month for. And I remind you that a private GitHub repository is what, like seven dollars? Okay, so this is the app. So let's log in already. We know a lot about the port, we know a lot about the file system. We have a good idea of all the features we can do. Remember, you can remotely administrate everything on this from an app, from a website, you can change your temperature, change your schedules. If we can log in and start playing with this, we should be able to gain a lot of control over the device. So to get past the challenge that you saw earlier is actually pretty simple. In fact, this command up at the top is how Nexia manufactures the authentication command that it sends the device. So we do a SHA-1 hex digest of a couple of the values that we get back from that initial challenge, spit it back to the device, and we authenticate. It's hard-coded passwords, done with a, a SHA-1, you spit it back, and you're in. So this is the same for every single one of these thermostats running this version of the software. Hard-coded production of the device, it's not a hard-coded command, it's just that the credentials always come back to bite you. And when you authenticate, and you issue a basic command, you get flooded with data. You can see here that there's a number of different model IDs that we get back. There's a lot of different types of data. Some of it's plain text, some of it's wrapped in protocol buffers, and is a little bit difficult to understand. Subscribe true. This floored me. When I ran this command, of course I wanted to start with the most basic thing. So I was able to authenticate with the device, I know the basic model structure of how the IDs work and the type of commands that it expects. So I start from the bottom. I give it a one. I give it subscribe, which I know is a valid command. And I put in true, because I had, I noticed a couple switches in the logic that seemed to evaluate whether or not true was the entire payload. And what I found out was that if you give it true, it will dump every recursive element and every child node for the ID. And it'll tell me what I've already done, ID, you give it. So this thing has sort of like a domain structure, so it'll be like 1, 1.2, you know, it goes on from there. So when you give it 1 subscribe 2, you see the type of mess that you saw on the last slide. It gives you everything. That includes all the plain text information about the device, um, sensor readings, dealer diagnostic data, alarm history, everything. I don't know why they would actually enable this on a device other than simply for ease of use, of their own use, but it was horrible. I was flooded with data after I uh, actually fired this command. And when you do subscribe, you stay connected. So as far as this thing was concerned, I was now an authenticated valid server and I was properly requesting all the information this thing had. And it was just constantly spitting it out to me. So I'm flooded with data. I want to get a good understanding of how these model IDs actually 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 my thermostat and I swallowed up every single payload that I got from this socket and saved it to a Redis database, breaking it apart with the regex matchers that I saw in their code. So now I have an overtime inventory of all the different permutations of the device IDs, the different commands that it will issue. At least report from this port. And also the command payloads. So I can go back and do analysis on how frequently a certain ID occurred, what type of commands are the most popular, and what type of payload structures are the most popular. Or perhaps the most powerful. Because remember we've got different levels of things we can access like alarms, the temperature, chat history, also authenticated callouts. So the things that I of course tracked were the authentication IDs. Every time you connect with this device, you get a new auth ID. So those were worth tracking to see if they were predictable. The command IDs themselves, so that domain, that domain system that I mentioned earlier that will recursively dump all of its elements, we tracked those as well. And then the command payloads. We want to know how these things are built and this made it super easy. It was, I mean, this really took a lot of the research out of it simply by being able to interact with the device over a couple of days and have all that data as an inventory. And this is how we process that. This is really all it takes to probe this socket, this 9999 socket and get back intelligible data. So this is the regex and the method that I use to actually interact with the socket, get back the data and save out the stuff that I got so that I can analyze it later. And I didn't really have to change it at all when I changed this to an active script because it was so spot on useful. So causing real trouble. This is what everyone wants, right? We're dealing with an IOT thermostat. We want to know if we can change the temperature, heat point, cold point. And if, like I mentioned earlier, I'm in Michigan. So if someone plays with my thermostat and sets off my heat to zero in the middle of winter, I'm screwed. When your pipes freeze it's a really expensive problem. And when your house burns down it's a more expensive problem. And we saw earlier with how my past furnace failed, the heat exchanger failed, it could even be a deadly problem before your house burns down. If someone keeps your burner going and is constantly working on the heat exchanger, that might fail and start pumping carbon dioxide into the house. And if you have controls over the alarms that set off on this device, you could prevent it from actually raising an error or dialing out to back home. You guys probably remember this command that we saw earlier, this sample. It's a good indication that we can set the heat simply because we see the type of IDs that we've been talking about already. And then the set hold command. And I was able to track this down to the models included in the XML file that I referenced earlier and start analyzing their structure in order to recreate this command. This command here at the bottom is the one that I actually used to set the heat and the cold. And it works. Um, every single function on this device is inventoried in this file. Anything this can possibly do is set up in this file. And there's a couple of interesting things that illustrate why the Redis, uh, script that stored all those data, all that data was relevant. You notice the N here in the model ID? They use dynamic IDs for a number of elements in this device. So you can't just really copy and paste, you have to have uh, indentations. You have to have intelligence on what you're actually working with. And that's why it's so important to be able to process the data you get back, identify certain parameters, and then you can use that to actually set these update commands. So to get this command to work, you actually have to query for the zone that you want to update. You can't just say, set the heat. You have to say, well, what, what do you have? Do you have one zone? Do you have two? Because these things are definitely in a bunch of homes, private homes, which is pretty scary. But they're also in a lot of commercial buildings, things like transportation hubs, pretty much everywhere you wouldn't want them to be. And this is the code that actually does that. So you can see we have the set points code, and then we have a couple of other methods as well. We have the derail and the rerail. One of the functions that we have on this device is we can set and remove authenticated servers. An authenticated server is Nexia. This thing has a backbone. It will dial home and set off alarms, ask for support, all this. And it stores its trusted server as Nexia as one of these values. So you can get in there and you can actually pluck out Nexia, and this is all using the same structure that we've already used, and you can put in your own persistent connection. So let's see it in action. So this is Nexia. Hopefully you can see it well. We get the challenge. We smash it together with the default credentials, and then we start issuing a set hold command for the native zone that we got back every second. This thing doesn't have rate limiting. It has a fire and forget model. So whatever the most recent command was takes precedent. And as you can see, it doesn't matter if you're standing in front of it hitting the button, you're less important than the command that's receiving. So now you're stuck in front of your expensive IoT thermostat trying to change your temperature, and it's not listening to you. It doesn't care. And you can tell by the marketing prompt up at the top, this thing isn't enrolled in Nexia service. It's pretty much vulnerable out of the box. This is, this is a bit frightening. And again, it doesn't matter how many buttons you click or what functions you try and enable from the device interface, you will never be more powerful than the command that it's receiving. Because as far as this thing is concerned, the administrative commands that it gets remotely are the end all, be all. And we'll let it finish up. I think eventually the furnace itself starts throwing a fitness. It says, wait, hold on, my burner is building up with gas or something like that. But it will always go back to heat mode. And you can set it to 90 degrees. You can set it, set it to pretty much have the heat shut off. And then it will start to run. And you can these are both like life-threatening problems depending on where you live in the world. If you live in Las Vegas and I set your heat to 90 degrees, that's a problem, right? If you live in Michigan and I turn off your heat, that's a bigger problem. Okay. So this method of issuing commands works for everything, like I said. And it works for all the different models that are included in the device. And that includes sensitive information. So yeah, I can update your heat, I can shut off your heat, but I can also find out what your heating schedule is, so when you leave for work, when you get back from work, what the authenticated IDs for your device are, your serial numbers, your registration PIN with Nexia, current temperature, so I can check up on you as Mr. Bad Guy and see if my commands are actually doing what I expect them to do. And then of course, active trusted connections and active trusted servers. So we can query this thing for read only data and find out all the sensitive information. And it's pretty scary. And that includes chat logs too. So you have the ability to actually chat with a Nexia rep, I believe, over this device, because they can remotely provide service and control. They can actually enable SSH if they want to, to get in your device and see what's going on. And that's all accessible. So we can read chat logs. Uh, the platform information, everything we need. And this one particular element, the AUID, that's a privileged ID that they generate off of the device's MAC address and a couple other factors. That's incorporated to pretty much anything they encrypt, is encrypt with this ID. And this ID is queryable from this port that uses a plain text protocol. Okay, so now we have a list of all the available devices. Okay, well, clearly I've been able to write a couple scripts for this, and I want to make sure that people are able to audit these devices and have the ability to see if a device is vulnerable. So, building a new tool. Building a point and click tool after all this research was pretty easy. Obviously, the research itself was pretty much building these tools 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. Nexia. This is all available within a couple tools that I was able to build. And I've split them into two sections so that you actually have a safe read only script that if you're a homeowner or perhaps a pen tester working with a client and you don't want to burn down their corporate building, you can query the device, get all the information from it, improve. Yeah, this is vulnerable. And I still know when you guys are away from the building or at work, but I didn't change your heat. I didn't, you know, disconnect you permanently from Nexia. But we've proven that you're vulnerable. Alright, it's called TrainRec. The GitHub repository was opened up about an hour or two ago. So these tools are publicly available right now for you. And TrainRec is a Ruby script. Well, it's a collection of Ruby scripts. And I included a gem file. So even if you're not a Ruby guy and you don't have Ruby installed on your system, it's pretty easy. You install Ruby. The second step is you do a bundle install, you'll have to install maybe a gem or two. And then after that you're good to use command line scripts to execute these functions against the device. And these things, a lot of them are publicly available. Remember, um, these are ports that are used to communicate with the back end service. So I didn't just find this one on my own home network, but they're available throughout the country. And so it's a very, very simple device. So your iPhone will install those ports let alone the middle too, so it won't even have to work and if you verify the internet won't even get back. But that's also how it works and it never works. But so, we've been over a year and a half now and everything that we've glitched and won't work is just not working. We've been fraudulent in that way. We need to come up with a solution so far to get that hacked. And I won't give Father icho the heated loader. This is a really good way to break è inceint fermat call c freby m dur of number of times or an effort to get是我 to come up with the Answert Mario. If your mobile device is bad, you get a data search error here. It's a super request. This is the files that are literally arriving on anthenper browser. So we're going to open this off am end remember we have the subscribe command that will constantly feed us data. So this will connect to a device, parse out all the information that I listed before, and then if you want it to stay subscribed, you can maintain that connection and either, I don't know, output it to a file if you want, or send it to a Redis database. At that point it's really up to you. But you can do additional research simply by having all this extra data. And then derailer is the script that's a bit more fun. When I say fun, I should say dangerous. The functions that are included in this, you can set the heat point, you can set the cold point, and you can actually derail or rerail, which means you can remove Nexia as a trusted server from the device. So this thing essentially goes dark from the backbone servers that are meant to control it from Nexia and Trane. So this thing will never set off an alarm to the home server. It will never call and raise a problem. You'll never be able to get tech support if it's disconnected from this server because it will have no knowledge of it. And I was able to set one of my computers at home as a trusted server. And this thing just started spitting data to it. Now, that's bad. And you can actually set different parameters for whether or not you want the data connection to be encrypted with that idea I mentioned earlier or not. Not that that's the best level of encryption. But you have that ability. And I preface this, this is a pretty dangerous one. Of course, you only want to use this on devices you own or that you have the permission to test simply because you're using default logging credentials as a part of this script. And that's something to be considering, or something to consider. So the scope of the problem and more problems. Why do we really care? Well, there's a number of things that are really bad about this. First, uh, you can pretty much set the heat and cold for somebody's private house or corporate building. That's bad. I mean, that's, that's bad enough. That's, that's a lot of people's worst nightmare. In addition to that, you get the privileged information of when your family's gone from their house or when the corporate building is empty. And there's a couple of other things that are cause for concern. This is also shipped with private keys for the backbone server. And, uh, the package that you download from Trane, the way this thing actually calls back to Trane and says, hey, here's my port, how to communicate with me, is it will SSH back to their corporate server. It will then execute a shell script, giving it a port number. And then it will dial back and try and connect through that port number. So there's private keys hidden in this software package and that's a problem. And there's a lot of social engineering stuff that comes with having access to a private key. And, uh, there's a lot of social engineering stuff that comes with having access to, uh, really specific privileged information, like the hardware serial numbers. And I don't mean just the device. You can also get information on the electronic relays in the furnace. You can update the functionality, like I said. So it would be really easy to silence the device from the corporate server. Make your server the authenticated server. Change it so that it's not operating correctly. Silence the alarms. And then you can show up as helpful Mr. Handyman and say, hey, you've got furnace XYZ, right? And then you can with these serial numbers and your temperature is out of whack, I'm here to fix it for you. Because that's a feature that this is supposed to have. They're supposed to be able to fax or dial out to the people that actually installed your furnace and that information is available in the scripts also. So you can just show up and mimic these people. In addition to that, we're all familiar with ransomware, right? What if your house gets ransomed? We now have the ability to cut this off from the corporate network. We can set the heat and we can actually set messages. Remember the banner on the top? We can set our own alarms. So you really could say, alright, you're no longer connected to Nexia. Your heat is 90 degrees and until you deposit this bitcoin address, your heat doesn't get turned back on. So now we've taken ransomware into actual physical implementation. It's pretty scary. Now the vendor claims that this was patched. We did disclose this to the vendor. It's been a good process. I had some help from good folks at work like Carl. And they claim everything that's connected to their backbone system is patched. But remember the passwords that we saw commented out earlier? What we heard was that they simply disabled this port. And we've evaluated that there's a lot of problems with this device. So knowing that these things are everywhere and that they've patched it, probably how they have patched other problems in the past, doesn't really give me much, much comfort at all. And remember with the basic insecure structure of this device, or the lack of a good security bedrock in their approach, every other feature listed here is ripe for exploit. So you've got software updates that can be pushed over the wire and you can also do DNS spoofing. You can also do network support and you can also do network security. It pulls from servers that aren't really under the control of NXEA or TRAIN like Weather Underground. So you have 3rd party servers that could be exploited or compromised and then they represent a way into the device. Like I said, it ships with private keys for corporate servers. That's usually a very bad thing. And then the NXEA backbone itself touches a lot. So NXEA's service, or NXEA's business is being in your business. They want to touch and integrate with as many things as they can. When they do this, they in your house. Their backbone servers are meant to interface with door locks, light switches, cameras, thermostats. So if there's devices shipped with things that make it easier to compromise those systems, it has a ripple effect that could affect a lot more devices. There's more every day. So this is a quick search from Shodan a little while ago, when I first started the research. And it's pretty easy to find these things. You remember the very unique authentication challenge that we got? Those show up really easy on Shodan. And you find these places, or you find these things, like I said, really everywhere you wouldn't want them to be. So private homes are scary enough, but they're also in corporate buildings, transportation areas, probably utility areas. It's pretty frightening. And they're really easy to locate. So a bad guy could just walk around, poke on Shodan, and look for a target. And they've been getting noisy. So when I first started the research, it wasn't this bad. You weren't getting massive data dumps, output of JSON data on a different port. But it seems like since the patch has arrived, or been deployed, that these things are really just dumping the data out. So this poor guy, we can read what his temperature is set at. If he's on the ground, he's going to be in trouble. So we've got a bunch of pieces of information that we should not have access to. And this is just available online. It shouldn't be. At the very least, it seems like encrypting this information would go a long way. There's a lot of other problems in the device that are problems in themselves. But protecting your customers' data is really key, especially when everyone's paying 10 bucks a month for features that they never really asked for. So, we've got a bunch of things that we can do. Like I said, there's a lot more opportunity. The problem is that these things are really everywhere. And the people that have built this package, with an idea of what can we do, rather than how can we do it properly and have our customers ask for this, they touch a lot of other devices. Schlage door locks, thermostats, lighting modules, security sensors, alarms. And then Trane itself is owned by a parent company, Ingersoll-Rand. Which owns Thermo King, a lot of air conditioning services, golf carts. It's a really ripe field for exploit. And like I mentioned before, these insecure devices are shipped with things that could make it possible to compromise the corporate structures that administer these devices. So, we might have a vulnerable thermostat, but that could end up in a compromised backbone. And the backbone interfaces with all these devices. So, when I started Googling for some of these hardware numbers that I found when querying information from the device, I found that actually their secure area is directory indexed on Google. And, by the way, I found this was pretty innocent because I found the hardware numbers for the tools in use on my actual device. And I started Googling them, looking for simply what they were. And all these PDFs from the secure area started popping up. And I started looking for them. And I realized that their entire, entire directories were, uh, indexed. And that represents a pretty bad security posture. And it's another example of how one part of the company can have a bad problem with security. And that will affect the rest of the company. Remember we had Nexia. They had open GitHub repositories with database salts, database passwords. It was bad. You have all these different companies in play and working with each other. Because everyone wants to integrate. And you really have the weakness of the security posture. And, uh, it's, uh, the weakest link of the chain is where it's going to break. So here's the GitHub repository for the tools. I hope you guys make use of them. These are for everyone to use in their audits. Check out your own home thermostats. That's why I made this a safe one so that people can actually look at their own thermostat and see if it's vulnerable without, uh, risking their home or their furnace. And then so you guys can contact me. Here's my Twitter. I'm also on Keybase. So if you have any feedback, any ideas, or if you get to test these in the wild on your own devices or ones you have, uh, permission to use, I would love to hear how they work. And I'm more than willing to integrate features or accept, uh, pull requests from anyone who submits them. And that's it. Thanks. So if anybody has any questions, please feel free to reach out to me at gmail.com. I can try and answer them now. So, um, first off, great talk, right? Um, you saw, like, a lot of logic-type problems, stuff like that. Inside the Ruby scripts, did you find any kind of, like, other insecure methods, like eval being used? Any other ways to kind of get, like, access to devices besides just, like, probing the, the temperature in your case? Um, I used a couple tools to try and evaluate it, like Flay and, uh, some other syntax evaluators. But I didn't find anything that it raised really as a, a red flag. If you have some idea, particularly in, you know, things we should look for, I would love to hear that, and we can definitely go back and take a look. Yeah. Cool. Thanks. Yeah. Go on. So you, uh, managed to derail the thermostat from an excess backbone. Mm-hmm. What about the other way? Can you, uh, authenticate yourself to the backbone and, and impersonate another thermostat? Is that, uh, reasonable or probable? I didn't... In my research, I didn't take the step to spoof information from the mission or really go far into the backbone servers, because that was sort of territory I wasn't really comfortable with. But given what I saw, I have no reason to believe that wouldn't be possible. Because really, you're using a, uh, private key and a hard-coded user to authenticate with the backbone server, and you're really just providing commands, and it's all available right there in the code. So there's no reason why you couldn't have the server dialed to your port, expecting to connect to a thermostat and getting something else instead. So both Bob can connect? Yes. Yep. I would, I would expect that to be possible, certainly. Yep. I saw that, uh, there was some work done on a different software package on the XL950 that dealt with a buffer overflow, but we were really focused on exploiting the heating, cooling, and the actual functions of thermostats. itself. But I did notice that. I noticed that some of these default passwords were included in a blog post from a number of years ago. But I did take, take knowledge of that. I just tried to take a different route so we could get additional research. One more. How exactly, sorry, I missed the slide, I think. How exactly was the device getting to the Ethernet? The device is wirelessly connected and some of them have the ability to be connected via Ethernet cord. So when you get this, the first thing the installer will do is ask for your Wi-Fi password, they'll put it in and hook this thing up to your network. If you don't want to do that, you either have to have it sign up on your own, so there's a whole network interface on the device and you can select which Wi-Fi network to attach it to. Or you could really take the thing off the wall and hook it in with an Ethernet cord. And I think some of them, from what I read, are built more to work off an Ethernet cord exclusively. But pretty much everything seems to have Wi-Fi capability as well. And neither one of them I expect to really protect this feature. So I'm going to go ahead and talk about that in a little bit. I think you implied that the software update routine is basically packaged with the update. Could you essentially put in your own update package if you wanted to? I didn't have time to finish that part of the research, but everything I've seen makes me think that that's really possible. So that would then imply if you could handle somebody's Ethernet connection, you could... You could force your own package on it. Okay. Yeah. Run whatever you want on that purpose, then. Yep. And like I said, the validation scripts are going to have to be in the same network interface. So you can see that the updates are shipped with the package, and you can also hot-plug it via USB. So even if someone has a strict security posture where this isn't even hooked up to the Internet and it's air-gapped, you could walk in and, boop, hook up a USB, and if you had the right checks, it would validate and upload. Yeah, I had a question. Was there any, like, built-in thresholds for the temperatures? Like, what if I wanted to set an arbitrary value of 800 degrees? You... Yeah. So 90 degrees was the heat threshold, and, uh... I think it was probably around 50. I'm not exactly sure for, uh, the low one. But, uh, yeah, 90 degrees was definitely the highest that you can set it at. But that's still on a hot day, something I would consider, like, a failing temperature if you're set to a constant hold of 90 degrees. Um, sorry, just a little follow-up on that. So if I... Did you try... If you send, like, something like 800 degrees, would it just truncate it to 90, or just flat-out reject it? It... It rejects it, or it labels it as, like, a dead band. So if you send it invalid parameters, it'll actually say, like, well, I'm going to be running the air conditioning and the heating at the same time. This doesn't make sense. So, yeah, that's... That's... That's... So it has some attempts to validate the... The temperatures you send in. But the ranges, given natural environments, are still pretty dangerous. I'm not sure if I missed it in the first part of your talk. Mm-hmm. What was the vendor... What was the vendor's response? The vendor's response, it took them a while to actually take us seriously. So we, uh... Uh, Carl Sigler, a guy that... A great guy that I work with, reached out to them and let them know, hey, we've got a security researcher who found a vulnerability in this. We'd like to work with you on fixing it. The first responses we got back include, uh, our research and development department is so big there's no possible way that you've found a vulnerability in our thermostat. After that, and we started sending them things like that video, we got their attention pretty quickly. Uh, they still haven't provided me the patch to test, although they say that they've patched 100% of the devices that they have access to, which itself means that not all of the devices are patched. But it was, uh... It was a struggle to get a good relationship with them in order to get the thing fixed. And to this day, I'm still not confident this is completely addressed. And that's part of the reason that I put tools out to help and apply pressure to make sure that research on this continues. So you mentioned they fixed, uh, part of it or potentially fixed part of it, um, but don't have much confidence considering some of the bad comments and so forth. Is this, in your opinion, ultimately fixable? Or, I mean, is it so riddled that it's just a right from scratch, forget it? That's... That's a good question. I saw a number... I mean, we went over a number of problems that this thing has, and these all developed from really thinking first about what you can do instead of thinking about security. It would definitely be much more of a nightmare going back and retrofitting this to a secure position today, rather than... It'd probably be cheaper to start from scratch and have this thing riddled with secure code. But, uh, it may be possible. I'd never say never. Uh, I started reverse engineering the code. And looking into these ports as soon as I got the thermostat, and as soon as I got the furnace back in December. But to be honest, considering I just replaced one furnace, and it was still the middle of winter in Michigan, I waited a while before, uh, trying to exploit the actual set heat commands. I didn't want to have to call up people that just installed a new furnace and say, hey, I broke it, come get me a new one. Can you read my answers? Because I just need to question this stuff here. You're doing this research, and you'll find it's not a good idea. Just as the, like, episode number of Mr. Robot came out on that scene where they missed the thermostat. Yeah, I actually started watching that show after I started this, uh, research, and I was thrilled to see that episode. You said there are two other ports where it just took in commands immediately. Is it the same type of command, or is it something different? So, those ports are clearly a different service, and it's not included in this research, but it does have validation. So, these are, these are ports that are wrapped up in the BusyBox binary that's, uh, you know... They're not included in the general source code package, and they have validation on them, so they will definitely kick back commands and say, no, that's not valid. In fact, everything that I tried fuzzing, it was like, no, no, no. I didn't try straight-up buffer overflow. I was trying to actually get within their, their proprietary protocols and such, but having a plain text, uh, port that says enter command is just asking for trouble. So, if you disconnect from the network, do you lose enough functionality that it's no longer worth the premium price or whatever? Um, and does that ultimately keep you kind of secure? You won't... Using the functions manually? Well, even if you disconnect from the backbone server, this port and this service will still be available, uh, because it's available either locally or remotely, depending on your network configuration. You probably won't lose every service on the device, though, because, like I said, it calls out to everything. Uh, third-party servers that aren't affiliated with Nexi at all. But if you've never configured it to work with your Wi-Fi? If you never configured it to work with your Wi-Fi in the first place, there wouldn't really be as much opportunity to exploit it anyways. The only opportunity to exploit the thermostat at that point would be to hot-plug a USB with a poison package, simply because these ports aren't available. And would you then lose so much functionality that it's kind of not worth having that? If you were able to load your own software pack, package? Yeah, we can assume you'd lose everything. Yeah. Anyone else? Sure. I think the installers are actually instructed to connect it as part of the installation process. Uh, but you could totally request that, hey, don't connect this to the Internet. Everything about this is intended to basically force you to connect the device. I mean, you really are required to use this device to have the furnace work correctly, and every feature on it is expecting that you're hooked up to the Internet. It won't even give you the weather from a weather underground or your local temperature, which isn't from Nexia, but it'll withhold that until you sign up for their $10 a month service. So every chance they get, they want you to sign up for their integration. Anyone else? All right. Thanks, guys. Thank you so much.