00:00:00.167-->00:00:06.206 >>Okay, so, so yeah, so thanks for coming out. Can everybody hear me okay? Alright, um, so 00:00:06.206-->00:00:11.211 yeah, um, let’s get right into it. [Laughing] Okay so, so yeah, I’m Headless Zeke. I work uh, on 00:00:15.983-->00:00:21.722 the um, Advanced Security Research Team at Trend Micro. Um, it’s a pretty awesome gig 00:00:21.722-->00:00:26.760 because I get to do offensive research all day, um, I basically, um, find ways to 00:00:26.760-->00:00:31.865 break things and then build cool exploit demos around it and of course, you know, do the 00:00:31.865-->00:00:37.237 responsible thing and disclose all of the vulnerabilities to the Zero Data Initiative and we 00:00:37.237-->00:00:42.943 work with the vendors to uh, to get all the issues fixed. Um, since I have been working there, 00:00:42.943-->00:00:47.447 I’ve found over 40 vulnerabilities and different things, mostly IoT stuff. 00:00:47.447-->00:00:53.954 [Applause] Oh, no, please, please, please. Come ‘on. Heh, uh yeah, I also do like to speak 00:00:53.954-->00:00:59.559 at conferences. This is actually my fourth time speaking at Defcon. Um, for some reason they 00:00:59.559-->00:01:06.300 keep letting me come back. I’m not sure why. Heh-eh, um, but yeah, I’ve spoken at Recon, 00:01:06.300-->00:01:11.305 Ruxcon, Toorcon, stuff like that. Okay, so, um, when I started this project, I didn’t 00:01:13.774-->00:01:19.146 even know what Crestron was. Uh, a co-worker of mine actually had a couple of old Crestron devices 00:01:19.146-->00:01:24.885 and wanted me to take a look at them. Um, and you know, I do love to take requests, so I said 00:01:24.885-->00:01:30.590 sure. Um, so I thought like since I had no idea who they were, um, there were probably 00:01:30.590-->00:01:35.395 some other people out there that don’t know what they are and what they can do either. Um, so 00:01:35.395-->00:01:42.069 I figured it would be good to do a little intro type thing. Um, so basically, Crestron devices 00:01:42.069-->00:01:48.542 are uh, device controllers. Um, they are fully programmable and customizable. Um, they’re bread 00:01:48.542-->00:01:52.279 and butter is kind of audio video – that’s what they’re known for, as like an 00:01:52.279-->00:01:58.251 audio/video distribution and control um, type set up. Uh, but they’re also doing like, you 00:01:58.251-->00:02:02.889 know, the fancy things where you like, go into a room and there like is a touch panel on the 00:02:02.889-->00:02:09.396 wall, and you like click a button and it will open up the shades and stuff like that. Um, 00:02:09.396-->00:02:13.433 and they’re also getting into like, building management systems um, they’ve got the 00:02:13.433-->00:02:19.373 capability to tie BACNET into your um, Crestron controllers. I’ve also seen them used in an 00:02:19.373-->00:02:24.378 access control and security settings, um, you know, like a, a touch panel on a door, you 00:02:27.914-->00:02:33.754 click the button, and then they’ll intercom you in to, or somebody can let you in kind of 00:02:33.754-->00:02:38.859 thing. Um, anyways, like I said, they are fully programmable and customizable. Um, they’ve got 00:02:38.859-->00:02:44.731 basically any way you could possibly want to interact with the device. Um, so you, you can 00:02:44.731-->00:02:49.736 do infrareds, serial, um, TC IU of course. Um, you can even so like straight relay control, 00:02:52.339-->00:02:59.046 MIDI control, um, Cresnet is kind of their own little thing. Um, so basically what you do is 00:02:59.046-->00:03:04.851 you write a program, um, in what’s called SIMPL, which is their uh, their little 00:03:04.851-->00:03:09.856 programming language. Um, and you basically use that to write um, actions to perform on your 00:03:11.992-->00:03:16.997 devices, um, but you can also write UI’s, um, stuff like that. Um, the main thing though is 00:03:20.434-->00:03:24.671 that programming can be very complex, and most people when they are having Crestron 00:03:24.671-->00:03:30.544 installed in their offices, um, will kind of farm that out to a third-party programmer and 00:03:30.544-->00:03:35.549 installer. Um, that’s going to be important to note later on. Um, so yeah, the two, two, um, 00:03:39.219-->00:03:45.926 or first off, the main way that you interact, um, as a programmer, with the, with the 00:03:45.926-->00:03:50.797 uh, Crestron device is through what’s called the uh, CTP console – the Crestron Terminal 00:03:50.797-->00:03:57.137 Protocol, and that’s basically the bulk of what this talk is about. Um, and then there is 00:03:57.137-->00:04:02.075 also the CIP, um, service, that’s kind of how Crestron devices talk to each other and 00:04:04.878-->00:04:11.017 it’s like the binary protocol. Um, so as far as where you can find Crestron devices, basically 00:04:11.017-->00:04:16.923 everywhere. Um, I see them a lot at universities, but also at fancy office environments. I 00:04:16.923-->00:04:21.928 know, um, our Trend Micro office actually has Crestron devices in our office um, that make sure we 00:04:24.531-->00:04:30.670 are secure and not breachable from other networks. Um, but yeah, also like sports arenas 00:04:30.670-->00:04:35.675 like the big jumbotron and stuff like that can be a Crestron install. Um, airports, um, I’ve 00:04:38.545-->00:04:44.918 got a funny little thing to say about that later. Um, lots of, lots of hotels are putting these 00:04:44.918-->00:04:50.757 in their, in the guest rooms, um, to do fancy things like I was saying with the shades and 00:04:50.757-->00:04:55.795 controlling the tv and stuff like that. Um, and then of course rich people’s houses. Um, 00:04:55.795-->00:05:00.734 so this is a screenshot um, off the Crestron site where they list some of their, um, their 00:05:03.036-->00:05:08.041 major enterprise customers. You can see it’s all over the place, like, ExxonMobil, Amazon, 00:05:10.210-->00:05:15.215 Twitter, Coca-Cola, um, Raytheon, so really like, you know they’ve got both of the 00:05:18.318-->00:05:23.323 Sysco’s, both food and networking Cisco’s. [Laughter] And um, they are uh, not shy uh, 00:05:26.092-->00:05:31.097 uh, their partnerships with Microsoft. They actually like to, to point that out quite 00:05:33.733-->00:05:38.738 often. Um, so basically um, Crestron is Microsoft’s exclusive partner to manage all 00:05:40.807-->00:05:47.380 AV and meeting room resources worldwide. Uh, so basically, I read that as they are in every 00:05:47.380-->00:05:54.054 Microsoft campus across the world. Um, and you know, they are also partnered more and more 00:05:54.054-->00:06:00.961 and uh, just like last week or the week before, uh, Crestron won the 2018 Microsoft Global 00:06:00.961-->00:06:05.966 IoT Partner of the Year Award. Um, so they, you know, they like to talk about that but they also 00:06:08.635-->00:06:12.939 have some other like case studies and stuff on their website, so I grabbed a couple 00:06:12.939-->00:06:18.545 of my favorites off of there. Um, so here’s the Massachusetts Bay Transit Authority. Um, they 00:06:18.545-->00:06:22.148 use Crestron devices when they are controlling and communicating with their train 00:06:22.148-->00:06:27.153 lines and stuff. Uh, the Chicago Police Department. Um, I don’t know if you can see in this 00:06:29.222-->00:06:34.594 picture, but there’s like a little touch screen on every desk. Um, that’s a Crestron 00:06:34.594-->00:06:39.599 device. Um, and this is probably my favorite. Uh, the Virginia State Senate. Um, so, so, like 00:06:42.502-->00:06:49.342 all of those are Crestron touch screens and they say like Yay, Nay, like that’s how you vote 00:06:49.342-->00:06:55.782 just by clicking on that Crestron thing. Um, I like this especially because in the case 00:06:55.782-->00:07:00.720 study, they were like trying to do like the secure voting angle, like, you want to make sure your 00:07:04.891-->00:07:09.896 votes are secure, use Crestron. Um, and since we are in Vegas, this is a screenshot from a 00:07:13.566-->00:07:18.271 hospitality showcase brochure that Crestron has, that basically lists all of the 00:07:18.271-->00:07:24.744 properties um, on the strip, where, that use Crestron, including Caesars Palace, um 00:07:24.744-->00:07:29.749 Aria, all the MGM Grands – they actually have a partnership with MGM Grand. Um, so yeah, there 00:07:34.621-->00:07:39.626 you go. There’s that. Okay, so that was, that was deployment, um, as far as products go. Um, 00:07:41.928-->00:07:48.001 kind of their two main flagship lines are their 3-series controllers, which I’ve got, 00:07:48.001-->00:07:53.440 I’ve got an MC3 right there um, and then they’ve got touch screens, which are also very 00:07:53.440-->00:07:58.445 popular. Um, against I’ve got a TSW-760 right there. Um, those touch screens are uh, being 00:08:01.247-->00:08:07.187 deployed in like a one in every room type, type deployment. Um, so you’ll see these in like um, 00:08:07.187-->00:08:12.192 every conference room in an office kind of thing. Um, but they don’t just do that, they do 00:08:14.260-->00:08:19.265 um, a lot of defending, um, I, like I could spend an entire career looking at just 00:08:22.502-->00:08:27.507 restaurant things. Um, so uh, platform wise, uh, two main platforms. They’ve got their 00:08:30.009-->00:08:35.014 Windows platform, which is mostly Windows CE, uh, but I’ve seen mentions of other versions 00:08:37.350-->00:08:42.989 of Windows. Uh, I haven’t come across them, uh, but apparently, they’re out there. Um, and then 00:08:42.989-->00:08:47.994 the touch screens, um, you are actually Android tablets, um, and they’ve also got their video 00:08:50.930-->00:08:55.935 processors and digital media streamers that use Linux. Um, so, so basically if something I 00:08:58.204-->00:09:04.511 talk on today is specific to the Windows side or the Android side, I will try my best to 00:09:04.511-->00:09:09.516 point it out. Um, I have kind of a small sample set so some of them are like I don’t know if 00:09:12.652-->00:09:17.023 this is specific to Windows but whatever. Okay, and just uh, uh, a quick little note about the 00:09:17.023-->00:09:22.028 firmware images on them. Um, so the MC3’s firmware um, was uh, basically a zip archive of WinCE 00:09:24.764-->00:09:29.769 ROM images. Um, should be able to emulate it, but I haven’t got that working yet. Um, I used the 00:09:34.307-->00:09:40.647 dumprom tool to dump the um, the file system down to the OS image, um, so I could look at 00:09:40.647-->00:09:45.652 it. Uh, there is the file types of binaries in there. Um, also interesting to note that in the 00:09:47.854-->00:09:53.560 firmware it actually still has the Windows CE debugging tools that lets you connect, you know, 00:09:53.560-->00:09:58.898 visual studio to a Windows CE device to debug it and stuff. Just kind of interesting that 00:09:58.898-->00:10:03.903 it’s still in there. And then for the TSW uh, again, it’s a zip archive of Android system 00:10:07.707-->00:10:12.645 images, um, so it has everything you need to run a full boot system inside the firmware 00:10:12.645-->00:10:17.650 image. Um, the system image was an ext4 filesystem, so I just mounted it and got access to the 00:10:21.154-->00:10:26.159 uh, file system that way. Um, there is the file types, um, 32-bit, ARM. Um, and I did most 00:10:28.962-->00:10:34.634 my actual in-depth uh, reversing on this platform, um, because I’m more familiar with that than 00:10:34.634-->00:10:39.639 I am with Windows CE. Um, and the binaries, I could get them to disassemble cleaner, um, so I 00:10:44.344-->00:10:49.916 just spent most of my time there. Um, and used the Windows platform to kind of like, you 00:10:49.916-->00:10:54.020 know, verify some things and then find some other like, simple things, like hidden 00:10:54.020-->00:10:59.025 commands and stuff. Okay, so, we know what they are. Now we need to be able to find them. Um, one 00:11:02.595-->00:11:07.967 of the first things I always look for when I’m starting a new IoT project, is a discovery 00:11:07.967-->00:11:12.972 packet. Um, and Crestron did not disappoint. Um, they have this magic packet um, I think that 00:11:15.808-->00:11:20.813 might be uh, the CIP protocol, um, I haven’t gone into like what, what the bytes signify or 00:11:23.783-->00:11:28.321 anything because I didn’t really need to, it wasn’t important for my purposes, um, but it would be 00:11:28.321-->00:11:35.028 something to look at in the future. Um, so yeah, you send this packet to um, 41794 00:11:35.028-->00:11:41.200 broadcast, um, you can also do a unicast, which will be important for my next slide. Um, but the 00:11:41.200-->00:11:45.972 response you get back from all the Crestron devices contains their hostname, uh, the model, 00:11:45.972-->00:11:50.977 the firmware version and the build date. So, we can add it to Shodan. Uh, so now you can look 00:11:56.182-->00:12:01.554 for Crestron devices that are connected directly to the internet. Um, usually there is 00:12:01.554-->00:12:06.559 around 20 to 23-->000 of these directly connected. Um, the results of models show that 00:12:09.696-->00:12:14.634 there is like the two most deployed uh, devices that were connected directly to the 00:12:14.634-->00:12:19.639 internet um, were an even split between a CP3 and an MC3. Um, and for those eagle eye 00:12:22.275-->00:12:27.280 observers in the audience, um, that’s actually the Las Vegas airport here. They have a 00:12:30.416-->00:12:35.421 Crestron device connected directly to the internet at the airport. Okay, so, all that 00:12:38.191-->00:12:43.096 said, what is Crestron? Well they are a lot of different things, running different 00:12:43.096-->00:12:49.836 programs on different platforms in different environments. But, I did find a couple of universal 00:12:49.836-->00:12:56.209 truths and this is where we get into the good stuff. So, universal truth number 1 – 00:12:56.209-->00:13:01.147 unauthenticated admin access to the CTP console by default. [Applause] Okay, so, so, um, the 00:13:10.256-->00:13:16.296 CTP platform I mentioned earlier um, but it’s basically, a, uh, a telnet console um, connected, 00:13:16.296-->00:13:21.301 er, um, listening on port 41795, um, and it gives you a lot of uh, built in commands that you 00:13:24.704-->00:13:29.709 can run to control the different aspects of the, of the controller. Um, it’s got a 00:13:32.612-->00:13:39.585 sandbox file system, um, so just limited access and you can like upload and download files within 00:13:39.585-->00:13:44.590 that sandbox. Um, auths, it actually has some really good authentication mechanisms. Um, 00:13:48.261-->00:13:52.865 you know, they’ve got different access levels and active directory tie-ins, encryption, 00:13:52.865-->00:13:57.870 but it’s all off by default, and um, and nobody, you know, nobody turns it on. Um, so like I 00:14:00.673-->00:14:06.179 mentioned earlier, you kind of like the complexity of these systems is so great that you 00:14:06.179-->00:14:11.184 kind of have to rely on a, uh, security conscious programmer um, to know that they need to 00:14:13.186-->00:14:18.191 enable authentication, um, and they end up like concentrating more on getting all of the 00:14:20.760-->00:14:27.033 moving pieces working together than they do like working together and also having to 00:14:27.033-->00:14:33.072 enable security and stuff like that, it’s just another headache that, that it just does happen. 00:14:33.072-->00:14:38.077 Um, and then on top of that, it’s not exactly um, a one step process either, um, to get 00:14:40.113-->00:14:45.118 authentication enabled. Um, so it just never gets turned on. So, when you connect to the CTP 00:14:47.453-->00:14:51.591 console, you get like a little header that tells you what device you are connected to. Um, 00:14:51.591-->00:14:56.596 and if you run whoami, anonymous user, administrator. Okay, so once you get in, um, basically, 00:15:02.769-->00:15:07.640 the, the standard things, I mean, they give you a lot of commands, I’ll show you in the 00:15:07.640-->00:15:14.213 demo bit, a lot of commands available by default. Um, but some of the basic things you can 00:15:14.213-->00:15:20.853 do is change when you bring up, um, different services, um, like they’ve got a web server on 00:15:20.853-->00:15:27.493 there, SSH, Telnet, FTP, um, the Android tablets actually have a SIP server running on them to do 00:15:27.493-->00:15:32.498 that, that intercom thing at the door that I was mentioning. Um, you can also get access to all 00:15:34.700-->00:15:40.106 of the network info like IP address and MAC address, which is also going to be important in 00:15:40.106-->00:15:46.612 a minute. Um, and then you can also do arbitrary file, file upload uh, within that sandbox, 00:15:46.612-->00:15:51.617 um, using the fgetfile and fputfile for HTTP or FTP file transfers and then also have 00:15:55.655-->00:16:00.593 XMODEM um, available if you are old school. And then you can also do firmware updates, and 00:16:03.696-->00:16:08.701 program updates, um if you guys, if you made a program that um, takes in commands, uh, you can 00:16:11.671-->00:16:16.642 send that program commands through the CTP console. Um, you can just mess with people by 00:16:16.642-->00:16:21.647 sending different things to the, to the onscreen display and you can play audio and video files 00:16:25.384-->00:16:30.389 and whatever. Have fun with people. Um, so, that was fine, um, and I knew that typing help 00:16:34.493-->00:16:41.000 all and seeing a list of commands, that probably wasn’t all of the commands that are on 00:16:41.000-->00:16:46.672 the thing. Um, so I started pulling apart the, the binaries for the surfaces and I ended up 00:16:46.672-->00:16:50.810 finding a bunch of hidden commands that are completely undocumented that you also have 00:16:50.810-->00:16:56.582 access to. Um, so you can see all of the running processes, um, this is outside of the 00:16:56.582-->00:17:03.522 sandbox so these uh, binaries are running outside of the sandbox. Um, you can also view 00:17:03.522-->00:17:10.363 and modify all the stored SL certificates on the devices, um, which could come in handy for 00:17:10.363-->00:17:15.368 things, for certain things. Um, this one was just kind of funny. Um, Dr Watson is on the, the 00:17:18.404-->00:17:25.177 Windows CE platform so it could help you with debugging crashes. Um, this one I thought is really 00:17:25.177-->00:17:31.450 cool. You can actually directly talk to the chips on the board using I squared c. Um, so you’ve 00:17:31.450-->00:17:37.990 got like your double e prom, your, video decoder, um, and stuff, um, I thought that was 00:17:37.990-->00:17:43.930 cool. I’ve only seen that on Windows CE, um, and actually I think I’ve only tried that on my 00:17:43.930-->00:17:49.735 MC3, uh, so I don’t know if that’s like a widely used command or not, but it was 00:17:49.735-->00:17:54.740 there. Um, the real fun stuff that you can go is on the Android platform. Um, so you’ve 00:17:58.577-->00:18:04.617 got this browser open and browser close uh, where you can like open up the chrome browser 00:18:04.617-->00:18:09.622 and direct it to whatever website you want. Um, you can also send key presses and uh, 00:18:13.893-->00:18:19.966 touches, to the, to the UI with an Android device. Uh, so essentially like you know, full 00:18:19.966-->00:18:24.971 control remotely of the Android tablet. Um, and then you can also record uh, audio from the 00:18:30.109-->00:18:35.014 microphone remotely [laughter], um, by just running sys commands, you’ll give it the 00:18:35.014-->00:18:40.353 name of a file and length of time you want to record and then it will dump audio from the 00:18:40.353-->00:18:45.358 microphone to a file that you uh, download via FTP on the device. Um, you can also control 00:18:47.760-->00:18:52.765 like mic volume and stuff like that so, pretty awesome. Okay, let’s get into our first demo. 00:18:55.534-->00:19:00.473 So, I think my, my MC3 is starting to die on me so I have to like begin to wake it up 00:19:06.278-->00:19:11.283 before I can use it. There we go. Okay, so, um, this is my, my scanner, um, and basically like 00:19:25.031-->00:19:30.036 it sends out that magic pro to broadcast and then parses all of the um, all of the uh, returned 00:19:34.106-->00:19:39.111 values I get, and then for each IP address that, that, um, that is sending a response, um, I’ll 00:19:42.014-->00:19:46.886 open up the, or I’ll attempt to open up a connection on their CTP console and run the whoami 00:19:46.886-->00:19:51.891 so I can um, enumerate what user I am. Um, okay, so, running that, where is [mumbling]. Okay, 00:20:04.403-->00:20:09.408 uh, so, so, running that, you can see I’ve got 192 dot 168 dot 1 dot 3 is the MC3. Um, there is 00:20:12.278-->00:20:18.417 the firmware that it is running, the build date, and you can see open CTP console running as the 00:20:18.417-->00:20:23.422 administrator. Um, and then on 192 dot 168 dot 1 dot 2, uh, that’s a TSOU, um, again 00:20:26.992-->00:20:31.997 firmware, and the CTP console is open, but you will notice it says unknown, um, and if you 00:20:34.400-->00:20:39.405 look at the , at the binary that handles this, um, you can see it’s doing like one, one check 00:20:41.507-->00:20:46.512 for one value, and if that, if that check returns false, then it defaults to unknown, um, so I 00:20:49.882-->00:20:54.887 guess that just doesn’t work on the Android Linux um, platform. I’m honestly not really sure 00:20:57.022-->00:21:01.961 about that. Um, so, let’s try connecting to the MC3. Can everybody see that? Uh, it’s 00:21:09.635-->00:21:14.640 down at the bottom of the screen. Should I try that again? Hang on. There we go. Is that 00:21:29.021-->00:21:34.026 better? Um, can everybody read that okay? So, so basically, if you type help all, you can see 00:21:37.263-->00:21:42.268 like they give you a huge amount of commands uh, that you can run. Like a lot of commands. Um, 00:21:44.703-->00:21:49.708 and one that I’m going to run, I don’t know if I ever mentioned this one, but um, so yeah, like 00:21:56.615-->00:22:01.554 IP config, you can get the MacOS remotely, even if you’re not on the same um, subnet as the 00:22:04.056-->00:22:09.061 device. Um, which is pretty cool. Um, let me do whoami. So, I’m on as administrator. Um, so, 00:22:17.837-->00:22:22.841 let’s connect to the TSW. So again, huge amounts of, um, commands available, um, you can 00:22:37.423-->00:22:42.428 see there is a lot of SIP stuff on this one that you have access to. Um, media stuff. Um, and so, 00:22:51.270-->00:22:57.376 kind of cool. Um, if I do like browser open, and you’ll see like the chrome browser pop up 00:22:57.376-->00:23:02.314 on there, I think, and I can do like um, browser close, and close it. Um, so kind of cool. 00:23:05.885-->00:23:07.886 If I do like, like dir, you can see this is not the full file system, um, but this is all you 00:23:07.886-->00:23:12.891 have access to. Um, so you know, kind of cool. Whatever. Um. But, I’m a very greedy person, um so 00:23:29.975-->00:23:35.681 you have a significant amount of control over these devices that they just give to you out of the 00:23:35.681-->00:23:41.553 box, but, uh, uh, I, I wanted more. Um, so I started looking for ways that I could escape out 00:23:41.553-->00:23:46.558 of the CTP sandbox and get full control of the OS. Um, so I was looking around at different CTP 00:23:50.062-->00:23:56.235 commands and I found something interesting when I came to the SUDO command, um, apparently, I 00:23:56.235-->00:24:01.173 wasn’t the only one who found this either, which I will mention uh, in a minute. Um, but 00:24:03.842-->00:24:08.847 yeah, so, so yeah, something interesting in the SUDO command where you can see there is like 00:24:11.116-->00:24:16.121 a crengsuperuser, crsuperuser, and then this binary um, SUPW E-generator um, thing that 00:24:18.590-->00:24:24.530 they’re calling. Um, which leads me to universal truth number 2 – Secret Engineer Backdoor 00:24:24.530-->00:24:29.535 Accounts. So, um, yeah, the two accounts crsuperuser and crengsuperuser. Um, I found out 00:24:34.006-->00:24:39.011 like, like this week, um, that these were also simultaneously um, submitted by Justin, with 00:24:42.081-->00:24:47.086 Security Compass, er, Jackson with Security Compass. Um, like I seriously had a lot of um, 00:24:49.988-->00:24:54.893 vulnerability advisory collisions on this. Um, it hardly ever happens to me and 00:24:54.893-->00:24:59.565 these were all, like these were all like submitted within weeks of each other, like super 00:24:59.565-->00:25:04.503 coincidental and crazy. Yeah, shout out. Um, so this, these backdoor accounts are present in 00:25:07.072-->00:25:12.077 all their current products implementing the SUDO commands, I believe. Um, again, my sample 00:25:14.646-->00:25:19.651 set is a little limited, but I think, um, they way they work is uh, they’ve got unique passwords 00:25:22.187-->00:25:28.727 for every device, um, which is like a 16 character, alphanumeric, um, randomly 00:25:28.727-->00:25:33.866 generated password. Um, but it is actually algorithmically generated based on the MAC 00:25:33.866-->00:25:38.871 address which I already showed you can get through the CTP console. Um, so, I would have 00:25:41.573-->00:25:47.479 been okay. This is probably the only time you will ever hear me say they should have hardcoded 00:25:47.479-->00:25:53.619 the passwords in the firmware. Um, because if they, if they found some way to hardcode the 00:25:53.619-->00:25:59.224 password and just burned it into the firmware, if it was unique per device, that would have been 00:25:59.224-->00:26:04.163 fine. Or if they generated it based on something I couldn’t get remotely, also fine. Um, but 00:26:06.165-->00:26:11.837 instead, um, they based on something I had access to remotely through the CTP 00:26:11.837-->00:26:16.842 console, and they included the generator algorithm in the firmware, so I was able to 00:26:20.212-->00:26:26.885 reverse engineer the generation algorithm, um, so stick with me, it’s complicated. So, basically 00:26:26.885-->00:26:31.890 you start out with a SHA1 digest, you populate it with a MAC address and um, a static 00:26:35.694-->00:26:40.699 string. Um, there is a different static string for a crsuperuser and for crengsuperuser. Um, so 00:26:43.168-->00:26:48.340 depending on which one you are trying to use, you have to use the right static string. Um, so 00:26:48.340-->00:26:53.345 you take that SHA1 digest, and you use that as the key for an RC4 cipher with no IV. Um, and 00:26:57.483-->00:27:02.421 then you use that RC4 cipher to encrypt a second static string and then the resulting encrypted 00:27:04.590-->00:27:11.597 string, um, you go through each character of that and module list it with 62, which is the 00:27:11.597-->00:27:18.437 length of their, their character set and then use the result as an index to pick a character out 00:27:18.437-->00:27:25.344 of their character set. And then you end up with a 16-character alphanumeric password for your 00:27:25.344-->00:27:30.349 superuser for that device. And, if you’re super lazy, I also implemented it as a ruby script, 00:27:33.151-->00:27:38.156 er, a ruby function. So, there you go. You can enjoy that whenever my slides get released. 00:27:40.626-->00:27:45.631 Okay, so, what can you do with the, the engineer backdoor accounts? Um, so the 00:27:47.866-->00:27:52.871 crengsuperuser uh, enables every more hidden commands. Um, so on the Windows CE side, um, you can 00:27:55.774-->00:28:02.114 actually do consoledebug commands and it will list out all of the commands, even the 00:28:02.114-->00:28:08.053 undocumented ones. Um, so that’s pretty handy to have. Um, also on the Windows CE platform, they 00:28:08.053-->00:28:12.991 give you access to regedit, you can edit the registry of the device, and they give you a 00:28:12.991-->00:28:18.564 launch command, which actually lets you execute any executable on the device even on the 00:28:18.564-->00:28:23.569 outside of the sandbox. Um, and then on the um, Android side, they’ve got this telnetport 00:28:26.705-->00:28:33.278 command, um, and that lets, it gives you options on or off, and that lets you turn telnet on or 00:28:33.278-->00:28:39.985 off, but when you do that as the crengsuperuser, they give you a third option, which is 00:28:39.985-->00:28:44.990 telnetport DEBUG, um, so when you do telnetport DEBUG, it actually opens up a root shell 00:28:47.859-->00:28:54.800 on the, on the device that you can connect to, um, outside of the sandbox. And as far as 00:28:54.800-->00:28:59.805 crsuperuser, I actually haven’t found a use for that yet. Okay, so, let’s go first to more 00:29:04.743-->00:29:09.748 demos. Everyone still with me? Okay, so what I do with the MC3, you can see here is the, the 00:29:40.912-->00:29:45.917 generating password based on MAC address, um, all that stuff. Um, so I connect to the CTP port on 00:29:49.187-->00:29:54.192 the MC3, um, I run estat, which is a command that also gives you a MAC address, um, I parse that 00:29:56.795-->00:30:01.800 out, send it and generate a password for the engineering user, and then I basically use 00:30:01.800-->00:30:06.805 the, the regedit command, um, to disable authentication for telnet, and then I launch um, 00:30:10.475-->00:30:15.480 telnet, telnet0, um and then that gave me a telnet shell outside of the sandbox on the 00:30:21.953-->00:30:26.958 MC3 devices. Um, and then if we look at the TSW side, it is much, much more straightforward. 00:30:34.132-->00:30:39.137 Um, so, again, um, generating password, running estat to get a MAC address, um, and then all I 00:30:42.240-->00:30:47.245 do is run the telnet DEBUG and it opens up a, a debug shell for me. Alright, so let’s run those. 00:30:50.415-->00:30:55.420 I might have to ping my, my guy again before. Okay, well let’s try pinging it first. Okay, 00:31:11.236-->00:31:16.241 that’s fine. - [mumbling while typing] - Hello. Oh, dear. That one’s not working. Let’s try 00:31:33.892-->00:31:38.897 the, the TSW one. So much for the demo fail. Hopefully both of my demos don’t fail. There we 00:32:00.685-->00:32:05.690 go. This one’s cooler anyway because it is an actual - [applause] - and, so now if you 00:32:16.902-->00:32:21.907 like, uh, as you can see, we are actually like outside of the, outside of the CTP um, file 00:32:24.242-->00:32:29.247 system and have full access to the, to all of the, good stuff. Um, I found out, um, it’s 00:32:35.854-->00:32:41.893 actually uh, running lollipop, um, like Android 5 1 1, I think. Um, so kind of out of date. I 00:32:41.893-->00:32:46.898 don’t know if that will change in the future, firmware versions or not. Um, but yeah, okay so, 00:32:49.434-->00:32:54.439 um, so DEBUG as a backdoor is awesome. Okay, so, that was, that was awesome, that was uh, a 00:33:02.814-->00:33:07.819 fun thing to find. Um, but, also, since it’s Defcon, uh, we should talk about some, some RCE 00:33:11.556-->00:33:16.561 vulns. Um, so I’ve found uh, 22 command injection vulns on the Android platform. Um, I actually 00:33:20.866-->00:33:25.904 had to cut myself off um, because I kept like finding more vulns while I was reclassing 00:33:25.904-->00:33:30.909 other vulns and I was like I’ve got to get these advisories in. So, yeah, the ping command, 00:33:33.178-->00:33:36.815 vulnerable to command injection is another one of those collisions that I found out 00:33:36.815-->00:33:41.820 about after the fact, but yeah, yeah, Cale and Jordan from Rapid7 also found that one. Um, 00:33:44.522-->00:33:49.527 and then dir, um, was also found by Jackson, um, but then there is also like adduser, cd, 00:33:53.131-->00:33:58.136 copyfile, like basically anything that takes like a string from, from the user. Um, 00:34:00.138-->00:34:06.778 so kind of the, uh, a typical, this, this cell function was actually called quite a bit uh, 00:34:06.778-->00:34:13.718 by other, by, by various commands uh, and so you can see there the disassembly and then 00:34:13.718-->00:34:19.591 the decompiled version of that, that disassembly, um, on the right. Um, you can see it’s 00:34:19.591-->00:34:26.097 pretty straightforward just like, um, you know, build up that string based on the, the 00:34:26.097-->00:34:31.102 input you’re given and then send it straight to system. Um, so super, yeah, super easy. Um, I 00:34:34.873-->00:34:40.478 noticed that these commands seemed to be um, you know programmatically handled on 00:34:40.478-->00:34:45.483 Windows CE, um, so, so you know they weren’t vulnerable to the same command injection as on the 00:34:47.986-->00:34:52.891 Android platform. Um, I don’t know if that’s because their programmers are more familiar 00:34:52.891-->00:34:58.229 with Windows CE because they’ve had a longer history with it or what, um, don’t want to guess. 00:34:58.229-->00:35:03.068 Um, but yeah, everything was just kind of punted to shell on Android instead of handling it 00:35:03.068-->00:35:09.774 in code. Um, most were super simple to exploit, like isdir, backticks, whatever commands you 00:35:09.774-->00:35:15.513 want to run, backtick. Um, there were a couple of them that were more difficult, I had to jump 00:35:15.513-->00:35:20.752 through some hoops to get the exploits out of those. Um, so like routeadd and routedelete, 00:35:20.752-->00:35:27.659 um, they take whatever argument they are given and then the up-case it before using it. Um, 00:35:27.659-->00:35:33.465 and since this is a Linux based platform, um, commands are case sensitive, um, and there aren’t 00:35:33.465-->00:35:38.470 any useful all uppercase commands, um, that I know of. Um, so my first solution was to 00:35:42.040-->00:35:47.812 create a shell script, um, filled with the commands that I wanted to run, um and then call 00:35:47.812-->00:35:52.817 it all capital BLAH, um and then upload it with that arbitrary file upload from earlier, um, so 00:35:55.854-->00:36:00.792 I could just get it into the sandbox. Um, but the upload script didn’t have execute 00:36:03.328-->00:36:08.333 permissions, um, and $SHELL and $BASH were not set, um, so, I found out, I actually learned 00:36:10.802-->00:36:17.175 this while I was doing this, um, so, so, normally, we use $0, it gives you a reference to the 00:36:17.175-->00:36:19.177 calling program. Um, but apparently, when you are doing this um, from within a system 00:36:19.177-->00:36:21.946 call, $0 actually gives you a reference to the shell, um, which kind of makes sense 00:36:21.946-->00:36:27.052 because a system like spawns a new process that will be like an actual shell, uh, so using $0, I 00:36:27.052-->00:36:32.057 was able to get a reference to shell. Um, so then the final injected string was $0$IFS uh, 00:36:46.404-->00:36:51.409 for internal field separator, um, because it all had to be in one argument, and then dot slash 00:36:54.112-->00:37:00.218 BLAH, and then it would actually run my, my shell script. Um, I found out much, much later, um, 00:37:00.218-->00:37:06.024 that dot is actually a unix command. I ever knew that before. Um, and it works kind of 00:37:06.024-->00:37:11.029 like source. Um, so I could have also used dot instead of dot $0, but whatever. Whatever works. 00:37:14.599-->00:37:19.604 Okay, so, final demo of my talk. Okay, so, we already got a root shell. Um, I’ve got, got an 00:37:30.281-->00:37:35.820 exploit that, that could give us another type of root shell here, but not, not good enough. I 00:37:35.820-->00:37:40.825 wanted to do something different. Um, so, so, what I did, I, um, used that command 00:37:51.770-->00:37:56.774 injection um, to modify um, one of the config files that controls all of the streaming 00:38:00.712-->00:38:05.717 settings, um, and then I used the, the command injection again to restart the CSIO service to 00:38:08.253-->00:38:14.726 pick out those changes, and then all of the sudden the RJSPC streaming started working, um, 00:38:14.726-->00:38:19.731 so I’ll show you that in just a second. First, um, let me connect to. Okay, so, you’ve got 00:38:37.182-->00:38:42.187 your file system, if you do like, I love this example because like it’s so like 00:38:46.124-->00:38:51.629 immediately obvious that it worked. And all of the sudden there is a test dot txt in 00:38:51.629-->00:38:56.634 there. So, if you do like your writing, uh, your injecting commands as root. I just love 00:39:02.407-->00:39:07.412 that example. Okay, so, let’s run, let’s run the good sort. Okay, spy mode enabled and in a 00:39:21.326-->00:39:26.331 second we are going to pop up, and you will see. [applause]. So, a, a very important thing to 00:39:39.177-->00:39:45.483 note is that there is no change on the touch screen to indicate that it is now remotely 00:39:45.483-->00:39:50.488 streaming from the webcam and did I mention these things are uh, being used in like hotel 00:39:58.596-->00:40:03.601 rooms, and stuff. Yeah. Okay, so, there’s, there’s my final demo. Um, I think we’re doing 00:40:13.111-->00:40:18.116 good on time. Okay, so, so, let’s wrap things up. Um, so, so the potential for good security 00:40:23.021-->00:40:27.692 practice is there in these devices, but the problem is that it’s just turned off by default, 00:40:27.692-->00:40:33.631 um, so you have to rely on either installers and programmers to, to do it for 00:40:33.631-->00:40:38.636 you, um, or if you know that this problem exists, then you can do it yourself, um, which is 00:40:40.672-->00:40:45.777 kind of one of the reasons why I like giving talks like this, informing that the problem is 00:40:45.777-->00:40:52.216 actually there. But basically, the bottom line is if security hasn’t been enabled by default, 00:40:52.216-->00:40:58.556 it’s not going to get enabled. Um, so it really um, is dependent on Crestron making the 00:40:58.556-->00:41:05.129 changes, um, which they have. I’ll get to that in a second also. Um, so yeah, this was an 00:41:05.129-->00:41:11.336 interesting situation, um, because of the uh, types of environments where these things 00:41:11.336-->00:41:17.141 are deployed. Um, it makes it so there is a high potential for abuse by insider threats so, um, 00:41:17.141-->00:41:21.646 like you’ve got these things in all of the Microsoft’s boardrooms and let’s just say 00:41:21.646-->00:41:26.651 that Microsoft has a disgruntled employee somewhere in the world, what are the odds of that, um, 00:41:29.787-->00:41:35.493 so they can actually use things like this, like recording from the webcam and the microphone, 00:41:35.493-->00:41:41.099 um to do like corporate espionage, and like snoop on the boardroom meetings and stuff, 00:41:41.099-->00:41:46.104 um, and then if course, the, the hotel, the hotel room thing, um, like so, so, usually you say 00:41:48.406-->00:41:54.579 like oh we’re going to put these devices on their own isolated network so all of these devices 00:41:54.579-->00:41:59.817 are separate from all these other things and then you have this situation with the hotel 00:41:59.817-->00:42:05.156 room where some hotel guest goes to a room with one of these devices, pulls it off, plugs it 00:42:05.156-->00:42:09.660 into their laptop, and then now they can reach all of the other ones in all of the other hotel 00:42:09.660-->00:42:14.665 guest’s rooms. Um, you know, something to keep in mind. Um, and like I mentioned earlier, 00:42:19.604-->00:42:23.975 the Android platform seems way less secure than the Windows CE platform, which caught me off 00:42:23.975-->00:42:29.480 guard at first, um, because immediately, you know Windows CE, ha, ha, ha, so insecure. Uh, 00:42:29.480-->00:42:36.053 but they actually they do a much better job on the Windows CE platform than they did on the 00:42:36.053-->00:42:40.892 Android platform. Um, so, I don’t know if they’re just starting to spread themselves 00:42:40.892-->00:42:46.097 too thin with moving to different platforms, or what, but so. Very, very important 00:42:46.097-->00:42:52.069 slide. Um, Crestron has released updates to address all of the issues that I have discussed 00:42:52.069-->00:42:57.074 today. Um, I actually got word earlier this, this week, um that my advisories for all of this 00:43:00.011-->00:43:06.984 stuff were finally going to be released, um, yesterday. [Speaker laughing] Um, but, 00:43:06.984-->00:43:11.823 yeah, Crestron has released updates for all of this stuff, and uh, more importantly than 00:43:11.823-->00:43:18.329 that, um, enable authentication. It’s a few steps to get, to get enabled, um, but you should 00:43:18.329-->00:43:22.934 definitely do that because if the actual decent authentication mechanisms are enabled, then 00:43:22.934-->00:43:24.936 none of my attacks, I could not even get into the CTP console to pull off any of my attacks. So. 00:43:24.936-->00:43:29.941 And, and usual with these kinds of projects, um, I’ve got lots of work that I still need to do. 00:43:34.479-->00:43:39.484 Um, so, so there’s lots of stuff still on the CTP platform. Um, there’s way more vulns that I, 00:43:43.087-->00:43:49.427 you know, haven’t even scratched the surface of yet. Um, but there is also like this SIMPL 00:43:49.427-->00:43:55.399 programming language that, that uh, might be audited. Um, the PUF files that are firmware 00:43:55.399-->00:44:00.605 files. Um, and then, there’s, there’s a crazy amount of other services listening on these 00:44:00.605-->00:44:05.610 things also, like CIP, HTTP, uh, SNMP, you know, you name it. Um, and then of course, they’ve got, 00:44:09.580-->00:44:15.920 um, a slew of other products like XIO Cloud would be cool to look at and Xpanel. There’s a 00:44:15.920-->00:44:20.925 lot. Um, anyways. The last thing, the last bullet point on this is IOAVA. Um, it’s kind of 00:44:23.694-->00:44:28.699 just like, like whispered rumors at this point. Um, but what it stands for is Internet of Audio 00:44:30.801-->00:44:35.806 Video Alliance. Um, so it’s a partnership between Crestron, Microsoft and Intel um, to make 00:44:37.942-->00:44:42.947 like an embeddable um, device that, that can go and turn all AV equipment into internet 00:44:46.183-->00:44:51.055 things equipment things, basically. So, that’s something to keep an eye out for in the 00:44:51.055-->00:44:57.428 future. And then yeah, that’s it. Those are the ways that you can reach me if you have any 00:44:57.428-->00:45:02.366 questions or just want to chat about stuff. Um, yeah. There you go. Thank you. [applause]