1 00:00:00,000 --> 00:00:01,720 Cool, I think I'll get started. 2 00:00:01,980 --> 00:00:03,660 My name is Lennart Wouters. 3 00:00:03,660 --> 00:00:07,180 I'm here to present you an attack we did on a Tesla Model S. 4 00:00:07,640 --> 00:00:16,200 And the goal of our research was to figure out how the passive keyless entry system in the Tesla Model S works and to see if there's any vulnerabilities we could exploit. 5 00:00:16,800 --> 00:00:25,360 So in the way a passive keyless entry and start system works is you approach the vehicle with the key fob in your pocket and it automagically unlocks and starts. 6 00:00:25,920 --> 00:00:29,800 So what's actually going on in the back is the car sends a challenge to the key fob. 7 00:00:29,980 --> 00:00:34,100 The key fob computes a cryptographic response and sends it back to the car. 8 00:00:34,600 --> 00:00:38,560 If the cryptographic response is correct, the car will unlock and start. 9 00:00:39,760 --> 00:00:44,040 Now if we take one of these key fobs and we open it up, this is what it looks like. 10 00:00:44,280 --> 00:00:46,820 So this is the PCB from the back side. 11 00:00:47,300 --> 00:00:48,620 There's not much going on here. 12 00:00:48,620 --> 00:00:53,460 You can see a UHF antenna, a low-frequency antenna, and an RF transmitter chip. 13 00:00:54,040 --> 00:00:56,360 The front side is a bit more interesting. 14 00:00:56,360 --> 00:00:58,880 So you can see that there's one interesting chip here. 15 00:00:59,420 --> 00:01:04,360 This is the Texas Instruments TMS37F128. 16 00:01:04,660 --> 00:01:11,920 Now if you take an X-ray of this chip, you can see that there's actually two dies or two distinct chips inside of this one package. 17 00:01:12,500 --> 00:01:15,400 So there's an MSP430 microcontroller. 18 00:01:15,400 --> 00:01:20,480 This is a general-purpose microcontroller which can communicate with the transponder. 19 00:01:20,480 --> 00:01:23,640 So this is a TMS37F126. 20 00:01:24,080 --> 00:01:31,720 And this transponder is actually the part that stores all of the cryptographic material and it performs all of the cryptographic operations. 21 00:01:32,400 --> 00:01:36,740 The microcontroller can talk to the transponder using an SPI interface. 22 00:01:38,440 --> 00:01:42,820 Now usually you would look up the datasheet for one of these chips to figure out what is going on. 23 00:01:42,920 --> 00:01:48,780 In this case, to get a full datasheet, you have to sign NDAs, which is of course something we don't like to do. 24 00:01:49,580 --> 00:01:52,500 Now the things you can find online are like some basics. 25 00:01:52,500 --> 00:02:00,100 So this chip supports an 80-bit DST80 security authentication coprocessor, whatever that may be. 26 00:02:00,100 --> 00:02:05,000 And then it uses a 5-byte challenge and 3-byte response algorithm. 27 00:02:05,000 --> 00:02:07,660 And it also supports mutual authentication. 28 00:02:08,400 --> 00:02:11,780 So let's get started and let's buy some of these ICs. 29 00:02:11,860 --> 00:02:15,960 So I went to DigiKey or Farnell, but couldn't find any of them. 30 00:02:15,960 --> 00:02:19,180 So again, you have to sign NDAs even to buy these chips. 31 00:02:19,840 --> 00:02:23,060 Luckily at my research group, there's a lot of international colleagues. 32 00:02:23,060 --> 00:02:24,800 I also have some Chinese colleagues. 33 00:02:24,820 --> 00:02:27,020 And that makes it easier to get this stuff. 34 00:02:27,660 --> 00:02:30,640 So we went to Taobao, ordered some of these chips. 35 00:02:30,640 --> 00:02:34,900 And once we got them, we noticed that they use a very uncommon package type. 36 00:02:34,980 --> 00:02:37,880 So we designed our own breakout board to get started. 37 00:02:38,240 --> 00:02:42,460 Now the chip we acquired is the TMS37126. 38 00:02:42,460 --> 00:02:46,060 So it's only the transponder without the included microcontroller. 39 00:02:47,660 --> 00:02:51,020 So as I mentioned, you need to sign NDAs to get the datasheets. 40 00:02:51,220 --> 00:02:53,020 There is some public information. 41 00:02:53,140 --> 00:02:56,440 But the public information that is out there is very inconsistent. 42 00:02:56,900 --> 00:03:00,400 So for this one chip, you can easily find two distinct pinouts. 43 00:03:00,460 --> 00:03:03,140 Which makes it quite annoying when you want to connect to them. 44 00:03:04,000 --> 00:03:06,980 My initial goal was to connect an Arduino to this chip. 45 00:03:06,980 --> 00:03:11,140 So I could talk SPI with it and try to figure out what was going on. 46 00:03:11,780 --> 00:03:16,720 So in this case, the Arduino is the SPI master and the transponder is the SPI slave. 47 00:03:17,260 --> 00:03:21,100 When you connect all of this up on a breadboard, it looks somewhat like this. 48 00:03:23,360 --> 00:03:26,500 So SPI usually has three data lines. 49 00:03:27,060 --> 00:03:33,120 We have a clock line, a data line for data going from the slave to the master, and the other way around. 50 00:03:33,380 --> 00:03:38,720 In this case, Texas Instruments decided to add a fourth line, which is called the busy line. 51 00:03:38,720 --> 00:03:47,540 As you can imagine, this line is used by the slave, so in this case the transponder, to indicate to the master when it is ready to receive the next byte of data. 52 00:03:48,020 --> 00:03:54,460 You can also see in this diagram that an SPI packet in this case usually starts with a length byte. 53 00:03:54,740 --> 00:03:58,100 And this byte indicates how many bytes will follow in this packet. 54 00:03:58,520 --> 00:04:00,880 The second byte is the command you want to execute. 55 00:04:01,020 --> 00:04:03,160 And then there might be one or more data bytes. 56 00:04:03,720 --> 00:04:07,400 You can also get a reply back from the transponder, including some data. 57 00:04:08,340 --> 00:04:13,740 Now, as we didn't have the data sheets, we had to figure out ourselves what available SPI commands there are. 58 00:04:14,100 --> 00:04:22,000 And it turns out that this extra SPI busy line is very convenient for this, because it will throw an error when there is something wrong. 59 00:04:22,140 --> 00:04:28,820 So if you provide it with a command that does not exist, it will throw an error by holding this line low or high for an extended period of time. 60 00:04:30,040 --> 00:04:31,540 Then we made two observations. 61 00:04:32,140 --> 00:04:34,840 When the command value is incorrect, it throws an error. 62 00:04:35,220 --> 00:04:41,640 But if you set the length byte to FF, it will throw an error after the correct number of bytes was received. 63 00:04:41,840 --> 00:04:49,800 So you can simply fix the length byte to FF, and then enumerate all of the command bytes to figure out what all of the correct lengths and commands are. 64 00:04:50,860 --> 00:04:54,360 So in that way, we uncovered some commands that we thought were interesting. 65 00:04:54,900 --> 00:04:58,880 So as you can see, we found two commands that perform the DST40 cipher. 66 00:04:59,160 --> 00:05:01,800 I will give some more information on that cipher later on. 67 00:05:01,800 --> 00:05:05,620 And two commands that perform another unknown cipher. 68 00:05:06,240 --> 00:05:09,480 Now, this unknown cipher also works on 40-bit keys. 69 00:05:09,660 --> 00:05:12,300 And we were expecting to find an 80-bit cipher. 70 00:05:12,580 --> 00:05:18,940 So I made the assumption that maybe the 80-bit cipher is a combination of two of these 40-bit ciphers. 71 00:05:19,140 --> 00:05:26,640 Usually, combining two 40-bit ciphers into an 80-bit cipher results in interesting problems. 72 00:05:26,760 --> 00:05:30,280 So I set out to reverse engineer the unknown cipher. 73 00:05:30,280 --> 00:05:37,780 And we did this by providing an input and observing the output, and then making assumptions based on DST40, which we knew how it worked. 74 00:05:38,200 --> 00:05:45,020 So this means that I spent about a month trying to blackbox reverse engineer a cipher, which in the end wasn't used. 75 00:05:45,840 --> 00:05:49,500 We also found two commands that allow you to set a 40-bit key. 76 00:05:49,500 --> 00:05:51,820 So no 80-bit keys, only 40-bit keys. 77 00:05:53,640 --> 00:05:57,680 At this point, I finally got my hands on an actual Tesla Model S key fob. 78 00:05:57,680 --> 00:06:02,380 And as you can see, there are some easily available debug paths. 79 00:06:02,560 --> 00:06:06,940 And I was able to connect a JTAG programmer and figured out that the JTAG fuse wasn't blown. 80 00:06:07,220 --> 00:06:14,800 So this means we can dump the program memory on the microcontroller, throw it into a disassembler, and start looking at the assembly code. 81 00:06:15,420 --> 00:06:20,660 So for the MSP430, the two things to do are first look at the interrupt vector table. 82 00:06:20,840 --> 00:06:22,620 This is stored at the end of Flash. 83 00:06:22,700 --> 00:06:27,240 And it basically teaches you what code will be run after an interrupt occurs. 84 00:06:27,240 --> 00:06:33,040 So in the case of a key fob, for example, which code is run when you press a button on it. 85 00:06:33,620 --> 00:06:36,240 And this helps you narrow down where to look in the assembly. 86 00:06:37,200 --> 00:06:41,500 Secondly, references to special function registers are interesting. 87 00:06:41,620 --> 00:06:47,160 And especially in this case, because we're trying to figure out which SPI commands the Tesla Model S key fob is using. 88 00:06:47,880 --> 00:06:53,080 So I searched for the function which is doing the SPI communication, basically. 89 00:06:54,160 --> 00:06:56,420 And then we went on to dynamic analysis. 90 00:06:56,600 --> 00:07:04,500 So setting breakpoints in the microcontroller at the address where the SPI function starts, basically. 91 00:07:04,640 --> 00:07:06,460 Then you would try to unlock the car. 92 00:07:06,460 --> 00:07:11,840 When the breakpoint is triggered, you dump the memory to see which data was sent and received over SPI. 93 00:07:12,440 --> 00:07:24,120 And by doing this a few times, well, just in the normal way as you would unlock the car normally, we figured out that the only command they were using was 86, which we earlier figured out was DST 40. 94 00:07:25,360 --> 00:07:27,240 Now, what is DST 40? 95 00:07:27,580 --> 00:07:32,120 DST 40 is a cipher introduced back in 2000 by Texas Instruments. 96 00:07:32,220 --> 00:07:37,460 It uses a 40-bit key, which I guess everyone knows is too short by today's standards. 97 00:07:37,820 --> 00:07:41,220 The cipher itself was first reverse engineered back in 2005. 98 00:07:41,220 --> 00:07:46,700 And back then it was used mainly in immobilizers and the ExxonMobil speedpass payment system. 99 00:07:48,140 --> 00:07:51,320 This is a schematic overview of how the cipher works. 100 00:07:51,800 --> 00:07:54,340 So at the bottom you have a 40-bit key register. 101 00:07:54,340 --> 00:07:57,120 At the top you have a 40-bit challenge register. 102 00:07:57,340 --> 00:07:59,620 And then there are some lookup tables in the middle. 103 00:07:59,620 --> 00:08:02,280 These lookup tables produce two bits of output. 104 00:08:02,840 --> 00:08:06,020 This round is executed 200 times. 105 00:08:06,360 --> 00:08:10,320 And the two output bits are shifted into the challenge register every round. 106 00:08:10,800 --> 00:08:17,880 After running the cipher for 200 rounds, the 24 least significant bits of the challenge register are returned as the response. 107 00:08:18,880 --> 00:08:26,960 The important thing to remember here is that we have a 40-bit key, a 40-bit challenge, and the response is actually shorter than the challenge. 108 00:08:27,040 --> 00:08:30,740 And this is important for somewhere next in the presentation. 109 00:08:31,600 --> 00:08:35,120 We know that the key fob is using an old, outdated cipher. 110 00:08:35,280 --> 00:08:39,520 But we still have to figure out how to talk to the vehicle and how to receive messages from the key fob. 111 00:08:41,020 --> 00:08:45,520 If you look at one of these key fobs, you can observe two distinct systems. 112 00:08:45,860 --> 00:08:48,200 There is a remote keyless entry system. 113 00:08:48,280 --> 00:08:52,140 This is a system where you press a button on the key fob and then the car unlocks. 114 00:08:52,620 --> 00:08:55,800 This is one-way communication going from the key fob to the vehicle. 115 00:08:56,600 --> 00:08:58,920 Secondly, there is passive keyless entry and start. 116 00:08:58,920 --> 00:09:03,440 This is two-way communication where you approach the vehicle and it automatically unlocks. 117 00:09:03,920 --> 00:09:08,380 We will start by looking at the one-way communication, so the remote keyless entry. 118 00:09:08,380 --> 00:09:14,420 Because these packets are easier to receive and it is easier to understand how everything works. 119 00:09:14,980 --> 00:09:20,020 In order to receive messages from such a key fob, you need to have a few physical layer parameters. 120 00:09:20,040 --> 00:09:23,860 Like the operating frequency, the modulation and the symbol rate. 121 00:09:24,240 --> 00:09:26,440 These are relatively easy to determine. 122 00:09:28,240 --> 00:09:31,940 Then what you do is, once you can receive one message, you just receive a few. 123 00:09:31,940 --> 00:09:36,780 So you press the button a few times and you look at which parts of the message change. 124 00:09:36,780 --> 00:09:40,600 And in that way you can understand what is going on. 125 00:09:41,020 --> 00:09:43,220 So in this case there is one byte for the command. 126 00:09:43,220 --> 00:09:46,560 And the command is basically do you want to lock or unlock the vehicle. 127 00:09:47,060 --> 00:09:50,460 Then there is a three-byte response, which is the DST40 response. 128 00:09:50,580 --> 00:09:52,220 And there is a two-byte counter. 129 00:09:52,980 --> 00:09:56,080 So the way it works is the key fob stores a 40-bit counter. 130 00:09:56,520 --> 00:09:59,440 Every time you press the button, the counter gets incremented. 131 00:09:59,800 --> 00:10:02,600 And this counter is fed as a challenge to DST40. 132 00:10:02,680 --> 00:10:04,240 And then the response is computed. 133 00:10:04,240 --> 00:10:10,780 The reason they send a long part of the counter is to prevent desynchronization between key fob and car. 134 00:10:10,880 --> 00:10:16,300 So if your kit presses the button too many times, you still want to be able to unlock your vehicle. 135 00:10:18,100 --> 00:10:21,560 So I actually made a challenge for the Capture the Flag in the Car Hacking Village. 136 00:10:21,980 --> 00:10:25,540 Which is based on a real Tesla Model S key fob. 137 00:10:25,540 --> 00:10:31,400 So what I did is, I took one of the key fobs, I removed one of the buttons and I connected an Arduino to it. 138 00:10:31,400 --> 00:10:35,080 And the Arduino will simulate the button press every 15 seconds. 139 00:10:35,800 --> 00:10:39,900 Now, to have a challenge, it's nice if you can have a flag which is fixed. 140 00:10:40,620 --> 00:10:46,820 So what I did is, I reset the key fob right after it transmits, so that the counter is not updated. 141 00:10:47,200 --> 00:10:51,820 So in this way, the packet is fixed and you can have a fixed flag. 142 00:10:52,460 --> 00:10:57,100 If you're having troubles with the challenge and you want some tips, you can come and find me after the talk. 143 00:10:57,100 --> 00:11:00,420 Or you can look at the talk Rapid Radio Reversing by Michael Osman. 144 00:11:02,560 --> 00:11:06,240 Now there should be a short video of a small proof of concept. 145 00:11:06,620 --> 00:11:08,600 And we can show that we can unlock the doors. 146 00:11:08,920 --> 00:11:10,860 We can open the trunk. 147 00:11:12,140 --> 00:11:14,180 And we can also open the trunk. 148 00:11:19,650 --> 00:11:21,310 But the video is not working. 149 00:11:24,520 --> 00:11:28,240 Opening a vehicle is cool, but it's even cooler if you can drive off with it. 150 00:11:28,640 --> 00:11:31,780 And to do that, you have to understand the passive keyless entry part. 151 00:11:31,780 --> 00:11:34,380 As I said before, there's two-way communication. 152 00:11:34,380 --> 00:11:37,480 So low frequency going from the vehicle to the key fob. 153 00:11:37,480 --> 00:11:40,860 And high frequency for data going from the key fob to the car. 154 00:11:41,380 --> 00:11:46,240 And the high frequency part is almost the same as the remote keyless entry scenario. 155 00:11:46,940 --> 00:11:50,960 For the low frequency part, I used the Proxmark tree. 156 00:11:51,260 --> 00:11:54,080 Because it supports the operating frequency. 157 00:11:54,440 --> 00:11:58,200 But it turns out that the modulation is not supported in the Proxmark. 158 00:11:58,540 --> 00:12:00,880 So I had to modify the hardware of the Proxmark. 159 00:12:00,880 --> 00:12:03,400 I had to write my own Verilog code for the FPGA. 160 00:12:03,420 --> 00:12:05,900 And I had to write my own microcontroller code. 161 00:12:06,500 --> 00:12:08,860 So the signals look kind of like this. 162 00:12:09,920 --> 00:12:13,680 So on top you have the signal received by the antenna of the Proxmark. 163 00:12:13,740 --> 00:12:16,440 Then it's routed to an amplification stage. 164 00:12:16,660 --> 00:12:18,640 Then there's an analog peak detect circuit. 165 00:12:18,640 --> 00:12:24,560 And then after the analog peak detect circuit, the FPGA will output a digital signal. 166 00:12:24,560 --> 00:12:27,280 Which can then be interpreted by the microcontroller. 167 00:12:28,420 --> 00:12:32,600 Now receiving these LF signals was kind of a hassle. 168 00:12:32,900 --> 00:12:35,540 So I had to spend a few of my weekends like this. 169 00:12:35,780 --> 00:12:37,640 In the car and around the car. 170 00:12:37,900 --> 00:12:41,660 So basically what I did was I taped the receiving antenna of the Proxmark. 171 00:12:41,660 --> 00:12:44,320 Very close to the transmitting antennas of the car. 172 00:12:44,320 --> 00:12:45,620 And that made it easier. 173 00:12:46,220 --> 00:12:49,680 So in a Tesla Model S there's antennas at the rearview mirrors. 174 00:12:49,760 --> 00:12:51,460 There's one in the center cup holder. 175 00:12:51,660 --> 00:12:52,900 There's one at the trunk. 176 00:12:52,900 --> 00:12:55,660 And there's one in the middle of the windshield. 177 00:12:56,880 --> 00:13:00,360 So at this point we can receive ultra high frequency signals. 178 00:13:00,360 --> 00:13:02,200 We can receive low frequency signals. 179 00:13:02,200 --> 00:13:04,540 So we can build a protocol analyzer. 180 00:13:04,980 --> 00:13:09,820 So I have a simple Python script that controls both the yardstick 1 and the Proxmark. 181 00:13:10,060 --> 00:13:14,460 And it basically gives me a trace of all of the communication between the key fob and the car. 182 00:13:15,060 --> 00:13:16,820 So again what you do is you do the same. 183 00:13:16,820 --> 00:13:19,760 You unlock the car a few times while you have your script running. 184 00:13:19,760 --> 00:13:21,120 And you look at the output. 185 00:13:21,120 --> 00:13:26,620 And then by seeing which parts change you can kind of guess what the protocol looks like. 186 00:13:27,060 --> 00:13:30,980 So I figured out that the car sends a message twice a second. 187 00:13:30,980 --> 00:13:34,080 And it's just pulling to see if a key fob is closed. 188 00:13:34,860 --> 00:13:39,800 And this wait message contains a car identifier which the key fob is looking for. 189 00:13:39,920 --> 00:13:42,280 Now if the key fob is closed it will reply. 190 00:13:42,560 --> 00:13:47,840 And this reply is basically the same message as the wait command but it's an obfuscated version. 191 00:13:48,080 --> 00:13:50,660 I'm not sure why the obfuscation is there. 192 00:13:50,660 --> 00:13:54,940 Because if you receive messages from two vehicles you can easily figure it out. 193 00:13:54,940 --> 00:13:58,560 It's basically a combination of some byte swaps and bit shifts. 194 00:13:59,440 --> 00:14:03,340 So when the key fob replies the car will send a random challenge. 195 00:14:04,040 --> 00:14:06,100 The key fob computes the response. 196 00:14:06,400 --> 00:14:09,040 And if the response was correct the car unlocks. 197 00:14:09,660 --> 00:14:16,100 Now as you can see here you need to send the car identifier along with your challenge to the key fob. 198 00:14:16,100 --> 00:14:18,060 Because otherwise it won't reply. 199 00:14:20,180 --> 00:14:25,480 Now one scenario we were thinking about is could we steal a car without ever seeing the key fob? 200 00:14:25,480 --> 00:14:28,420 Like could we just stand next to it and lock it and drive off? 201 00:14:28,980 --> 00:14:33,160 And it turns out it is possible but it would take you about 97 days. 202 00:14:33,440 --> 00:14:35,560 So it's not really a practical attack. 203 00:14:37,700 --> 00:14:40,540 So we wanted to also have a practical attack of course. 204 00:14:42,940 --> 00:14:48,860 And to get a practical attack the thing you need to do is to recover the 40-bit key as fast as possible. 205 00:14:49,460 --> 00:14:57,020 So to recapitulate, DST40 uses a 40-bit challenge, a 40-bit key, but the output is only 24 bits. 206 00:14:57,380 --> 00:14:59,780 So it's kind of like a compression function. 207 00:15:00,280 --> 00:15:05,160 And this means that you need at least two challenge-response pairs in order to recover the 40-bit key. 208 00:15:05,980 --> 00:15:09,860 What we did was to make a time-memory trade-off table. 209 00:15:10,460 --> 00:15:14,300 And the general idea is that we fixed one challenge. 210 00:15:14,300 --> 00:15:15,720 So we chose one. 211 00:15:15,880 --> 00:15:20,640 And then for every possible key we recorded which response it produced. 212 00:15:21,140 --> 00:15:27,000 So because the response is shorter than a challenge there will be multiple keys that produce the same response. 213 00:15:27,320 --> 00:15:31,060 And we grouped all of the keys that produce the same response into one file. 214 00:15:31,340 --> 00:15:34,380 So we have a 5.4 terabyte lookup table. 215 00:15:34,440 --> 00:15:37,160 Which has 2 to the 24 files. 216 00:15:37,160 --> 00:15:39,420 So one file for each response. 217 00:15:39,420 --> 00:15:43,200 And each of these files contains about 2 to the 16 keys. 218 00:15:44,580 --> 00:15:49,240 So once you have this table, recovering the key from a keyfob is quite easy. 219 00:15:49,960 --> 00:15:56,180 You first have to get the 2-byte car identifier, which you can do by brute force or sniffing it from the vehicle. 220 00:15:56,720 --> 00:15:59,880 Then you send the challenge that you used to make your table. 221 00:16:00,460 --> 00:16:06,080 You record the response and use the value of this response to take the file from your lookup table. 222 00:16:06,080 --> 00:16:09,280 And at that point the keyspace is only 2 to the 16. 223 00:16:10,520 --> 00:16:15,140 So then you send a second random challenge to the keyfob, record the response. 224 00:16:15,400 --> 00:16:18,520 And you test the remaining 2 to the 16 keys. 225 00:16:18,880 --> 00:16:22,420 Testing these 2 to the 16 keys takes 2 seconds on a Raspberry Pi. 226 00:16:23,760 --> 00:16:25,580 So we built this device. 227 00:16:27,580 --> 00:16:31,400 I have it here with me if anyone wants to take a look at it later, just come and find me. 228 00:16:32,220 --> 00:16:33,080 No. 229 00:16:35,580 --> 00:16:38,520 So it basically contains the Proxmark 3 and the UpStick 1. 230 00:16:38,560 --> 00:16:41,720 Then the Raspberry Pi, which is basically the brains of the operation. 231 00:16:41,840 --> 00:16:43,640 And a USB power bank. 232 00:16:44,000 --> 00:16:47,780 So the way I use this is I make a hotspot on my phone. 233 00:16:48,040 --> 00:16:50,200 The Raspberry Pi automatically connects to it. 234 00:16:50,400 --> 00:16:54,480 I SSH into the Raspberry Pi and I can control everything I want. 235 00:16:54,820 --> 00:16:58,960 And using this connection, the Raspberry Pi can also fetch files from a lookup table. 236 00:17:00,100 --> 00:17:05,940 Now after we built this Proof of Concept attack, we of course also notified Tesla. 237 00:17:07,080 --> 00:17:12,420 And then after notifying them, we realized that Tesla didn't build the system themselves, so they bought it. 238 00:17:12,540 --> 00:17:16,260 And they bought it from a company called Pektron, which is based in the UK. 239 00:17:17,040 --> 00:17:21,020 And then looking at FCC documentation, we figured out that they built similar systems... 240 00:17:21,720 --> 00:17:26,460 using the same Texas Instruments chip for McLaren, Karma, and Triumph. 241 00:17:26,460 --> 00:17:28,460 I don't have a McLaren. 242 00:17:29,200 --> 00:17:32,340 This is Vegas, so if anyone has one, let me know. 243 00:17:34,780 --> 00:17:41,280 So we contacted Tesla, and then they worked on fixing the key fob, so they made a new version of this key fob. 244 00:17:41,440 --> 00:17:46,420 And all vehicles produced from June 2018 onwards are using this newer version of the key fob. 245 00:17:47,040 --> 00:17:50,740 Existing customers can also request a new version of the key fob. 246 00:17:51,500 --> 00:17:56,600 They also did some over-the-air software updates that make the attack harder to execute. 247 00:17:56,760 --> 00:18:02,180 So they have a pin-to-drive feature, which is basically a second factor of authentication. 248 00:18:02,180 --> 00:18:04,940 So you have to enter a pin each time you try and start the vehicle. 249 00:18:05,400 --> 00:18:08,540 And a second option is to disable passive keyless entry. 250 00:18:09,920 --> 00:18:14,740 None of these features are enabled by default, so if you have one of these vehicles, you should enable them. 251 00:18:15,420 --> 00:18:22,920 I do want to point out that these features make it more difficult for me to steal your car, but they don't prevent me from doing it. 252 00:18:24,260 --> 00:18:28,920 So if you disable passive keyless entry, this is actually a nice feature, and I think you should enable it. 253 00:18:28,920 --> 00:18:31,420 Because it will stop the more common relay attack. 254 00:18:32,520 --> 00:18:36,760 But in order to start the vehicle, they still have to use passive keyless entry. 255 00:18:36,760 --> 00:18:37,820 There's no other way. 256 00:18:38,600 --> 00:18:46,360 Also, you might disable passive keyless entry on the car side, but the key fob will still reply to messages sent to it. 257 00:18:47,320 --> 00:18:55,060 The pin-to-drive feature is also nice, but again, once I'm inside your vehicle, there's other ways to start it and drive off. 258 00:18:56,880 --> 00:19:05,940 So another mitigation I came up with, and I did on one of the key fobs we have, is I basically added another button that allows me to disable passive entry on the key fob side. 259 00:19:05,940 --> 00:19:08,200 So this makes it impossible to clone the key fob. 260 00:19:09,860 --> 00:19:14,980 Now, Tesla was pretty cool about working with us to fix the issues. 261 00:19:15,220 --> 00:19:20,400 And at some point, they even drove over a Tesla to our university, and we had to show that the attack actually worked. 262 00:19:21,160 --> 00:19:26,120 We also tried contacting some of the other probably affected companies. 263 00:19:27,040 --> 00:19:30,700 Karma and Triumph didn't really engage with us, they didn't really reply. 264 00:19:30,700 --> 00:19:39,040 McLaren did eventually reply, but when we said that we wouldn't remove their name from our paper, they weren't very interested in talking to us anymore. 265 00:19:40,180 --> 00:19:44,480 They did release a public statement online, which is quite funny. 266 00:19:45,320 --> 00:19:53,620 So the statement was on that URL, they removed it from their website, but I indexed it on the Wayback Machine so you can still find it. 267 00:19:54,340 --> 00:19:56,960 I'll point out some interesting facts from the statement. 268 00:19:57,300 --> 00:20:03,440 So it starts by, we have been alerted, which is nice because they acknowledge that we contacted them, so we are off the hook. 269 00:20:03,900 --> 00:20:11,160 And then they continue by saying, the relay attack, and we didn't do any relay attacks, so I'm not sure what they're talking about. 270 00:20:11,420 --> 00:20:18,440 And then they try to explain what a relay attack is, and they say, if you leave your key close to the vehicle, it could be scanned. 271 00:20:19,320 --> 00:20:22,380 Now, a relay attack doesn't work that way at all. 272 00:20:22,380 --> 00:20:28,800 If you leave your key close to your car, I'm going to get in, I'm going to drive off, I don't care about the relay part. 273 00:20:30,620 --> 00:20:42,960 So they continue, and they say, the second attack includes, it takes about 100 days, and it requires a skilled attacker, and skilled assembly and use. 274 00:20:42,960 --> 00:20:47,120 So I was kind of flattered, because it means that they read the paper we sent them. 275 00:20:48,020 --> 00:20:52,700 And then they continue reading, and they again explain how this attack works. 276 00:20:53,040 --> 00:20:57,280 And they say that for this attack, you have to be close to the key fob. 277 00:20:57,660 --> 00:21:00,800 Now, the attack is called a car-only attack. 278 00:21:01,380 --> 00:21:04,180 So I never have to be close to the key fob. 279 00:21:04,520 --> 00:21:06,980 This is a little section from the paper. 280 00:21:07,080 --> 00:21:12,700 So the car-only attack is a little subsection in the paper, because it's not really a practical attack. 281 00:21:12,700 --> 00:21:17,900 And the second sentence basically says, without ever being in proximity of the key fob. 282 00:21:18,860 --> 00:21:21,720 Now, if you own a McLaren, there's no need to worry. 283 00:21:22,240 --> 00:21:26,560 McLaren takes the security of all their vehicles very seriously. 284 00:21:29,620 --> 00:21:33,100 So after this research, we can of course draw some conclusions. 285 00:21:33,380 --> 00:21:37,540 I think everyone here knows, but don't use proprietary cryptography. 286 00:21:38,240 --> 00:21:45,000 And if you're a chip manufacturer, secrecy of data sheets is simply annoying. 287 00:21:45,000 --> 00:21:48,220 And it doesn't really stop any attacker. 288 00:21:48,460 --> 00:21:54,660 It just makes it more difficult for legitimate researchers to find vulnerabilities and fix them. 289 00:21:54,960 --> 00:22:01,140 And if you're a car manufacturer, just buying stuff from a tier 1 or tier 2 supplier is maybe not the best idea. 290 00:22:01,140 --> 00:22:05,400 Maybe you should work with them and try to figure out what you're actually buying from them. 291 00:22:06,040 --> 00:22:13,180 And if you're making a product that has a microcontroller with firmware in it, don't rely on the secrecy of the firmware for security. 292 00:22:13,260 --> 00:22:15,540 There's always a way to get the firmware out. 293 00:22:15,700 --> 00:22:19,180 But that also doesn't mean that you should make it easy to get the firmware out. 294 00:22:20,260 --> 00:22:24,720 Now, there's a few other issues we've seen with similar systems. 295 00:22:24,720 --> 00:22:33,240 So, Flavio Garcia, for example, he showed that Volkswagen was using only 7 keys for all of their remoteless entry systems. 296 00:22:33,240 --> 00:22:37,720 So, this includes Audi, Skoda, I think, and all of the other Volkswagen brands. 297 00:22:38,620 --> 00:22:47,200 And then, of course, if you're one of the designers of such systems, maybe read the papers that people have published about this kind of stuff, so that you know what kind of attacks are out there. 298 00:22:47,980 --> 00:22:51,420 But then, most importantly, this is a tweet from one of my colleagues. 299 00:22:51,420 --> 00:23:00,100 And Tesla got a lot of heat for using only 40-bit keys, but at least they did the effort of fixing it, and they replied to us when we emailed them. 300 00:23:00,260 --> 00:23:02,440 And this cannot be said for the other manufacturers. 301 00:23:04,180 --> 00:23:10,080 So, then I have a video we made to show how the attack works, if I can. 302 00:23:12,880 --> 00:23:17,980 So, I will just talk through the video to explain again how the attack works, just to recapitulate. 303 00:23:18,640 --> 00:23:22,200 So, it's actually quite easy to find these cars if you want to steal them. 304 00:23:22,200 --> 00:23:25,680 They all have to charge, and they all do it in the same location. 305 00:23:28,860 --> 00:23:34,360 So, what you do is you go to a supercharger, you hide there, and you wait for someone to charge their car. 306 00:23:38,100 --> 00:23:42,300 Now, what most people do is it takes like 30 or 45 minutes to charge their vehicle. 307 00:23:42,580 --> 00:23:47,200 So, they'll take a walk, or they'll go to a nearby coffee shop, so it's also easy to find your target. 308 00:23:49,000 --> 00:23:54,680 Now, as an attacker, we need the car identifier, and the easiest way to get it is to just sniff it from the vehicle. 309 00:23:54,680 --> 00:24:01,280 So, you walk up to the vehicle, and you just receive it, basically. 310 00:24:03,120 --> 00:24:06,780 So, the output on top, the terminal output, is recorded from my phone. 311 00:24:10,110 --> 00:24:14,670 Then you walk to your target, you send your chosen challenge, and your random challenge. 312 00:24:16,230 --> 00:24:26,110 You record the responses, you download the candidate key file, you brute force the remaining keys, and in about five seconds you have a perfect copy of the key fob. 313 00:24:26,790 --> 00:24:31,610 You walk back to the car, you unlock it, don't forget to unplug it. 314 00:24:40,530 --> 00:24:45,350 The protocol is the same for unlocking and starting, so once you can unlock it, you can also start the vehicle. 315 00:24:45,670 --> 00:24:47,050 You start it, and you drive off.