00:00:02.669 --> 00:00:09.943 I am really excited to come to this talk. I was really excited. 00:00:09.943 --> 00:00:18.352 How many of you in the room want a Tesla? Me too. People from the 00:00:18.352 --> 00:00:26.193 company is going to be there ask if they will give us one? Yes? 00:00:26.193 --> 00:00:31.798 No? Rats. Let's get started. It's my pleasure to introduce 00:00:31.798 --> 00:00:38.505 Marc and Kevin to talk about hacking a Tesla model S. Let's 00:00:38.505 --> 00:00:46.346 give them a big hand [ applause ] >> Thank you all for coming. 00:00:46.346 --> 00:00:53.620 So I'm Kevin Mahaffey here with Marc Rogers. We are here to talk 00:00:53.620 --> 00:01:01.461 about in hacking a model S. What you are hearing now is the door 00:01:01.461 --> 00:01:07.634 chime sound. If you think it's annoying for coming in, it's 00:01:07.634 --> 00:01:14.341 even more when you are hearing this 14 hours and 3 days 00:01:14.341 --> 00:01:21.048 straight. This talk is about how to secure cars. Some cars need 00:01:21.048 --> 00:01:28.889 to be recall and that's not going to work if cars need to be 00:01:28.889 --> 00:01:34.494 patched weekly. Tesla pushed a patch yesterday. You click one 00:01:34.494 --> 00:01:40.100 button and it's applied. I'm super excited about that. [ 00:01:40.100 --> 00:01:47.374 applause ] >> Try this one. >> I'm also known as CJ you 00:01:47.374 --> 00:01:52.980 probably have seen me shouting outside. The reason we started 00:01:52.980 --> 00:01:59.686 hacking the model S because it's the most connected car in the 00:01:59.686 --> 00:02:06.393 world. If we should look at car security, we should look at 00:02:06.393 --> 00:02:13.667 arguably design every other car end up to be using. And we want 00:02:13.667 --> 00:02:21.508 to do that bearing in mind in the future we are going to see 00:02:21.508 --> 00:02:27.114 an explosion of connected things. And we already have a 00:02:27.114 --> 00:02:32.152 problem with embedded devices being vulnerable and not being 00:02:32.152 --> 00:02:38.859 updated imagine how beside that problem is going to be from few 00:02:38.859 --> 00:02:44.464 million devices to 25 billion devices. >> And you might 00:02:44.464 --> 00:02:50.637 replace your computer or your phone every couple years. If you 00:02:50.637 --> 00:02:57.911 are not fixing vulnerability you might have a car for a couple of 00:02:57.911 --> 00:03:04.084 years and not fixed that's a giant deal. When that happens 00:03:04.084 --> 00:03:09.689 you have all these industries building new things and don't 00:03:09.689 --> 00:03:15.295 have software experience. And you might ask those companies go 00:03:15.295 --> 00:03:22.002 to the straight line of the internet and you are not aware 00:03:22.002 --> 00:03:28.709 of it bad things happen. What are the best practices in mind? 00:03:28.709 --> 00:03:35.415 Do people know how to build secure things? >> Not that these 00:03:35.415 --> 00:03:40.454 companies set out to make vulnerable things. Bio companies 00:03:40.454 --> 00:03:47.160 are still following best bio med. For cars, they are not just 00:03:47.160 --> 00:03:52.199 internet security companies so they don't fully understand. >> 00:03:52.199 --> 00:03:58.371 So if there are no best act practices you have something 00:03:58.371 --> 00:04:03.977 that proximate this. Nobody is doing anybody bad competing with 00:04:03.977 --> 00:04:09.583 competitors and they match quickly to their doom. I was 00:04:09.583 --> 00:04:16.857 happy to see that Lami's 2. [ applause ] Thanks. If there are 00:04:16.857 --> 00:04:22.462 best practices even companies that are not cyber expert they 00:04:22.462 --> 00:04:29.736 can still have things that go well. Right now if you are level 00:04:29.736 --> 00:04:38.712 zero they are easy way to level up 3, 4, or 5 and raise the bar. 00:04:38.712 --> 00:04:44.885 >> Anything that man breaks, man can breaks. It's how companies 00:04:44.885 --> 00:04:49.356 deals with vulnerability. >> Best practices they are 00:04:49.356 --> 00:04:54.961 important. Good when building a system for the first time. 00:04:54.961 --> 00:05:02.235 Trying to changing the system is hard. So why the model S? Well, 00:05:02.235 --> 00:05:09.509 the model S, we thought it would be a car that's most well 00:05:09.509 --> 00:05:15.115 designed, a lot of engineers behind it. We found actually 00:05:15.115 --> 00:05:21.288 this it's actually designed very, very well. So we hope that 00:05:21.288 --> 00:05:26.326 if anyone involved today, tomorrow in the auto industry 00:05:26.326 --> 00:05:32.499 hopefully take the learnings we have what they did right, wrong 00:05:32.499 --> 00:05:39.773 and apply to the future cars and hope the cars will get more 00:05:39.773 --> 00:05:46.479 secure. >> Now what this talk isn't. This talk is not how 00:05:46.479 --> 00:05:53.186 everyone with a connected car is going to die. >> Nor pull 00:05:53.186 --> 00:05:59.893 something out get hub, hack your car. Not know your next... [ 00:05:59.893 --> 00:06:07.167 applause ] I was wondering how that was going to go over. Good. 00:06:07.167 --> 00:06:12.772 Public service announcements. >> You have to be really careful 00:06:12.772 --> 00:06:20.046 hacking cars. A car isn't just a computer system. A car is a 00:06:20.046 --> 00:06:26.219 computer system that's traveling 100 miles an hour, 60 miles an 00:06:26.219 --> 00:06:32.926 hour. >> Yes, officer, I swear. And the worst thing that happens 00:06:32.926 --> 00:06:39.099 isn't the blue screen. That should be obvious. But Def Con 00:06:39.099 --> 00:06:46.373 we have a sense of mischief which I love but when you are 00:06:46.373 --> 00:06:52.545 dealing with things that fast and critical, you have to be 00:06:52.545 --> 00:06:58.718 really, really careful. So what we did we collaborated with a 00:06:58.718 --> 00:07:04.891 great group of people and set strong rules of engagement. >> 00:07:04.891 --> 00:07:11.064 It's really, really hard to know whether you are hacking the 00:07:11.064 --> 00:07:16.670 embedded system or transversed to the company is connected to. 00:07:16.670 --> 00:07:22.842 So we made sure that we didn't accidentally hacked Tesla. The 00:07:22.842 --> 00:07:28.448 next thing we set ourselves some boundaries. We didn't do 00:07:28.448 --> 00:07:33.486 anything that would make permanent changes. We knew we 00:07:33.486 --> 00:07:39.092 were exploring black box system we couldn't foresee any changes 00:07:39.092 --> 00:07:45.799 would have to the ongoing safety of that vehicle. What happens if 00:07:45.799 --> 00:07:52.505 you overwrite a firmware that happens to the ecu that could do 00:07:52.505 --> 00:07:59.779 bad things? >> Not good. >> So we agree that we would do 00:07:59.779 --> 00:08:05.385 everything in memory and only probe and prove concept of 00:08:05.385 --> 00:08:10.990 things. >> Tesla established a bug bounty program. Rule of 00:08:10.990 --> 00:08:16.596 engagement from don't touch to touch the servers they allowed 00:08:16.596 --> 00:08:23.870 us to touch. >> And they started the bug bounty program before we 00:08:23.870 --> 00:08:31.711 started. >> So I'm sure a lot of you are interested what is the 00:08:31.711 --> 00:08:37.317 model S what's inside, remember these words very carefully. So 00:08:37.317 --> 00:08:43.490 there are three systems. One is the IC, the instrument cluster. 00:08:43.490 --> 00:08:49.662 The 8-inch screen above your steering wheel. The number 2 is 00:08:49.662 --> 00:08:54.701 the CID, the center information display. The 17" touchscreen. 00:08:54.701 --> 00:09:01.408 The thing in the middle. The really cool laptop in your car. 00:09:01.408 --> 00:09:07.580 And there's the gateway which we illustrated on the dash but 00:09:07.580 --> 00:09:14.854 attached to the PCB to CID. IC, CID, and gateway. Got it? Cool. 00:09:14.854 --> 00:09:21.561 Two of which are Linux system. And there's an rtos is the 00:09:21.561 --> 00:09:27.734 gateway. >> And both Linux systems are running on very old 00:09:27.734 --> 00:09:35.575 abonto. >> So we will get into how we figure this all out. You 00:09:35.575 --> 00:09:40.613 have the infotainment network and the vehicle network. The 00:09:40.613 --> 00:09:46.786 land the ethernet land on the infotainment side and you have 00:09:46.786 --> 00:09:54.060 the can which is the vehicle side. And the only thing we can 00:09:54.060 --> 00:10:00.767 tell that bridges the two is this gateway. That's going to be 00:10:00.767 --> 00:10:05.238 very, very important. From the system architecture standpoint, 00:10:05.238 --> 00:10:11.411 the CID and IC, two are connected from the usb ethernet 00:10:11.411 --> 00:10:17.584 adaptor to the ethernet switch. The CID has wifi, bluetooth and 00:10:17.584 --> 00:10:22.055 self-connectivity and exposes that to internal systems in 00:10:22.055 --> 00:10:28.228 various ways. The gateway is the only thing that bridges the 00:10:28.228 --> 00:10:34.400 ethernet and can bust, and all the of the vehicle controller 00:10:34.400 --> 00:10:41.107 are connected to that. >> It's a phenomenon design. If you think 00:10:41.107 --> 00:10:47.814 about this, this is like the way the airplanes are designed and 00:10:47.814 --> 00:10:53.419 cars are designed. >> This project is the hackers olympics. 00:10:53.419 --> 00:10:57.891 From physical security to browser hacking to network, 00:10:57.891 --> 00:11:04.063 binary reverse engineering. It was kind of fun because we got 00:11:04.063 --> 00:11:10.236 to exercise different parts of our brain. >> We submitted six 00:11:10.236 --> 00:11:16.409 vulnerabilities to Tesla. It took three of them for us to 00:11:16.409 --> 00:11:22.582 gain access to leverage one to get access, and get enough 00:11:22.582 --> 00:11:28.755 information and gain privilege access. We will go into in more 00:11:28.755 --> 00:11:35.461 detail. It took of thinking outside of the box. >> What we 00:11:35.461 --> 00:11:42.735 were able to find. So just want a preview, what we are talking 00:11:42.735 --> 00:11:49.442 about is physical access and we implanted a remote ssh in the 00:11:49.442 --> 00:11:58.418 car and we had some fun with it. >> So the video you will see now 00:11:58.418 --> 00:12:06.259 is model S backdoor and what we can do with that ssh backdoor. [ 00:12:06.259 --> 00:12:14.667 video ] [ music playing ]. >> So what you were able to see there 00:12:14.667 --> 00:12:22.508 is we have route on to the system of the car. We were able 00:12:22.508 --> 00:12:27.547 to control the ui on the instrument cluster 17 00:12:27.547 --> 00:12:34.253 touchscreen and also saw we were able to control some of the 00:12:34.253 --> 00:12:40.960 vehicle aspect itself. >> What that means is we can do anything 00:12:40.960 --> 00:12:47.667 the touchscreen can do. And in the case of this car, the 00:12:47.667 --> 00:12:54.374 17-inch touchscreen is where a lot of stuff done by the driver. 00:12:54.374 --> 00:13:00.546 We can start the car, power roof, control the head lights, 00:13:00.546 --> 00:13:07.820 horns, et cetera. >> So how do we actually go do that? Let's 00:13:07.820 --> 00:13:13.426 first inventory. What's in this car? Number one security bits. 00:13:13.426 --> 00:13:19.032 Get them from amazon. Number two, these are really important. 00:13:19.032 --> 00:13:25.738 If you are pulling off door panels on a car. You would 00:13:25.738 --> 00:13:31.911 likely break things. >> And when you are dismantling Tesla it 00:13:31.911 --> 00:13:37.517 makes you nervous because it's expensive, you will hear sounds 00:13:37.517 --> 00:13:43.122 like plastic breaking. It is normal. >> These are terrible. 00:13:43.122 --> 00:13:48.728 I'm not joking. These are like my nemesis when I'm 00:13:48.728 --> 00:13:53.766 disassembling these. >> When it sounds like plastic shattering, 00:13:53.766 --> 00:14:00.473 it makes you pause. >> Here's the backside. This is a Tesla 00:14:00.473 --> 00:14:05.511 design board with Invidia processing module. What we are 00:14:05.511 --> 00:14:11.117 looking for is anything we can get access to. Unfortunately, 00:14:11.117 --> 00:14:17.290 not so much. Then we pulled out the CID, center information 00:14:17.290 --> 00:14:23.996 display. Lots of cable. Opened it up and then tried to find 00:14:23.996 --> 00:14:31.838 what we can find. This is the backside of CID. >> SD cards. >> 00:14:31.838 --> 00:14:39.112 Memory cards and usb header. [ laughs ]. And then we have a 00:14:39.112 --> 00:14:45.284 very mysterious port. We found a number of things. That's a 00:14:45.284 --> 00:14:51.457 little scary to touch in a system. Memory card, nice. Now 00:14:51.457 --> 00:14:58.164 that we know physically on the device, we want to check out 00:14:58.164 --> 00:15:04.871 what we can do. >> To the browser remember me saying it's 00:15:04.871 --> 00:15:11.577 an old bunch system. The browser is very old. There are several 00:15:11.577 --> 00:15:16.616 well known vulnerabilities for it. Probably the most well 00:15:16.616 --> 00:15:23.322 known, 2014 and also used for ps peter exploitation. >> When you 00:15:23.322 --> 00:15:30.596 are designing any of the system, qt fame work. And if you sit 00:15:30.596 --> 00:15:36.202 downstream, Tesla not only from downstream from that webkit but 00:15:36.202 --> 00:15:42.375 also from qt webkit. I don't know where they are pulling 00:15:42.375 --> 00:15:47.980 directly from the web kit source. If you have multiple 00:15:47.980 --> 00:15:55.254 upstream that are required to be passed for you as end user or 00:15:55.254 --> 00:15:59.725 manufacturer to patch, it creates a logistical challenge 00:15:59.725 --> 00:16:04.764 thing for upstream. This is the vulnerability that Marc 00:16:04.764 --> 00:16:11.470 mentioned that was used to blind the exploit x invdia. It was 00:16:11.470 --> 00:16:17.076 through java script sort with a custom compared function and 00:16:17.076 --> 00:16:23.249 modified the array underneath that sort and write stuff to fun 00:16:23.249 --> 00:16:29.422 places. We were not able to do that arbitrary memory rewrite. 00:16:29.422 --> 00:16:37.830 We were doing it blind. And got it to crash. >> To be fair we 00:16:37.830 --> 00:16:43.436 spent 12-16 hours on it. >> Bluetooth not special thing 00:16:43.436 --> 00:16:50.142 there. Usb. So this is actually a really complicated thing to do 00:16:50.142 --> 00:16:55.748 from cable hacking side of things. You see that little 00:16:55.748 --> 00:17:02.455 header right there. We actually have to fit this back in the 00:17:02.455 --> 00:17:09.729 case and back in the system. We want to use the vehicle's power 00:17:09.729 --> 00:17:17.570 supply and get it to actually fit. >> So it gave us access and 00:17:17.570 --> 00:17:22.608 we could talk to the processor. Unfortunately, the firmware 00:17:22.608 --> 00:17:28.214 locked. >> Yep. The tegra bootloader, we didn't have the 00:17:28.214 --> 00:17:34.921 password. All the ways we didn't get in that's important. All the 00:17:34.921 --> 00:17:41.093 hack you guess the password and automatically you get in. It's 00:17:41.093 --> 00:17:46.132 like failure, failure, failure. Success. I think it's important 00:17:46.132 --> 00:17:53.406 to remember that in a test like this. >> Memory card was much 00:17:53.406 --> 00:17:58.444 easier. Readable file systems. One of them contains mapping 00:17:58.444 --> 00:18:04.050 data which is not so interesting. The other one, much 00:18:04.050 --> 00:18:10.222 more interesting. A file, car keys which contains keys. >> We 00:18:10.222 --> 00:18:16.395 were very happy when we saw that. >> An appreciative name. 00:18:16.395 --> 00:18:22.001 >> Car keys are cryptographic nowadays. Wifi there were no 00:18:22.001 --> 00:18:28.708 open ports when we connected cars to wifi system. As soon as 00:18:28.708 --> 00:18:34.313 it connects to wifi, reach ability. And then it will 00:18:34.313 --> 00:18:39.919 connect to vpn endpoint. Of course, the question is [ 00:18:39.919 --> 00:18:46.092 inaudible ] vpn connection. Open vpn connection that we were able 00:18:46.092 --> 00:18:52.798 to determine. Udp they were using a tls off key. That's not 00:18:52.798 --> 00:18:58.971 authentication. That's we are going to h mac the packet so 00:18:58.971 --> 00:19:06.812 that you can defend the open vpn server from a ddos and no static 00:19:06.812 --> 00:19:12.418 key. So simply presence of that doesn't give you authentication, 00:19:12.418 --> 00:19:20.259 just able to talk to the server and we looked at their pki. So 00:19:20.259 --> 00:19:27.533 Tesla route ca is self signed, change down to a poly cca to 00:19:27.533 --> 00:19:34.240 issue nca. So interestingly vpn server expose to nca and the car 00:19:34.240 --> 00:19:39.845 key that car key, quite literally, also change that to 00:19:39.845 --> 00:19:46.552 that same ca. If you are familiar with x 5 extended key 00:19:46.552 --> 00:19:54.393 usage you can actually say this key can be used for x. In this 00:19:54.393 --> 00:20:00.566 case, web server off and client was client off. There's a 00:20:00.566 --> 00:20:07.840 setting in that whether you want to pay attention to x 593 eku. 00:20:07.840 --> 00:20:15.681 So we ask the question which is okay. When the car talks to our 00:20:15.681 --> 00:20:22.388 open vpn, and it sends the ssl client hello, the server sends 00:20:22.388 --> 00:20:29.095 server, what if it sends the certificate of the car? They are 00:20:29.095 --> 00:20:35.801 chained up in the same root, not eku and treating the certificate 00:20:35.801 --> 00:20:41.407 authority, it would work. Tesla does validate that eku. However, 00:20:41.407 --> 00:20:48.681 if you find any certificate that chains to the issue nca and has 00:20:48.681 --> 00:20:54.286 the server off eku, you could impersonate that vpn most 00:20:54.286 --> 00:20:59.892 likely. Unless there's crazy thing going on. We haven't find 00:20:59.892 --> 00:21:06.599 any yet. Word of caution open vpn make sure you are testing 00:21:06.599 --> 00:21:12.204 through that eku so you don't allow impersonation. >> The 00:21:12.204 --> 00:21:19.478 mystery board. It took us a while for what it was. I would 00:21:19.478 --> 00:21:26.185 like to take credit but people on the internet found it. It's 00:21:26.185 --> 00:21:31.790 ethernet. >> All right. Now, we have digital connectivity inside 00:21:31.790 --> 00:21:39.632 the car. It's going to go faster from here. As soon as we are 00:21:39.632 --> 00:21:44.670 connect, udp. That's a lot. 500 --> 000 per second udp 00:21:44.670 --> 00:21:50.843 broadcast. Yikes. >> So to answer the question of what kind 00:21:50.843 --> 00:21:57.016 of [ inaudible ] does the car collect internally, the answer 00:21:57.016 --> 00:22:02.054 is everything. Literally everything. I don't know what it 00:22:02.054 --> 00:22:09.328 does with that data but you have to pick through it to find 00:22:09.328 --> 00:22:16.602 interesting stuff. >> First the CID we found a bunch of stuff on 00:22:16.602 --> 00:22:23.309 this thing. Lots and lots of open services. The IC fewer but 00:22:23.309 --> 00:22:30.015 yes. Gateway, fewer. Open stuff. We have a lot of attack surface. 00:22:30.015 --> 00:22:37.856 >> Open x 11, really? [ laughs ]. >> Ssh we tested. Tried the 00:22:37.856 --> 00:22:43.462 man in the middle. They validate host keys.Typically what you 00:22:43.462 --> 00:22:48.500 would do you find two systems automatically communicate to 00:22:48.500 --> 00:22:53.539 ssh, you build honey pot hopefully they check password 00:22:53.539 --> 00:23:00.246 authentication and send that to you. It didn't work. We did find 00:23:00.246 --> 00:23:05.851 two services. The vulnerability in it we didn't really explore 00:23:05.851 --> 00:23:12.558 true extent of what could be done, but these are old versions 00:23:12.558 --> 00:23:19.265 with known vulnerabilities to them. So open x 11. >> Open x 00:23:19.265 --> 00:23:24.303 11. What's not to like? Essentially, the most immediate 00:23:24.303 --> 00:23:31.010 thing you could do with that is little display console that sits 00:23:31.010 --> 00:23:36.048 in front of the driver implementation cluster, you can 00:23:36.048 --> 00:23:42.755 put it whenever you want up there. My car goes a million 00:23:42.755 --> 00:23:50.029 miles an hour. >> Screenshot to prove it. >> You can also run 00:23:50.029 --> 00:23:56.201 command off different services. Having that open x 11 server is 00:23:56.201 --> 00:24:03.475 great. >> I think that's about 3:00 a.m. at this point. So we 00:24:03.475 --> 00:24:11.317 had a little fun with open x 11 server. So what else? Do the 00:24:11.317 --> 00:24:18.590 other open services do? We found what is called the ID and CID 00:24:18.590 --> 00:24:24.196 updater, this gives a lot of juicy information. >> These 00:24:24.196 --> 00:24:29.234 appear to be binary firm getting diagnostic information managing 00:24:29.234 --> 00:24:35.941 firmware, a lot of commands are secured. Quite a lot of them 00:24:35.941 --> 00:24:41.547 considered to be safe including the status command which gives 00:24:41.547 --> 00:24:46.585 you tons of interesting information like the state of 00:24:46.585 --> 00:24:53.292 the system, the download for the firmware. >> And you were very 00:24:53.292 --> 00:25:01.700 happy to see this. This is a url that you can reach and give you 00:25:01.700 --> 00:25:09.541 the firmware. >> If only we had the car keys. >> Note this is 00:25:09.541 --> 00:25:15.714 not reachable from the internet only from inside the vpn. But 00:25:15.714 --> 00:25:21.887 just that time we had a set back. Marc mentioned the 00:25:21.887 --> 00:25:28.060 internet had also found open ethernet port and Tesla issued a 00:25:28.060 --> 00:25:35.334 patch to lock it down. >> The fix was pretty clever from what 00:25:35.334 --> 00:25:43.175 I can tell they start with you on the mtv launch and you have 00:25:43.175 --> 00:25:48.781 to go through an authentication process. However why go through 00:25:48.781 --> 00:25:55.487 all of that reverse engineering thing when you can man in the 00:25:55.487 --> 00:26:01.093 middle from one of the legitimate systems. >> So that's 00:26:01.093 --> 00:26:06.698 actually, we took the instrument cluster, it had the mail 00:26:06.698 --> 00:26:14.540 connecters and we didn't have one. >> So we made one. >> It is 00:26:14.540 --> 00:26:20.712 scotch tape. This is hard to find insulating tape that's that 00:26:20.712 --> 00:26:26.318 thin. We plugged something in made an ethernet cable and 00:26:26.318 --> 00:26:33.592 another in the vehicle and hooked it up to a switch. So now 00:26:33.592 --> 00:26:39.765 we have access restored to the system. >> And now it's 00:26:39.765 --> 00:26:45.370 constantly authenticating that and we can plug that switch and 00:26:45.370 --> 00:26:50.409 do whatever we want. >> The breakthrough, Marc mentioned 00:26:50.409 --> 00:26:57.683 that we have car keys. So one day we were looking at CID 00:26:57.683 --> 00:27:04.957 updaters and it mentioned a nice url. We have the vpn keys. We 00:27:04.957 --> 00:27:11.129 did our man-in-the-middle so we know the configuration is. So we 00:27:11.129 --> 00:27:18.403 can move forward right? Actually there's a lot of vpn you have to 00:27:18.403 --> 00:27:25.110 set. A lot of it is exposed hosts. Ssl encrypted channel so 00:27:25.110 --> 00:27:31.817 we can't look at the cyber traffic to figure out. >> This 00:27:31.817 --> 00:27:37.422 is when hackers really like developers put in the reverse 00:27:37.422 --> 00:27:44.696 switches. >> If you use open vpn client and turn on verbosity up 00:27:44.696 --> 00:27:51.403 to 11, it will tell you the server side desired all the 00:27:51.403 --> 00:27:56.441 things you need to establish valid vpn connection. Typically 00:27:56.441 --> 00:28:03.148 you don't need to blindly figure out vpn setting, but that's the 00:28:03.148 --> 00:28:09.321 case with open vpn. So 600 megabytes later, we have the 00:28:09.321 --> 00:28:14.927 firmware. >> Firmware is not a completely file system. They 00:28:14.927 --> 00:28:21.099 update the firmware and they look at what bits are missing 00:28:21.099 --> 00:28:27.806 from the car from the last firmware update. So we end up 00:28:27.806 --> 00:28:33.412 with partial file system, which contains a lot of interesting 00:28:33.412 --> 00:28:39.585 bit. >> Squash system, decompress it. We see a lot of 00:28:39.585 --> 00:28:46.291 really fun things. This is quiz time. You have a firmware file 00:28:46.291 --> 00:28:53.565 system. What do you look for first? But wait. Hold on. We had 00:28:53.565 --> 00:28:58.604 some interesting observations we want to share first. In 00:28:58.604 --> 00:29:04.209 firmware. One there's a log rotate script. This is what 00:29:04.209 --> 00:29:12.050 nailed it home. This car is a server. It has the same sort of 00:29:12.050 --> 00:29:18.757 management as a data center. A car that has servers inside. We 00:29:18.757 --> 00:29:25.464 found another fun thing. 4567. Okay. I'll send it over to vpn 00:29:25.464 --> 00:29:32.738 and see what happens [ laughs ]. Well-played Tesla. >> Wtf. >> I 00:29:32.738 --> 00:29:38.910 think I stopped about 35 thousand of these before I said 00:29:38.910 --> 00:29:46.752 got it. >> It was so tempting to upload a shrubbery. >> You have 00:29:46.752 --> 00:29:53.458 a file system. What do you look for first? Private keys. Dash 00:29:53.458 --> 00:29:58.497 dash dash, dsa private key. Nothing, unfortunately, that we 00:29:58.497 --> 00:30:05.203 didn't already know about. We did find a shadow file that was 00:30:05.203 --> 00:30:12.477 for the IC. You don't know what that is it is encrypted password 00:30:12.477 --> 00:30:19.184 file that is used to store the hashes for the account passwords 00:30:19.184 --> 00:30:25.357 to authenticate that. >> This is where I literally cried. After 00:30:25.357 --> 00:30:32.064 spending months of hunting big game, hack a car, trying to find 00:30:32.064 --> 00:30:39.337 a way in and it cracks under seconds. >> So now the question 00:30:39.337 --> 00:30:46.044 is we have valid authentication to a car, ssh in, the real 00:30:46.044 --> 00:30:53.885 question is how do we get route? >> That's when I cried again. >> 00:30:53.885 --> 00:31:02.294 So how do we get to the CID? We did not have the CID shadow. 00:31:02.294 --> 00:31:09.568 What do we do? We went back to the firmware mines and started 00:31:09.568 --> 00:31:16.842 to look for more. >> We found the car uses security token and 00:31:16.842 --> 00:31:22.447 rotated every 24-hour. Not bad design. However, it also appears 00:31:22.447 --> 00:31:29.154 the security token is used in lots of places. That's not good 00:31:29.154 --> 00:31:35.327 idea. For example, Tesla 1 uses that security token as its 00:31:35.327 --> 00:31:42.601 password. And it stored in plain text on the file system. >> So 00:31:42.601 --> 00:31:49.875 we went on the IC, found this security token and say can we 00:31:49.875 --> 00:31:57.149 authenticate to the CID. Yes is the answer. Okay. So now we have 00:31:57.149 --> 00:32:04.990 route on the cluster and CID of a car. By the way we are 00:32:04.990 --> 00:32:10.595 assuming the attacker will do this. This should be the 00:32:10.595 --> 00:32:16.768 security model. They will gain access. The question is what can 00:32:16.768 --> 00:32:24.609 they do with that. So we poked some more. >> I was confused by 00:32:24.609 --> 00:32:31.316 the layout. The memory storage on the car is the petition you 00:32:31.316 --> 00:32:39.724 see are labeled. You can see on the slash. What it does is [ no 00:32:39.724 --> 00:32:46.998 audio ].... >> The CID the touch screen has dsa key into the 00:32:46.998 --> 00:32:53.171 instrument cluster. Now we have legitimate key to it. Our old 00:32:53.171 --> 00:32:59.878 friend the ethernet. >> A little bit of analysis and script and 00:32:59.878 --> 00:33:07.152 what we found is the very code that controls the gateway to the 00:33:07.152 --> 00:33:12.757 ethernet. A little bit reverse engineering. >> It's pretty good 00:33:12.757 --> 00:33:20.031 design. And you need the token so the token you need to replay 00:33:20.031 --> 00:33:27.305 and inject the open ethernet to get access you have to have that 00:33:27.305 --> 00:33:34.012 security token there's no way if you are open internet you can 00:33:34.012 --> 00:33:40.185 authenticate to that car. >> The fact that it authenticate every 00:33:40.185 --> 00:33:46.892 30 seconds is annoying. Penny dropped and we had to setup a 00:33:46.892 --> 00:33:53.064 script that constantly sent it. >> The nice thing because we 00:33:53.064 --> 00:33:59.771 have those vpn keys we found the script that retrieve the keys 00:33:59.771 --> 00:34:07.045 from the mother ship the actual name of the server. Now we have 00:34:07.045 --> 00:34:13.752 a script that can retrieve, and build the ethernet key and send 00:34:13.752 --> 00:34:20.458 every 30 seconds and now we always have access to the car's 00:34:20.458 --> 00:34:26.631 ethernet assuming we have the car key. You have to physically 00:34:26.631 --> 00:34:32.804 disassemble the car. Do terrible things to the dash panel and 00:34:32.804 --> 00:34:40.078 once we have the car key we can maintain access to the network. 00:34:40.078 --> 00:34:47.919 >> It is almost like a contest in a box with cheese. >> Where 00:34:47.919 --> 00:34:55.193 are we right now? We can access the cid the touch screen without 00:34:55.193 --> 00:35:00.799 IC. Security token from the mother ship and create ethernet 00:35:00.799 --> 00:35:06.404 token wherever we want, now what? We actually found that 00:35:06.404 --> 00:35:13.111 vehicle firmware system, I think I did some poking vas, we didn't 00:35:13.111 --> 00:35:18.149 verify the firmware updates, I think that's important for 00:35:18.149 --> 00:35:24.322 people to audit to make sure that those updates can't be 00:35:24.322 --> 00:35:31.029 tamper with. >> We didn't want to tamper with because we didn't 00:35:31.029 --> 00:35:38.303 want to risk something up to cause my break his car. And we 00:35:38.303 --> 00:35:45.010 want to save something for phase two. >> At Tesla center. >> 00:35:45.010 --> 00:35:51.716 Guess what? The key is there. This means with the right key 00:35:51.716 --> 00:35:58.990 setup and with an a little wifi pineapple you can make wifi talk 00:35:58.990 --> 00:36:06.831 to your Tesla as long as it's on. >> The question is is that 00:36:06.831 --> 00:36:13.004 wifi network better. >> Open question what do you think you 00:36:13.004 --> 00:36:20.845 can do if you can get someone connected to your wifi. >> So we 00:36:20.845 --> 00:36:28.119 have route on the system what can we do with that? This is 00:36:28.119 --> 00:36:33.158 actually a pretty hairy challenge. There are number of 00:36:33.158 --> 00:36:40.432 server used in the car. They were writing in qt. It's kind of 00:36:40.432 --> 00:36:46.604 annoying to reverse it's not all good straight c and cleanly 00:36:46.604 --> 00:36:52.777 follow it. It's kind of difficult. So we kind of said 00:36:52.777 --> 00:36:58.383 let's just not starting this as reverse engineering services and 00:36:58.383 --> 00:37:06.224 what's going on. Let's step back how do we figure out what we are 00:37:06.224 --> 00:37:12.397 after. We built a tool called test cat. Broadcast to udp 00:37:12.397 --> 00:37:18.570 destination port. There's 50 to 1 --> 000 per seconds, what are the 00:37:18.570 --> 00:37:23.608 unique payloads. It identified the payloads it doesn't seen 00:37:23.608 --> 00:37:30.882 before. It parses the first 2 bytes of the packet seems to be 00:37:30.882 --> 00:37:35.920 highly constant. Roughly calling it message i.d. and command 00:37:35.920 --> 00:37:43.761 i.d., roughly proximate. We law it to pull from a p cap file you 00:37:43.761 --> 00:37:50.468 can play it offline or live listen. >> And we released our 00:37:50.468 --> 00:37:57.175 tool as part of the talk. >> It's already rereleased. Now we 00:37:57.175 --> 00:38:03.882 have an anomaly system. Now we go trigger things that we have 00:38:03.882 --> 00:38:11.156 not done before and walk the door and park and brake and we 00:38:11.156 --> 00:38:17.862 found a unique udp packet per event. >> There are people in 00:38:17.862 --> 00:38:24.035 the region who think we are strange. The first thing they 00:38:24.035 --> 00:38:31.309 saw is taking a brand new car where I happening it apart and 00:38:31.309 --> 00:38:36.915 then dismantled car. >> They weren't too happy about that. 00:38:36.915 --> 00:38:43.087 Now the question is who is sending these packets. What CID 00:38:43.087 --> 00:38:50.361 was doing it? Qt car vehicle and I felt stupid because I probably 00:38:50.361 --> 00:38:56.534 should have said that. That's the nature of these things. How 00:38:56.534 --> 00:39:03.808 can we construct the packet? Now we can finally go to ida. We 00:39:03.808 --> 00:39:10.515 tracked down the binary working on, I think you can see that. 00:39:10.515 --> 00:39:16.120 Gateway message sender. You see a bunch of interesting thing. 00:39:16.120 --> 00:39:22.827 Gui factory mode. Off request. All sorts of fun things. By the 00:39:22.827 --> 00:39:30.668 way let me take a step back to say this is awesome. What I 00:39:30.668 --> 00:39:37.942 didn't say is can, can, can, can. >> This is the vehicle of 00:39:37.942 --> 00:39:44.649 store procedure. The car has a bunch of commands in the gateway 00:39:44.649 --> 00:39:51.356 that will let you send command to and relay through the can 00:39:51.356 --> 00:39:57.528 bust and anything not part of that, you can't send through. 00:39:57.528 --> 00:40:03.134 That doesn't mean the gateway can't be compromise. What it 00:40:03.134 --> 00:40:08.740 means that unlike with certain other vehicles when the system 00:40:08.740 --> 00:40:14.912 gets compromise you can't send thing that can't do bad things 00:40:14.912 --> 00:40:21.619 to the car. >> That's huge. The fact that there's isolation is 00:40:21.619 --> 00:40:27.792 extremely important. Now we can control a number of things. CID 00:40:27.792 --> 00:40:35.066 does touch screen we can now do. The question is we can't inject 00:40:35.066 --> 00:40:42.340 can frames at least so far onto the vehicle network. We can use 00:40:42.340 --> 00:40:50.181 api. The question is can we use that. What do you want to try? 00:40:50.181 --> 00:40:56.354 Ssh channel between cid and server. >> If you want remote 00:40:56.354 --> 00:41:04.762 cyber attack to a car, what do you want to do? We tell the car 00:41:04.762 --> 00:41:10.935 to shut off, switch off the screen, shut the computer down. 00:41:10.935 --> 00:41:18.209 And we tried that. >> We did this in a closed environment and 00:41:18.209 --> 00:41:27.719 at low speed. >> We did not do this on a 70 miles an hour on a 00:41:27.719 --> 00:41:34.425 freeway. [ music playing ] [ applause ] >> So it's important 00:41:34.425 --> 00:41:41.132 to point that this is not a remote access exploit. Kevin was 00:41:41.132 --> 00:41:48.406 happy to sit in the car when I stopped it. It's important to 00:41:48.406 --> 00:41:55.680 point out what you saw there was the car traveling at slow speed. 00:41:55.680 --> 00:42:02.954 We found that if the car was going 45 miles an hour the 00:42:02.954 --> 00:42:10.228 screen will go black and music turns off and car stops. If you 00:42:10.228 --> 00:42:16.401 are going faster than that a brief warning coming on the 00:42:16.401 --> 00:42:22.573 screen telling you you can't apply the hand brake at speed. 00:42:22.573 --> 00:42:29.280 The screen will go black but you maintain control of the steering 00:42:29.280 --> 00:42:34.886 and the brake. The entertainment system killed, you still get 00:42:34.886 --> 00:42:41.058 fully control of the car and stop the car. That is 00:42:41.058 --> 00:42:48.332 phenomenal. >> Huge [ applause ] >> All right. We found a number 00:42:48.332 --> 00:42:55.039 of things Tesla did well. They are pushing an ota update at 00:42:55.039 --> 00:43:00.645 ludicrous speed. In a week, which is extremely awesome. The 00:43:00.645 --> 00:43:05.683 update yesterday two of the vulnerability. Weak password no 00:43:05.683 --> 00:43:12.390 more and a bunch of others and also hardens the system. You 00:43:12.390 --> 00:43:19.096 should be able to attack a car, pop the browser and that 00:43:19.096 --> 00:43:24.702 shouldn't matter. >> Also Tesla has announced that they are 00:43:24.702 --> 00:43:32.543 hiring we all know to be their head of security [ applause ] >> 00:43:32.543 --> 00:43:38.149 Huge. >> He's sitting right there. >> But seriously they've 00:43:38.149 --> 00:43:45.423 been good to work with. We were worried at first. We didn't know 00:43:45.423 --> 00:43:52.697 how a car company respond to us finding bad things [ no audio 00:43:52.697 --> 00:43:59.971 ]... [ applause ] >> Thank you very much. Well when we first 00:43:59.971 --> 00:44:06.677 engineer the model S we know the software system would be the 00:44:06.677 --> 00:44:14.519 work in process. We knew we were going to ship and car and not 00:44:14.519 --> 00:44:20.124 improve the software. Using the over the air update system 00:44:20.124 --> 00:44:25.162 that's how we've been able to work collaboratively the 00:44:25.162 --> 00:44:30.201 research community to find new vulnerabilities and then patch 00:44:30.201 --> 00:44:38.042 them and fix them. I really want to thank you guys for the work 00:44:38.042 --> 00:44:45.316 you've done. It's making the car safer. We want to award you with 00:44:45.316 --> 00:44:50.922 Tesla challenge points, all three of you, for the awesome 00:44:50.922 --> 00:44:57.094 work you've done. >> I also want to invite another collaborator 00:44:57.094 --> 00:45:04.936 onstage as well [ applause ] >> It was John's car that we so 00:45:04.936 --> 00:45:11.642 cruelly abused. >> These are very cool. Thank you so much. >> 00:45:11.642 --> 00:45:18.916 One more thing. >> Program all the way up to $10 --> 000 is a 00:45:18.916 --> 00:45:25.089 nominal amount and we may go higher than that in certain 00:45:25.089 --> 00:45:31.262 cases. So we want people to participate that and send us 00:45:31.262 --> 00:45:39.103 what you find. So thank you. [ applause ] >> So what better way 00:45:39.103 --> 00:45:45.276 to thank them for engaging the community so much. First time 00:45:45.276 --> 00:45:51.983 speakers at Defcon. Not these two who did most of the talking. 00:45:51.983 --> 00:45:59.824 We will give them a shot. Good idea? [ applause ] >> Thank you. 00:45:59.824 --> 00:46:06.530 Cheers [ applause ] >> These guys have 2 minutes of wrap-up 00:46:06.530 --> 00:46:13.804 time. Get back in here. Sit down. >> Can we get the slides 00:46:13.804 --> 00:46:20.511 back? >> All right. Summary of what we found. In my opinion 00:46:20.511 --> 00:46:26.684 this is really great when you are auditing big system like 00:46:26.684 --> 00:46:33.391 this to draw this out. Here's what you can fine and notice 00:46:33.391 --> 00:46:39.563 there's one path to gateway. What did Tesla really do right 00:46:39.563 --> 00:46:44.602 here? Awesome otm process. Ludicrous speed. Vpns were good, 00:46:44.602 --> 00:46:50.207 rotate passwords every 24 hours and strong isolation between the 00:46:50.207 --> 00:46:55.813 drive and vehicle systems. Of course, they need to improve 00:46:55.813 --> 00:47:01.419 some things. The wifi should using wvp enterprise and not 00:47:01.419 --> 00:47:06.457 have a static key. There's a general parameter security 00:47:06.457 --> 00:47:12.063 model. We definitely recommend that switch away from egg shell 00:47:12.063 --> 00:47:16.534 principle more to every individual system harden. >> 00:47:16.534 --> 00:47:21.572 Don't store sensitive credentials on the plain text in 00:47:21.572 --> 00:47:26.610 file system. >> There's of communications that are not 00:47:26.610 --> 00:47:31.082 mutually encrypted and authenticated on the system. If 00:47:31.082 --> 00:47:37.254 you assume adversary in your browser, you want to make sure 00:47:37.254 --> 00:47:42.860 it's encrypted. The question everyone is asking. >> We came 00:47:42.860 --> 00:47:48.466 up with three recommendations. The first one is anything man 00:47:48.466 --> 00:47:56.307 makes man can break. You need to have a quick way to patch and 00:47:56.307 --> 00:48:03.013 update them. You can't rely on people taking the car in. User 00:48:03.013 --> 00:48:09.720 can't pay for. If you are rely someone to pay for data 00:48:09.720 --> 00:48:16.427 subscription to do update, only about 20% will sign up for it. 00:48:16.427 --> 00:48:20.898 Next one, strong isolation infotainment system and drive 00:48:20.898 --> 00:48:24.802 critical system. That's really, really important. Airplane 00:48:24.802 --> 00:48:29.840 manufacturers have known this. Car manufacturers need to start 00:48:29.840 --> 00:48:36.547 doing the same thing. None of the jeep stuff would have been 00:48:36.547 --> 00:48:42.720 possible if they had done that. Finally, this is embedded system 00:48:42.720 --> 00:48:49.426 you don't control who and when have access to it. That means 00:48:49.426 --> 00:48:55.032 every individual component has to have its own robust security 00:48:55.032 --> 00:49:00.070 model. If one component is compromised, that doesn't leave 00:49:00.070 --> 00:49:06.243 to complete compromise of the vehicle. >> This is a group 00:49:06.243 --> 00:49:13.517 project. I want to thank all of them for helping us out. [ 00:49:13.517 --> 00:49:21.358 applause ] >> I want to call out this lady which is married to 00:49:21.358 --> 00:49:26.964 this gentleman here, who is extremely patient with us being 00:49:26.964 --> 00:49:33.671 there very late disassembling the car. >> Being a wife of a 00:49:33.671 --> 00:49:40.377 hacker is not an easy job. >> Lots of folks at cloudfare, 00:49:40.377 --> 00:00:00.000 thanks so much. Appreciate it. [ applause ]