1 00:00:00,000 --> 00:00:01,520 So we will get started. 2 00:00:01,520 --> 00:00:03,260 I think now is as good a time as any. 3 00:00:03,440 --> 00:00:08,900 Again, thank you for coming, spending your time, your DEF CON precious time with me. 4 00:00:08,900 --> 00:00:11,240 This is the car hackers version. 5 00:00:11,400 --> 00:00:15,240 So the main stage talk had a lot of background information. 6 00:00:16,040 --> 00:00:22,040 Today's information, I just assume that you know a little bit about hacking cars and we're just going to go. 7 00:00:22,440 --> 00:00:31,960 So first up, and definitely not least, is almost everything that we've done here is only possible by standing on the shoulders of giants. 8 00:00:31,960 --> 00:00:33,580 That's how we see so far. 9 00:00:33,580 --> 00:00:35,720 We have lots of people that help us. 10 00:00:35,720 --> 00:00:37,140 Many are named on screen. 11 00:00:37,140 --> 00:00:42,720 There's many that are not named that write open-source software and contribute to open-source software and fix bugs, etc. 12 00:00:42,820 --> 00:00:51,000 All of this is only really possible because we all work together in that regard and we can stand so tall. 13 00:00:51,000 --> 00:00:53,360 So thank you to everybody on the slide and not. 14 00:00:54,660 --> 00:00:58,640 So we found some SeedKeyExchange and this is a car hacking talk. 15 00:00:58,640 --> 00:01:01,360 So if you know a little bit of car hacking, you're probably thinking, so what? 16 00:01:01,360 --> 00:01:02,360 You found SeedKeyExchange. 17 00:01:02,360 --> 00:01:06,100 I see that every day and we all know what SeedKeyExchange is, right? 18 00:01:06,100 --> 00:01:11,440 This is the authorization mechanism that protects diagnostic functions on cars. 19 00:01:11,580 --> 00:01:18,480 You find it in UDS, which is in CAN, but UDS is also now an automotive Ethernet in the form of DOIP. 20 00:01:18,480 --> 00:01:25,820 You also find SeedKeyExchange in the precursor to UDS known as KWP-2000, Keyword Protocol 2000. 21 00:01:25,880 --> 00:01:33,540 And SeedKeyExchange even existed in J1587, which was on J1708, which was a very old serial bus on trucks. 22 00:01:33,560 --> 00:01:36,900 So SeedKeyExchange in some form has been around for a long ass time. 23 00:01:36,900 --> 00:01:39,040 This is what it looks like on CAN. 24 00:01:40,280 --> 00:01:45,460 So because this is on CAN, the first layer is ISOTP, the ISO transport layer. 25 00:01:45,460 --> 00:01:46,660 That's what these first bytes are. 26 00:01:46,660 --> 00:01:50,980 It's telling you there's a 2-byte message here, 4-byte message, 4-byte message, 2-byte message. 27 00:01:50,980 --> 00:01:52,680 Then we have the service identifier. 28 00:01:53,140 --> 00:01:56,200 The security service for SeedKeyExchange is 27. 29 00:01:56,200 --> 00:01:57,460 So here's your 27. 30 00:01:57,620 --> 00:02:01,520 The next one, because we're dealing with UDS, is saying positive confirmation. 31 00:02:01,520 --> 00:02:04,940 That's plus 40 hex, 67, 27. 32 00:02:04,940 --> 00:02:05,720 This is an error. 33 00:02:05,720 --> 00:02:06,980 That should say 67. 34 00:02:07,560 --> 00:02:09,480 And then we have the subservice. 35 00:02:09,480 --> 00:02:11,760 This is give me a seed right here. 36 00:02:11,760 --> 00:02:14,340 And in the request, it gives you back the seed. 37 00:02:14,340 --> 00:02:20,220 Then the diagnostic software, or potentially the attacker, says here's the matching key. 38 00:02:20,900 --> 00:02:25,920 And then if those match, if the ECU sees a match, you're good, you unlock. 39 00:02:25,920 --> 00:02:27,400 There's no session control here, right? 40 00:02:27,400 --> 00:02:33,380 When the ECU is unlocked for this diagnostic software, it's unlocked for everything else on that CAN bus. 41 00:02:33,380 --> 00:02:40,580 And because this is a CAN bus, there is no integrity or confidentiality protection here on this bus. 42 00:02:40,580 --> 00:02:43,820 So an attacker that has access to the bus can actually see these messages as well. 43 00:02:44,340 --> 00:02:50,720 Which is what we all do when we're assessing our security, our diagnostic software security, right? 44 00:02:50,720 --> 00:02:51,820 I had this log. 45 00:02:51,820 --> 00:02:58,220 So here's a traffic capture of some data on J1708, or at least that's what the log says. 46 00:02:58,420 --> 00:03:05,880 And we were running the diagnostic session, the diagnostic tool, pushing buttons in the diagnostic tool and capturing this traffic. 47 00:03:05,880 --> 00:03:08,300 And we said, well, what's going on right here? 48 00:03:08,360 --> 00:03:11,660 27, 67, 27, 67. 49 00:03:11,660 --> 00:03:14,780 Is that seed key exchange on J1708? 50 00:03:15,360 --> 00:03:17,760 Because that really looks like service 27. 51 00:03:18,120 --> 00:03:25,140 And that means it's probably UDS in J1708, which UDS is very new and J1708 is very old. 52 00:03:25,140 --> 00:03:27,640 This wasn't J1708 though. 53 00:03:27,640 --> 00:03:29,160 This was Powerline. 54 00:03:29,160 --> 00:03:36,100 We were doing diagnostic tools for a trailer brake unit on the Powerline network, which I'll talk about a little bit. 55 00:03:36,100 --> 00:03:38,000 It turned out it wasn't UDS. 56 00:03:38,000 --> 00:03:47,080 It was an older form of a diagnostic system called KWP2000, which is very similar, but some of the service numbers don't line up. 57 00:03:47,200 --> 00:03:49,200 And then, yeah, there's ISOTP there. 58 00:03:49,200 --> 00:03:58,940 And then these things here, ACFE89, 89FEAC, these are what are called data link escapes in J1708. 59 00:03:58,940 --> 00:04:02,600 And they are the proprietary space on that bus. 60 00:04:02,600 --> 00:04:12,060 So what we found here was seed key exchange in UDS on a bus that is really much newer, much older than that. 61 00:04:12,060 --> 00:04:15,260 We had a really new technology on a really old bus, and it's really weird. 62 00:04:15,260 --> 00:04:18,780 And of course, we found it in a trailer brake controller. 63 00:04:18,780 --> 00:04:23,500 The same one that you see hidden behind mud right here. 64 00:04:24,640 --> 00:04:30,840 And Powerline networks are what connect trailers, these things in the picture, to the tractors that tow them. 65 00:04:30,840 --> 00:04:34,520 For everything in North America since 2001. 66 00:04:35,580 --> 00:04:46,520 So we were looking at the diagnostic logs, and one of the things that you should do when you're analyzing diagnostic traffic logs is categorize all the different services that you see. 67 00:04:46,640 --> 00:04:52,240 So initially, we had categorized these as UDS services, but UDS services don't line up perfectly to KWP. 68 00:04:52,240 --> 00:05:01,600 So if you find yourself in a situation where there's a lot of 18, for example, then you should convert your service tables to KWP 2000, which we did here. 69 00:05:01,680 --> 00:05:10,140 And it's useful to count how many times you see the thing and also to count separately service requests that have different parameter lengths. 70 00:05:10,220 --> 00:05:16,320 We all know that when you're looking at diagnostic software, it relies very heavily on routine control, right? 71 00:05:16,320 --> 00:05:17,420 Hex 31. 72 00:05:17,760 --> 00:05:20,180 But the routine controls are always kind of proprietary. 73 00:05:20,180 --> 00:05:23,320 You send some data into routine control and something happens. 74 00:05:23,320 --> 00:05:27,340 It's not like it's documented what the extra data is in routine control. 75 00:05:27,340 --> 00:05:30,460 Very useful to say, okay, that was a three-byte routine control. 76 00:05:30,460 --> 00:05:31,920 That was a five-byte routine control. 77 00:05:31,920 --> 00:05:34,480 These are obviously somehow different. 78 00:05:34,940 --> 00:05:39,380 You can see that there is a heavy reliance on routine control, which shouldn't surprise you. 79 00:05:39,400 --> 00:05:48,000 We only really repeated the operation a few times, a handful of times, and yet there's like 20 security access calls. 80 00:05:48,200 --> 00:05:52,640 So this software is doing a whole bunch of spurious C key exchanges. 81 00:05:53,040 --> 00:06:05,280 And right off the bat, that has an impact because an attacker, as we're going to talk about in a little bit, an attacker with a whole bunch of collection of C key pairs can sometimes start to reverse engineer what that C key routine is. 82 00:06:05,440 --> 00:06:12,620 And it's not a great idea to like just spuriously send C key requests when you don't need to because you're giving more information about that routine. 83 00:06:12,660 --> 00:06:18,580 But yeah, this is the kind of first step that we would take when we're looking at assessing diagnostic software logs. 84 00:06:18,720 --> 00:06:20,160 Yeah, I can do questions in the middle. 85 00:06:20,160 --> 00:06:20,800 What's up? 86 00:06:24,440 --> 00:06:25,320 Yeah. 87 00:06:27,240 --> 00:06:35,640 Well, so at this point, we only really had this J1708 log and we knew that there was the stack. 88 00:06:35,640 --> 00:06:38,880 So we knew there was like UDS data in here. 89 00:06:38,880 --> 00:06:46,080 To get to this point, we made a fake CAN driver that I'll tell you about in a little bit. 90 00:06:47,480 --> 00:06:52,900 So of course, what I love to do when I'm messing with trailers is a chuff test. 91 00:06:53,560 --> 00:06:55,300 Hopefully you can hear that. 92 00:06:55,300 --> 00:06:56,680 No, the audio did not work. 93 00:06:56,680 --> 00:06:57,420 I apologize. 94 00:06:57,420 --> 00:06:59,040 It is chuffing right now. 95 00:06:59,400 --> 00:07:02,740 I swear I have my volume up and they said it would work, but you'll hear... 96 00:07:04,600 --> 00:07:08,740 And this is actually a wireless test that we did on this tanker. 97 00:07:08,740 --> 00:07:14,660 So we are sending a request to reset the ECU and it is chuffing its brakes in response. 98 00:07:14,660 --> 00:07:23,180 Every time I get on a brake controller for trucks, I always start with the chuff test because chuff tests are demonstrable air control. 99 00:07:23,180 --> 00:07:27,060 So you're able to remove or control the air pressure in the pneumatic brake system. 100 00:07:27,060 --> 00:07:29,320 So there's an obvious cyber-physical impact. 101 00:07:29,320 --> 00:07:31,580 It's also really audible, right? 102 00:07:31,660 --> 00:07:42,880 So I can tell immediately when I'm spamming things, if I'm wireless or if I'm connected, I can tell if the command was received because I can hear that it was received and I don't need to worry about parsing response messages. 103 00:07:42,880 --> 00:07:45,520 So it's a very great stand-in. 104 00:07:45,580 --> 00:07:48,640 It is only abuse of commands, right? 105 00:07:48,640 --> 00:07:54,460 And abuse being taking the software and making it do what they wrote the software to do. 106 00:07:54,580 --> 00:08:07,480 Not exploiting the microprocessor, not doing buffer overflows and putting in a payload, just taking the software that they wrote, asking it to kindly do what the software was intended to do, but I'm an attacker and I'm using it for a purpose they didn't intend, 107 00:08:07,480 --> 00:08:07,960 right? 108 00:08:07,960 --> 00:08:10,800 No one intended me to wirelessly chuff the brakes. 109 00:08:11,000 --> 00:08:12,940 So it is just abuse. 110 00:08:13,100 --> 00:08:24,380 None of this research talks about exploitation, but we are talking about software code bases that are very old and were possibly not written with any kind of adversarial inputs in mind. 111 00:08:24,480 --> 00:08:28,360 That entire space is unexplored somewhat intentionally. 112 00:08:28,360 --> 00:08:40,320 We're not interested in dropping ODE for RCE on trailers, but we hope that suppliers are interested in that and are being very careful about the software that they're developing and deploying. 113 00:08:40,320 --> 00:08:41,560 That's our hope. 114 00:08:41,580 --> 00:08:44,360 So yeah, just to underscore, this is abuse and not exploitation. 115 00:08:46,320 --> 00:08:48,260 So back to SeedKey Exchange. 116 00:08:48,820 --> 00:08:50,720 We're all car hackers here, right? 117 00:08:51,260 --> 00:08:56,000 Whenever we're getting to a diagnostic system, we want to assess the security of our SeedKey Exchange. 118 00:08:56,000 --> 00:08:57,960 There's a whole bunch of different ways to break it. 119 00:08:57,980 --> 00:09:00,920 I'm a big fan of attack trees as well as flags. 120 00:09:01,000 --> 00:09:04,660 This is an attack tree that I created a while ago for a training at Cybertruck. 121 00:09:04,660 --> 00:09:06,700 I see a few Cybertruck students in the audience. 122 00:09:06,700 --> 00:09:07,580 Thank you for coming. 123 00:09:08,960 --> 00:09:12,040 There's a lot of different ways to break this depending on what you have access to. 124 00:09:12,040 --> 00:09:19,360 If you have diagnostic software, you can actually extract a lookup table just by repeating requests through the diagnostic software. 125 00:09:19,360 --> 00:09:24,820 You can obviously go into the diagnostic software and reverse engineer the routine that has to be in there if it's not protected. 126 00:09:24,820 --> 00:09:28,420 If you have ECU firmware, reverse engineering is also possible. 127 00:09:28,680 --> 00:09:36,840 If you have a capture of the SeedKey Exchanges, which remember, this particular diagnostic software does about, you know, three or four per operation. 128 00:09:36,840 --> 00:09:38,400 So we get a lot of captures. 129 00:09:38,540 --> 00:09:42,020 You can either figure out the formula. 130 00:09:42,020 --> 00:09:43,520 That's this green one. 131 00:09:43,520 --> 00:09:49,860 Or you can just retry until the seed that you've recorded shows up again. 132 00:09:50,400 --> 00:09:56,060 So let's just go back quickly to SeedKey Exchange so I can drive that home. 133 00:09:56,060 --> 00:09:57,880 This is a challenge response protocol. 134 00:09:59,100 --> 00:10:11,120 These seeds that come out should be, if this was a cryptographically secure challenge response protocol, the seeds would be nonces, which is a cryptographic term for a number used once. 135 00:10:11,660 --> 00:10:19,600 If I have a whole bunch of captures of these things and the same seed comes out, that means the exact same key will be calculated. 136 00:10:19,800 --> 00:10:26,900 So if I record a seed and a key, anytime I see that seed again, I can just reuse that key and I win as an attacker. 137 00:10:26,960 --> 00:10:27,320 Right? 138 00:10:27,480 --> 00:10:35,780 So when we're trying to break this thing, if we have a whole bunch of captures of pairs, when we see a repeated seed, we can stop. 139 00:10:35,780 --> 00:10:37,340 That's what this retry is about. 140 00:10:37,340 --> 00:10:41,900 Just keep retrying until you see the seed you already know and then send the key that matches. 141 00:10:42,200 --> 00:10:46,680 So there's a whole bunch of different ways to do retry until you win. 142 00:10:46,680 --> 00:10:49,220 One of them is known as the reset attack. 143 00:10:49,540 --> 00:10:58,660 And Sekhar Kulandvel and his other authors put together a great paper called Candid about two years ago, specifically about how to do this on CAN bus. 144 00:10:59,280 --> 00:11:01,900 Okay, and we'll talk about a tool that does it as well. 145 00:11:02,580 --> 00:11:05,520 But of course, there's other ways to do the retry. 146 00:11:05,600 --> 00:11:16,560 And if you're facing a diagnostic system that you want to assess the security of, there's other things you should try, too, to make sure that this seed key routine is actually secure. 147 00:11:16,860 --> 00:11:19,660 To begin with, try to get multiple seeds. 148 00:11:19,660 --> 00:11:25,100 Can I just keep requesting seeds without changing diagnostic session, without sending a key? 149 00:11:25,100 --> 00:11:28,820 Will it just let me brute force until I get the seed I want? 150 00:11:29,240 --> 00:11:35,660 Sometimes ECUs aren't written correctly, and they let you get one seed and try a key, try different keys multiple times. 151 00:11:35,660 --> 00:11:37,380 That is a weakness that has happened. 152 00:11:37,440 --> 00:11:44,120 There's also been a very specific weakness, where you could ask for a seed, send a key. 153 00:11:44,120 --> 00:11:49,020 If it said no, you could just change diagnostic session control level, and then try a different key. 154 00:11:49,020 --> 00:11:54,460 So there was a side effect in the DSC processor, where it would reset the try count. 155 00:11:54,680 --> 00:11:58,100 So it's these kind of things where we're trying to test these systems. 156 00:11:58,300 --> 00:12:01,040 And as testers, we should always assume, how could this go wrong? 157 00:12:01,300 --> 00:12:05,060 And then cook up a test based on that assumption of how it could go wrong. 158 00:12:05,060 --> 00:12:08,220 And one of them here is this time dependence. 159 00:12:08,820 --> 00:12:12,840 So many of you in the audience have probably used Caring Caribou, right? 160 00:12:12,840 --> 00:12:17,360 It's a pretty powerful tool that will run on any socket can system. 161 00:12:17,940 --> 00:12:25,840 Caring Caribou actually has modules for assessing the time dependence of seeds that are emitted. 162 00:12:25,840 --> 00:12:30,840 So it'll send a reset request, it'll wait for a delay, and then it'll send a seed request. 163 00:12:30,840 --> 00:12:32,260 And it does this repeatedly. 164 00:12:32,420 --> 00:12:36,340 And if it sees a repeated seed, it says, all right, you won. 165 00:12:36,340 --> 00:12:36,860 You're good. 166 00:12:36,860 --> 00:12:37,900 There's a vulnerability here. 167 00:12:38,220 --> 00:12:43,740 But if it doesn't say anything, then obviously we've tested the ECU and everything is fine, right? 168 00:12:43,740 --> 00:12:48,660 We ran Caring Caribou, we asked, hey, are there any time dependent seeds? 169 00:12:48,660 --> 00:12:50,300 And Caring Caribou said, no, you're good. 170 00:12:50,500 --> 00:12:52,260 Just move on, right? 171 00:12:52,600 --> 00:12:57,060 The problem is, there's timing slop, right? 172 00:12:57,060 --> 00:13:03,080 Caring Caribou sent a reset, did a little bit of a wait, and then asked for a seed. 173 00:13:03,300 --> 00:13:14,600 And if we're really going to be sure about whether the seeds are time dependent, we need to make sure that the time between the processing of the reset request and the processing of the seed request is very deterministic. 174 00:13:14,600 --> 00:13:15,920 There's no jitter in there. 175 00:13:16,000 --> 00:13:22,080 If there's any slop in there, and it is a time dependent seed, the time dependence will change the value of the seed. 176 00:13:22,080 --> 00:13:24,180 So, of course, you won't see a repeated seed. 177 00:13:24,220 --> 00:13:26,600 And that's why it has this iterations value. 178 00:13:26,860 --> 00:13:34,080 Caring Caribou has a decent default, but that default is obviously tuned for the developer's laptop and whatever they were running and all that kind of thing, right? 179 00:13:34,080 --> 00:13:35,620 Because this is just Python code. 180 00:13:35,620 --> 00:13:41,540 And under the hood, it's just running sleep in between reset and the seed request. 181 00:13:41,740 --> 00:13:47,220 Now, this is how we tested for time dependence the very first time on the trailer break controller. 182 00:13:47,220 --> 00:13:53,660 This is using a bash script and a Python script that we use to send messages and a Python sleep. 183 00:13:53,860 --> 00:14:02,460 And sometimes, really, what Caring Caribou is doing and what this much worse version is doing is good enough for you to look at the seeds and say, yeah, actually, there is some time dependence here. 184 00:14:02,460 --> 00:14:04,900 Like, I can see it in the repeated values. 185 00:14:04,900 --> 00:14:07,980 Do this 100 times, and you'll see some repetition. 186 00:14:07,980 --> 00:14:11,560 So even with Caring Caribou, we'll say yes or no. 187 00:14:11,600 --> 00:14:15,320 This method where you look at the plot will give you a better judgment. 188 00:14:15,320 --> 00:14:16,580 But look at the output. 189 00:14:16,580 --> 00:14:17,680 Let your eyes judge. 190 00:14:17,680 --> 00:14:22,740 When we did this, we almost immediately had the gut feeling that, yes, there was a time-dependent seed here. 191 00:14:23,700 --> 00:14:26,740 Now, I mentioned this to you, and we'll talk about it in some detail. 192 00:14:26,740 --> 00:14:35,680 I made a fake Python can driver, which ultimately actually let me script Scapy Automotive into the trailer brake controller. 193 00:14:35,680 --> 00:14:39,300 So this actually was interfacing with Powerline networks. 194 00:14:39,640 --> 00:14:40,820 And it's Scapy Automotive. 195 00:14:40,820 --> 00:14:43,600 And this was the version that, you know, runs as well. 196 00:14:43,600 --> 00:14:44,500 It's a little bit better. 197 00:14:44,500 --> 00:14:46,700 And this looks very much like Caring Caribou. 198 00:14:46,860 --> 00:14:49,440 But this one here, the sleep is still kind of... 199 00:14:49,440 --> 00:14:50,300 there's too much slop. 200 00:14:50,300 --> 00:14:52,720 There's too much potential jitter here. 201 00:14:53,180 --> 00:15:03,460 And on can, so Sekhar Kulenvel and his other authors did publish ways to take care of the timing, very, very small timings down at the can level. 202 00:15:03,460 --> 00:15:06,760 But you have to remember, there's a lot of slop happening, not just in this sleep. 203 00:15:06,800 --> 00:15:09,020 There's slop happening every time you do ascent. 204 00:15:09,020 --> 00:15:10,420 Because there's buffers. 205 00:15:10,420 --> 00:15:15,480 There's buffers in between your Python code and the actual bus. 206 00:15:15,480 --> 00:15:18,080 There's a FIFO in the can controller. 207 00:15:18,080 --> 00:15:22,880 There's probably another FIFO in the driver for the can controller. 208 00:15:22,880 --> 00:15:27,980 If you're crossing the user space to kernel space boundary, there's another copy that happens there. 209 00:15:27,980 --> 00:15:29,460 There's all kinds of these buffers. 210 00:15:29,460 --> 00:15:32,120 Each one of them can introduce timing slop. 211 00:15:32,440 --> 00:15:36,920 So there are ways with can bit banging, in particular, to bypass a lot of that. 212 00:15:36,920 --> 00:15:43,660 And you just put the data you want down in a very small microcontroller, like a Pi, and then you let the can bit banging routine take care of that. 213 00:15:43,880 --> 00:15:51,580 And Sekhar Kulenvel in the Candid paper also has some great ways that should take care of the lower level issues, but not all of the buffers. 214 00:15:51,580 --> 00:15:55,760 For us, we were using J2497, which is the powerline bus. 215 00:15:56,040 --> 00:16:00,500 The powerline bus communicates in radio frequency range. 216 00:16:00,920 --> 00:16:03,020 So we were using SDRs. 217 00:16:03,280 --> 00:16:23,260 And the really interesting kind of thing that happened here is because we were testing J2497 and we already had a way to do transmit with SDRs, we could just fill a DAC, which is all this transmit SDR is, with all the samples we wanted and just stream the samples out in a giant buffer with a very reliable clock source on it. 218 00:16:23,260 --> 00:16:26,760 And we just eliminated all of these sources of jitter. 219 00:16:26,760 --> 00:16:33,580 So normally when you're testing powerline, you have a vehicle diagnostic adapter, which is like an embedded system that has a buffer in it. 220 00:16:33,580 --> 00:16:38,760 And it connects over USB and there's a USB driver and that USB driver has buffers in it. 221 00:16:38,760 --> 00:16:42,840 And then your software in Windows has buffers and it's buffers all the way down introducing jitter. 222 00:16:43,840 --> 00:16:50,180 But our transmit method was just straight out through an SDR and we just cut all of that jitter out. 223 00:16:50,180 --> 00:16:58,240 So we were able to upgrade that Python-based test to a SDR-based test, and we were confirming ultimately that, yeah, these seeds are very predictable. 224 00:16:58,240 --> 00:16:59,580 And we'll talk about that too. 225 00:17:00,240 --> 00:17:02,860 But, you know, we'll step back a little bit. 226 00:17:03,620 --> 00:17:05,460 We've all tested some ECUs. 227 00:17:05,800 --> 00:17:08,060 You have a seed, so what, right? 228 00:17:08,060 --> 00:17:09,980 Like a seed is not a key. 229 00:17:10,900 --> 00:17:13,720 That's the limitation of the reset attack, right? 230 00:17:13,720 --> 00:17:20,280 The reset attack lets you control the seed, but you still ultimately do need a key to match it to unlock the ECU. 231 00:17:20,280 --> 00:17:21,820 So how are you going to do that? 232 00:17:23,660 --> 00:17:29,340 I mean, one of the ways is if you're lucky, you see a seed you know, right? 233 00:17:29,340 --> 00:17:30,680 We have all these captures. 234 00:17:31,140 --> 00:17:35,880 And once we see a repeated seed, like I mentioned, it'll be the same key and then you're good. 235 00:17:36,260 --> 00:17:40,760 Now, reverse engineering is also possible, as I mentioned in that attack tree, et cetera, et cetera. 236 00:17:41,360 --> 00:17:47,220 What we wanted to do was demonstrate that, you know, reverse engineering wouldn't be necessary here. 237 00:17:47,220 --> 00:17:51,380 Although ultimately, yes, reverse engineering of the software was also possible. 238 00:17:52,680 --> 00:17:59,220 And we made an auto hotkey script, which is like this thing you do to automate UI interactions. 239 00:18:00,320 --> 00:18:04,040 And it just kind of goes click, click, click, click, click. 240 00:18:04,040 --> 00:18:08,440 And I would love to show you a video, but the video is of the actual supplier's software. 241 00:18:08,440 --> 00:18:12,440 We're not really interested in, you know, supplier shaming here. 242 00:18:12,460 --> 00:18:15,340 So I just did this thing in a loop, in a loop, in a loop. 243 00:18:15,340 --> 00:18:18,080 And I was chatting with my friend Haystack. 244 00:18:19,060 --> 00:18:27,400 And he did this years ago, and he said, there is something very comforting about the fact that that technique still works, which I thought was funny. 245 00:18:27,400 --> 00:18:28,500 We had a chuckle about that. 246 00:18:28,500 --> 00:18:32,160 So we extracted about 200 of these seed key pairs. 247 00:18:34,400 --> 00:18:38,240 And that means that if we see the repetition, then we're good. 248 00:18:38,240 --> 00:18:39,920 We just kind of move on. 249 00:18:41,680 --> 00:18:44,520 Now that's useful in bench setups. 250 00:18:44,520 --> 00:18:48,820 And even if you look at Karen Caribou's documentation, they kind of discuss, like, there's a whole bunch of different ways to do it. 251 00:18:48,820 --> 00:18:52,180 Obviously, you can get a matching key some way. 252 00:18:52,320 --> 00:18:54,020 And if we're on a bench, yeah, this is fine. 253 00:18:54,020 --> 00:18:55,540 We'll just retry until we see a seed. 254 00:18:55,540 --> 00:19:01,900 It isn't a useful method for, like, a malicious actor that's going to do a remote payload, for example, right? 255 00:19:01,900 --> 00:19:08,800 If you're going to put a remote payload on a vehicle, you actually need to be able to fully calculate for any seed what the key is. 256 00:19:08,800 --> 00:19:15,400 You need to understand, like, what is this f of x here, right? 257 00:19:15,800 --> 00:19:18,180 And to do that, reverse engineering is possible. 258 00:19:18,180 --> 00:19:26,540 In this particular case, yeah, if you went to the supplier's diagnostic software and you looked at the DLLs, there'd be something roughly saying password, and then the function was right there. 259 00:19:26,540 --> 00:19:28,660 So it was easy to do that. 260 00:19:28,820 --> 00:19:40,160 But in the model where maybe the attacker doesn't even know what the target is or doesn't have access to the diagnostic software, what if they just saw these seed key pairs on the bus? 261 00:19:40,200 --> 00:19:51,720 Would they ever get enough information from just the seed key exchange, which is this is the 200 that we captured, from, like, this plot to tell themselves, oh, I know how to predict every key for that seed. 262 00:19:51,740 --> 00:19:56,760 So, like, as humans, we look at this and we might think it's uncorrelated, right? 263 00:19:56,760 --> 00:19:59,020 It doesn't look like anything in particular. 264 00:19:59,160 --> 00:20:05,800 But what you can do and what attackers could do is make an assumption that it is perhaps linear, right? 265 00:20:05,800 --> 00:20:11,620 And then set up a satisfiability solver and then test if it's linear, and then the computer will tell you if it isn't. 266 00:20:11,620 --> 00:20:15,940 In this particular case, yeah, this doesn't look linear, but it is linear. 267 00:20:15,940 --> 00:20:21,180 It's y equals mx plus b wrapped around by 16 bits, unfortunately. 268 00:20:21,620 --> 00:20:24,260 So attackers don't need many of these points to get the answer. 269 00:20:24,620 --> 00:20:26,520 You don't even have to stop at linear. 270 00:20:26,520 --> 00:20:29,800 You can always say, is it XOR and solve for XOR dragging. 271 00:20:29,800 --> 00:20:40,840 You can also do with something like Z3, is it right shift plus left shift plus, you know, XOR and put weighted coefficients on it and then ask Z3 what coefficients satisfy it. 272 00:20:40,840 --> 00:20:44,960 You can create an, like, arbitrary equation and just let the computer do the work for you. 273 00:20:44,960 --> 00:20:46,320 All of this is possible, right? 274 00:20:46,320 --> 00:20:56,300 So there isn't a whole lot of security given to you, particularly in the 16-bit space, when you're giving out these repeated, or you're giving out seeds and keys, unfortunately. 275 00:20:57,760 --> 00:20:59,540 Right, so where do we end up? 276 00:20:59,580 --> 00:21:01,400 We had the diagnostic software. 277 00:21:01,700 --> 00:21:02,460 Good. 278 00:21:02,640 --> 00:21:04,680 We were able to reverse engineer it. 279 00:21:04,680 --> 00:21:06,240 Yep, that was one of the things. 280 00:21:06,340 --> 00:21:12,380 We also had captures, and the captures were enough that we could solve for the constants. 281 00:21:12,620 --> 00:21:14,920 In a known equation, ultimately linear. 282 00:21:16,060 --> 00:21:19,020 And we could then retry until we saw the repeated one. 283 00:21:19,020 --> 00:21:21,000 We could have just stopped with the repeated one as well. 284 00:21:21,000 --> 00:21:22,660 All of this was possible. 285 00:21:23,020 --> 00:21:28,960 And attackers with more, you know, more resources could do other ways that you could think of it in this tree as well. 286 00:21:28,960 --> 00:21:31,480 So anyways, we unlocked this thing. 287 00:21:31,480 --> 00:21:32,440 That's great. 288 00:21:32,740 --> 00:21:38,420 Unlocking the controller means that you can do diagnostic actions, right? 289 00:21:38,420 --> 00:21:40,220 That's what we did. 290 00:21:40,220 --> 00:21:45,620 Um, we should test what services are available after we unlock. 291 00:21:45,620 --> 00:21:49,120 We should test the sub functions of those services. 292 00:21:49,120 --> 00:21:54,160 We should also see like that diagnostic seed key routine that we know now. 293 00:21:54,680 --> 00:21:57,900 Is it the same one for all the other levels in the ECU? 294 00:21:57,900 --> 00:22:01,300 Like ECUs have multiple diagnostic levels, multiple seed key routines. 295 00:22:01,300 --> 00:22:04,860 How powerful is this thing that they gave us in the diagnostic control? 296 00:22:04,920 --> 00:22:07,140 So we went through all of this. 297 00:22:07,140 --> 00:22:14,700 We cooked up this automotive SCAPI script that you see here, which tests whether keys can be retried. 298 00:22:14,700 --> 00:22:17,900 So you can test retry without knowing the seed. 299 00:22:17,900 --> 00:22:20,340 If you just assume that like the return codes are different. 300 00:22:20,380 --> 00:22:25,900 When you know the actual right seed, you can be 100% sure whether the return codes are not different or not. 301 00:22:25,900 --> 00:22:26,880 And here's an example. 302 00:22:26,880 --> 00:22:28,420 And of course, this will be on the media server. 303 00:22:28,420 --> 00:22:29,700 So you're welcome to use it. 304 00:22:29,800 --> 00:22:31,500 I'm a big fan of automotive SCAPI. 305 00:22:31,500 --> 00:22:32,640 It's very powerful. 306 00:22:33,180 --> 00:22:38,820 And there are some bugs, but I'm sure the bugs are going to get ironed out very rapidly because it's getting a lot of uptake. 307 00:22:39,440 --> 00:22:40,740 So yeah, SR1. 308 00:22:40,980 --> 00:22:41,940 This is SCAPI. 309 00:22:41,940 --> 00:22:49,840 I think one of the benefits of using automotive SCAPI today is automotive Ethernet is coming at us like very rapidly. 310 00:22:49,940 --> 00:22:54,980 And really all the tooling that we're going to spin up, like our own custom tooling, we don't publish everything, right? 311 00:22:54,980 --> 00:23:03,260 All of our custom tooling that we're going to write will immediately be portable to like DOIP and other automotive Ethernet based systems in the near future. 312 00:23:03,260 --> 00:23:06,320 So it'll save us that ramp up time as we change technologies. 313 00:23:06,320 --> 00:23:08,330 It'll just still be SCAPI. 314 00:23:09,920 --> 00:23:11,380 Yeah, so how we did this? 315 00:23:11,380 --> 00:23:13,920 Sorry, it took me a while to get to your question. 316 00:23:13,920 --> 00:23:16,350 We actually faked PythonCAN. 317 00:23:16,740 --> 00:23:30,560 So if we go all the way back to that log at the beginning, ACFE89 and 89FEAC are the J1708 data link escape bytes. 318 00:23:30,560 --> 00:23:32,500 And they're saying it's a unicast message. 319 00:23:32,500 --> 00:23:34,120 It's a point-to-point message. 320 00:23:34,120 --> 00:23:37,280 And because it's FE, it's like escaped from 1708. 321 00:23:37,280 --> 00:23:38,420 It's not processed. 322 00:23:38,420 --> 00:23:39,460 It's opaque. 323 00:23:39,640 --> 00:23:42,860 And then right after that, you can see it's isotp. 324 00:23:42,860 --> 00:23:46,460 O2, there's a transport marker, 10. 325 00:23:46,460 --> 00:23:48,400 There's a flow control, 30. 326 00:23:48,400 --> 00:23:50,440 So it's isotp right on the next layer. 327 00:23:50,440 --> 00:23:53,100 And then UDS after that. 328 00:23:53,300 --> 00:23:55,600 So we just lied that this was CAN. 329 00:23:55,600 --> 00:23:59,940 And one of the interesting things is that every single one of these was 7 bytes. 330 00:23:59,940 --> 00:24:04,480 Now, Powerline and J1708 can actually take 211 bytes. 331 00:24:04,480 --> 00:24:12,540 They had no reason to chunk this up this way, except possibly that they wanted to reuse, like they probably had some reuse of existing code. 332 00:24:12,540 --> 00:24:20,280 And inside the ECU, they're probably doing some version of the faking of the CAN bus that we did. 333 00:24:20,340 --> 00:24:30,900 So we have a fake CAN bus on my laptop communicating over Powerline into some kind of fake CAN adapter inside the ECU software, I like really weird software stacks, so that makes me happy. 334 00:24:30,900 --> 00:24:32,300 I hope it makes you happy, too. 335 00:24:32,660 --> 00:24:37,560 We have Python CAN connecting to RP1210, which is a very trucking-specific DLL. 336 00:24:38,460 --> 00:24:43,940 And then that RP1210 is opening J1587, which is a trucking-specific protocol. 337 00:24:43,940 --> 00:24:47,220 And then that's being converted in the adapter on J2487. 338 00:24:47,220 --> 00:24:51,840 So the stack just goes down and gets weirder and weirder, which I really like. 339 00:24:54,440 --> 00:24:57,320 And here's the driver code, roughly, for that fake Python CAN. 340 00:24:57,320 --> 00:24:58,160 It's actually pretty simple. 341 00:24:59,220 --> 00:25:02,940 It is very easy to write a fake or any Python CAN driver. 342 00:25:02,940 --> 00:25:18,120 So if you ever find yourself in a situation where, like, oh, I really wish I could connect SCAPI to this thing, or, you know, I wish I could put Karin Karibu on this particular diagnostic IP interface, or even as we start using, like, time-sensitive networking on automotive Ethernet, 343 00:25:18,120 --> 00:25:20,640 it's actually really easy to write a Python CAN driver. 344 00:25:20,640 --> 00:25:22,820 I did not delete much of the code here. 345 00:25:22,960 --> 00:25:26,440 And the entire code of this Python CAN driver is available in the white paper. 346 00:25:26,440 --> 00:25:33,120 If you ever find yourself in a situation where you want to fake some CAN, which I think is going to happen more and more in the future, I hope this is useful to you. 347 00:25:33,120 --> 00:25:42,040 But it's not really doing anything else other than receiving some bytes, putting something around it, and then when it's going to send some bytes, it strips some things off of it. 348 00:25:42,060 --> 00:25:42,860 And that's it. 349 00:25:42,860 --> 00:25:44,060 That's how we faked CAN. 350 00:25:44,940 --> 00:25:49,980 And it lets us do stuff like this, because SCAPI Automotive has a UDS scanner. 351 00:25:50,460 --> 00:25:56,120 And the UDS scanner code is capable of emulating the state space of the target ECU. 352 00:25:56,120 --> 00:26:04,440 It knows that certain UDS commands change the state of the ECU, and it models that state change of the ECU. 353 00:26:04,440 --> 00:26:08,040 And what we're looking at here is an adjacency matrix. 354 00:26:08,040 --> 00:26:11,780 It's like a directed graph of all the ways that the states can change. 355 00:26:11,780 --> 00:26:14,100 It's kind of like what you would look at for a finite state machine. 356 00:26:14,340 --> 00:26:22,240 So it's marked it up saying, hey, this is session 134, and the P1 means that it was sending test or present message at the same time. 357 00:26:22,540 --> 00:26:32,120 And then these edges are saying, I actually used DSC 135 to get there, but I could use DSC 134 for this edge. 358 00:26:32,260 --> 00:26:35,940 Now, this diagram, unfortunately, is unnecessarily complicated. 359 00:26:35,940 --> 00:26:40,060 If you look at the adjacency matrix version of this, it's just all connected. 360 00:26:40,060 --> 00:26:47,460 So this diagram looks very interesting, but it's ultimately telling you that every diagnostic session is reachable from every other diagnostic session. 361 00:26:47,460 --> 00:26:50,040 Sometimes when you look at ECUs, it's not fully connected. 362 00:26:50,040 --> 00:26:55,020 It's more like, oh, to get to this diagnostic session, you have to authenticate here first and then go to there. 363 00:26:55,020 --> 00:27:04,020 But ultimately, this was the first thing we generated out of it, which told us that actually, there are no limits to what diagnostic sessions you can navigate to, which is a useful test. 364 00:27:05,240 --> 00:27:07,700 And the code to do that is fairly straightforward. 365 00:27:07,700 --> 00:27:18,680 We're reusing a lot of amazing open source software, in this case by Nils Weiss and Enrico Pozzomone, who added automotive support into Scapi. 366 00:27:18,680 --> 00:27:24,080 And of course, the Scapi authors that are probably too many to name for the last 20 years, right? 367 00:27:24,080 --> 00:27:25,920 So it's a lot of reuse. 368 00:27:26,100 --> 00:27:29,300 And this code is nice and tight, and we get good outputs. 369 00:27:30,300 --> 00:27:34,480 You can also ask Scapi to enumerate security access levels. 370 00:27:34,480 --> 00:27:36,660 That's the SA enumerator here. 371 00:27:36,880 --> 00:27:40,040 And for those of you taking pictures, slides will be available. 372 00:27:40,040 --> 00:27:46,920 And also, the white paper, which there'll be a link to at the end, has all of this in copy and paste Python code. 373 00:27:46,920 --> 00:27:48,400 So you're welcome to copy and paste it. 374 00:27:48,400 --> 00:27:50,080 It's all MIT-licensed. 375 00:27:50,080 --> 00:27:52,020 So please, free to reuse. 376 00:27:52,360 --> 00:28:05,400 This security access enumerator not only tests what DSCs are available, when it enters a diagnostic session level and it knows it's changed state, it then asks, well, what SA levels are now available in that state as well? 377 00:28:05,400 --> 00:28:07,180 So now we have a two-dimensional map. 378 00:28:07,180 --> 00:28:11,920 And you can see in this table that 131, 130... 379 00:28:11,920 --> 00:28:13,560 I have to look at the screen, actually. 380 00:28:13,560 --> 00:28:21,240 134 and 135 were all diagnostic levels that had different security access levels. 381 00:28:21,240 --> 00:28:26,100 So these security access levels were relevant for this DSC, these levels for that DSC. 382 00:28:26,100 --> 00:28:35,680 And the NRs are because when I set this up in the scan range, I should have skipped the subservice IDs that are odd, that are reserved for sending back. 383 00:28:35,920 --> 00:28:39,080 I was asking for an invalid security level when I was doing this setup. 384 00:28:39,080 --> 00:28:42,440 So I should have actually done a skip in the scan range, and that's why you get NRs. 385 00:28:42,440 --> 00:28:48,400 But it tells us now, if we want to go to this security level, we have to first go to this DSC. 386 00:28:48,400 --> 00:28:50,860 And in this ECU, getting to the DSC is easy. 387 00:28:50,860 --> 00:28:54,480 We can get to any DSC from anywhere, but that's not always true in all ECUs. 388 00:28:55,880 --> 00:29:12,380 And then ultimately, code not shown, we took the fact that we knew the SeedKeyRoutine and we enumerated through all of these essays and confirmed that the SeedKeyRoutine we knew that was in the diagnostic software was only useful for diagnostic software. 389 00:29:12,380 --> 00:29:19,220 These other SA levels and DSC levels are probably bootloaders, or other field service, or maybe engineering functions. 390 00:29:19,260 --> 00:29:22,060 And all of those use a different routine. 391 00:29:22,060 --> 00:29:31,660 So the good news here is that whereas you're giving attackers access to cyber-physical impacts, you may not be giving them access to firmware upload and things like that. 392 00:29:31,660 --> 00:29:39,100 Although the vendor did confirm that this CVE did have a potential corruption of firmware impact later. 393 00:29:39,100 --> 00:29:42,040 So there is enough in the diagnostics still to be bad. 394 00:29:42,040 --> 00:29:46,860 A little bit of a segue before we go back to the actual CVE. 395 00:29:46,860 --> 00:29:48,140 I'll talk about that at the end. 396 00:29:48,640 --> 00:29:49,660 We're all car hackers here. 397 00:29:49,660 --> 00:29:53,520 I want to share with you something I'm passionate about, which is all the bench setups. 398 00:29:53,520 --> 00:29:55,020 So I love my bench. 399 00:29:55,020 --> 00:29:58,040 This is a picture of my bench on a clean bench day. 400 00:29:58,480 --> 00:30:04,300 The RS, the target, the roll stability system that we looked at is right here underneath this monkey. 401 00:30:05,160 --> 00:30:07,680 And this is my favorite desk mat, etc, etc. 402 00:30:08,060 --> 00:30:09,960 So you all have bench setups too. 403 00:30:09,960 --> 00:30:12,160 At the back here, there's a power line network. 404 00:30:12,160 --> 00:30:14,920 You can actually see a lamp connected there. 405 00:30:14,920 --> 00:30:17,320 And I have a battery underneath here. 406 00:30:17,340 --> 00:30:20,300 And you can see some power line messages happening on the oscilloscope. 407 00:30:20,300 --> 00:30:22,860 This is where I usually stand and do stuff. 408 00:30:22,860 --> 00:30:24,760 I'm sure you have a cool bench like that too. 409 00:30:25,240 --> 00:30:32,800 One of the things you're going to need to do if you want to get into power line hacking is you're going to have to set up a trailer ECU. 410 00:30:33,240 --> 00:30:34,940 Now these things need power. 411 00:30:35,460 --> 00:30:39,020 The absolute easiest way to power one of these things is a 12-volt battery. 412 00:30:39,020 --> 00:30:46,100 It's really not hard to get a 12-volt battery, get a trickle charger, put it next to your desk, and then you can power every ECU you want. 413 00:30:46,440 --> 00:30:48,540 Note that we call them 12-volt batteries. 414 00:30:48,540 --> 00:30:51,240 12-volt is actually not a great voltage reading on one of these things. 415 00:30:51,240 --> 00:30:53,380 You do want a little bit more than that. 416 00:30:53,700 --> 00:30:59,040 And so we call them 12-volt batteries, but they're probably more like 15-volt batteries, ideally, right? 417 00:31:00,180 --> 00:31:06,640 One of the things you can do to make this work, if you don't want to have a 12-volt battery in your lab, is ATX power supply. 418 00:31:06,640 --> 00:31:11,520 The chunky ones that we used to use on desktop computers, at least in my day. 419 00:31:11,520 --> 00:31:13,720 Actually, in my day it wasn't ATX, it was just AT. 420 00:31:13,840 --> 00:31:16,420 And you can get good 12-volt lines out of this. 421 00:31:16,800 --> 00:31:20,500 And it turns out that there's not a sufficient amount of noise to stop the power line. 422 00:31:20,500 --> 00:31:21,900 So this still works power line. 423 00:31:21,900 --> 00:31:27,420 The thing I wanted to share with you that I think is really useful is these USB PD triggers. 424 00:31:27,560 --> 00:31:30,920 So I use USB-C to power everything these days. 425 00:31:30,920 --> 00:31:35,240 And USB-PD is capable of giving you 12 and 15 and 20 and all kinds of voltages. 426 00:31:35,240 --> 00:31:39,700 You can actually power your entire trailer from this. 427 00:31:39,700 --> 00:31:51,180 So at an event, I once had a USB-PD battery and one of these triggers, and I powered the entire trailer equipment with that one thing. 428 00:31:51,180 --> 00:31:52,560 So they're very useful. 429 00:31:53,000 --> 00:32:01,520 The only thing you have to watch out for with all power line stuff, power line operates in the radio frequency range, about 100 kilohertz to 400 kilohertz. 430 00:32:02,100 --> 00:32:09,100 A lot of power supply output impedances, sorry, power supplies input impedance at this frequency looks like ground. 431 00:32:09,100 --> 00:32:12,180 Many power supplies are not well isolated. 432 00:32:12,620 --> 00:32:18,540 So when you try to generate these radio frequency signals, if you have the wrong power supply connected, it actually attenuates the signals. 433 00:32:18,540 --> 00:32:20,220 They just disappear and go to ground. 434 00:32:20,220 --> 00:32:26,280 This was a problem that actually happened during the fielding of J2497, like in 1999 and in 2000. 435 00:32:26,360 --> 00:32:35,900 And ultimately OEMs put like filter equipment on the trucks and people had to update their trucking equipment power supplies to put inductors on the output. 436 00:32:36,020 --> 00:32:44,560 So if you put an inductor on the output of a power supply, the high frequencies see an open circuit and they no longer go down to ground. 437 00:32:44,720 --> 00:32:48,580 Right here, you saw a little video of me reworking one of these triggers. 438 00:32:48,760 --> 00:32:53,480 It's really not hard to buy a surface mount inductor of about 100 microhenries. 439 00:32:53,480 --> 00:32:55,040 Any size will do, really. 440 00:32:55,040 --> 00:32:57,760 100 microhenries was just easy to get. 441 00:32:57,760 --> 00:33:05,120 You just scrape some copper off, solder it down, and then any USB PD supply you use is now going to be Powerline compatible. 442 00:33:05,120 --> 00:33:07,600 And it makes testing things much, much easier. 443 00:33:08,260 --> 00:33:11,620 Another thing I love for testing, who loves lever nuts? 444 00:33:12,040 --> 00:33:13,860 Come on, we must have some lever nut lovers. 445 00:33:13,860 --> 00:33:14,580 Thank you very much. 446 00:33:14,580 --> 00:33:15,680 I appreciate that. 447 00:33:16,140 --> 00:33:18,020 Yes, I know you love lever nuts, actually. 448 00:33:18,020 --> 00:33:18,440 Thank you. 449 00:33:18,440 --> 00:33:19,420 Thank you for piping up. 450 00:33:19,420 --> 00:33:20,820 I love lever nuts. 451 00:33:20,820 --> 00:33:32,060 Um, something you may not know, the OEM Waggo lever nuts, Waggo, Waggo, are exactly the right size to fit banana jacks. 452 00:33:33,320 --> 00:33:34,820 Which is really great. 453 00:33:34,820 --> 00:33:39,400 These AliExpress ones are like, you know, I think $2 for a bag of 50. 454 00:33:39,400 --> 00:33:44,520 These ones are kind of worth it if you're going to use banana jacks because they fit right in there, which is really rad. 455 00:33:45,360 --> 00:33:47,660 Um, and then talking J2047. 456 00:33:47,660 --> 00:33:51,840 So if you're going to want to hack one of these Powerline equipments, you're going to have to have some way to talk to it. 457 00:33:51,960 --> 00:33:54,880 There's a bunch of send only options, right? 458 00:33:54,880 --> 00:34:00,880 So the truck duck, the truck cape, these things have a way to bit bang J2497 and that's send only. 459 00:34:01,200 --> 00:34:08,380 You also can use an FL2K SDR, which are these VGA dongles that you can use for transmitting radio frequencies. 460 00:34:08,520 --> 00:34:18,120 And the mitigation technology that the NMFDA published in 2022 called the keyhole actually has the code in it to send an arbitrary J2497 signal. 461 00:34:18,120 --> 00:34:21,720 You can repurpose that Python code to send anything you like on J2497. 462 00:34:21,720 --> 00:34:23,540 So these are your send only options. 463 00:34:23,640 --> 00:34:32,040 If you want to send and receive traffic, like both, you're going to need to either buy a diagnostic adapter, an RP-1210, VDA. 464 00:34:32,640 --> 00:34:36,940 To me, I think there's a really great one made by DG Tech called the PLC-TESCON. 465 00:34:36,940 --> 00:34:41,720 And then the Noregon Systems PLC adapter is also really good in my experience. 466 00:34:41,720 --> 00:34:47,760 And these things essentially just convert from 1708 to 2497 and you're going to use 1708 in your software. 467 00:34:47,760 --> 00:34:50,260 Your software will just think it's using 1708. 468 00:34:50,620 --> 00:34:52,900 Under the hood, it's going to be using 2497. 469 00:34:53,160 --> 00:35:04,720 You can also use something like a HackRF or any bi-directional SDR and a plugin called GR-J2497 that was authored by Chris Poore at AIS. 470 00:35:05,500 --> 00:35:10,620 I didn't cover it in this talk, but you can actually capacitively couple your SDR to the power line. 471 00:35:10,620 --> 00:35:26,140 Get yourself a one microfarad capacitor and take the pin of your SDR, put the capacitor in between that and the 12-volt line, and you can just couple your traffic right onto the power line with your SDR. 472 00:35:27,100 --> 00:35:29,120 Which is essentially what we did. 473 00:35:29,760 --> 00:35:32,780 Here's how we inspected J2497. 474 00:35:32,780 --> 00:35:35,320 And when we injected it, it was just an SDR plugged in. 475 00:35:35,320 --> 00:35:44,160 This yellow trace that you see here is like an analog view of the power line that we're extracting from this PLC test con by some of the rework that we did inside. 476 00:35:44,180 --> 00:35:59,420 You don't need to do this to your devices, but I recommend that you do tap into that J1708 line somewhere in your VDA so that you can have this UART decoder working so you can see what's going on down on the bus. 477 00:35:59,420 --> 00:36:14,460 For us, ultimately, we created custom CyGrok decoders that I talked about yesterday to be able to inspect all of the testing we're doing and decide did we succeed in getting a seed or not to get the timings really correct. 478 00:36:14,580 --> 00:36:20,060 And the timings are really necessary because we did a blind version of the unlock. 479 00:36:20,300 --> 00:36:24,400 So previously, it's been disclosed that you can read this traffic remotely. 480 00:36:24,400 --> 00:36:29,660 You can also write this traffic remotely from roughly the same distance for a cheap amount. 481 00:36:29,660 --> 00:36:34,820 And it really is dependent on equipment, and it's dependent on configuration, and it's dependent on how much money you want to spend. 482 00:36:34,820 --> 00:36:42,340 But the bad news in all of this is that the most susceptible equipment in both cases was always tankers. 483 00:36:42,340 --> 00:36:46,380 The things that are just big hunks of metal ended up being the things that are the most susceptible. 484 00:36:46,840 --> 00:36:52,100 And the equipment that we're testing now is obviously tankers because they're that most susceptible. 485 00:36:52,160 --> 00:37:05,140 We did a blind attack because we think it's important to do the cheapest thing, to do something for as little cost as possible so it can be demonstrated that attackers don't need nation state capability to make these things happen. 486 00:37:05,480 --> 00:37:13,760 It's also as a counterpoint to arguments that were made in the original disclosure that if there's any replay protection at all, then you're safe. 487 00:37:14,160 --> 00:37:16,160 This was to demonstrate that that's not the case. 488 00:37:16,160 --> 00:37:22,300 You can have some replay protection, and if there's problems in that replay protection, then it ultimately gets reduced to the same thing. 489 00:37:22,500 --> 00:37:30,560 It's entirely possible for people to create a full duplex send and receive wireless J2497 interface. 490 00:37:30,700 --> 00:37:34,660 If they did that, they don't need to do these blind timing things. 491 00:37:34,660 --> 00:37:39,960 They can just send a request for a seed, look up the key, and send the unlock for the key. 492 00:37:39,960 --> 00:37:41,000 So it becomes simpler. 493 00:37:41,000 --> 00:37:42,520 The range may be reduced. 494 00:37:42,520 --> 00:37:52,000 It's definitely more expensive than this blind setup because blind setups are just transmit only SDRs, which at the time cost like $25 US. 495 00:37:54,800 --> 00:38:06,480 Right, so the blind unlock, because we're just transmitting these things and we don't get to read anything at all, we have to be very particular about where we put our requests, right? 496 00:38:06,720 --> 00:38:09,740 It's even harder than what Karen Caribou does. 497 00:38:09,740 --> 00:38:12,100 Karen Caribou can actually read the thing back. 498 00:38:12,420 --> 00:38:18,320 We want to make sure that we sleep for a very specific amount of time after reset and send our diagnostic session control. 499 00:38:18,320 --> 00:38:23,500 So we need to find a spot here where the bus is quiet and the ECU is ready to receive that command. 500 00:38:23,680 --> 00:38:30,780 Then we need to wait long enough for the ECU to process that command and for the bus to get quiet, and then we can send our security access. 501 00:38:30,780 --> 00:38:35,960 Then again, process, wait for it's quiet, and then send our key to unlock this thing. 502 00:38:35,960 --> 00:38:38,840 This is like the POC of how you would do a wireless unlock. 503 00:38:38,860 --> 00:38:43,660 And every one of these sleeps has to be way more accurate than Python sleep. 504 00:38:43,920 --> 00:38:55,320 But as I alluded to, we were using SDRs, so we had like a nice deep buffer with a very reliable clock so we could just fill this buffer with the bit stream that we wanted to put out and then we're good. 505 00:38:55,320 --> 00:38:56,800 The jitter is removed. 506 00:38:57,430 --> 00:39:06,540 We needed to know, though, what was happening when things came back, which is why we created these decoders. 507 00:39:06,540 --> 00:39:13,500 So down here, you can see a screenshot of a SideRock decoder output, and we set this up like glitch campaigns. 508 00:39:13,500 --> 00:39:25,580 So if you've ever done any glitching, you want to find a particular set of parameters, where to put your pulse, how wide to make your pulse, and then you know if something worked because the bootloader skips or you get a particular error message back. 509 00:39:25,580 --> 00:39:30,220 And it ends up looking at a lot of logs, and maybe you post-process the logs, but you're sweeping parameters, right? 510 00:39:30,220 --> 00:39:32,020 You try here, you try here, you try here. 511 00:39:32,020 --> 00:39:38,120 It's these giant campaigns of parameter sweeps, which is exactly what we were doing for all of those sleeps that we needed to tune. 512 00:39:38,980 --> 00:39:44,900 But I didn't want to look at logs, and the behavior is very stateful as well, right? 513 00:39:44,900 --> 00:39:50,760 Like the ECU has to go into this mode and then it has to go into that mode, and how am I going to know it worked unless I write these custom log processors? 514 00:39:50,760 --> 00:39:52,920 I also really like looking at traces. 515 00:39:52,920 --> 00:39:58,280 So we wrote custom CyGrok tracers that would do the decoding, and then you get these nice colors. 516 00:39:58,280 --> 00:40:08,060 So here's an example of a parameter sweep where I'm changing a parameter slowly, and eventually it crosses the boundary here from not being a good parameter to being a good parameter. 517 00:40:08,060 --> 00:40:09,900 And you can see it goes from purple to green. 518 00:40:09,900 --> 00:40:18,160 So it became interactive and easier to do these sweeps, come back to the bench after a couple hours and see where the parameter changed, which is great. 519 00:40:19,300 --> 00:40:22,900 So this is like what we would do with generating the signal. 520 00:40:22,900 --> 00:40:34,220 Notice that instead of sleeping, we now put silences in place, and these silences are as accurate as the sample clock, which in this case was like 777 megahertz. 521 00:40:34,600 --> 00:40:35,700 So pretty accurate. 522 00:40:36,580 --> 00:40:42,200 And the culmination of all those decoders let us ultimately find all the quiet places. 523 00:40:42,200 --> 00:40:45,460 And if you want details for all the nitty gritty, it's in the white paper. 524 00:40:45,460 --> 00:40:50,920 But here is a screenshot of like the first time that we got kind of the same seed out again and again. 525 00:40:50,920 --> 00:40:59,740 And if you can read the numbers at the bottom, it's not exactly the same seed, but we don't need exactly the same seed all the time to win, right? 526 00:40:59,800 --> 00:41:05,460 Trucks stop at stop signs and stop lights for minutes, right? 527 00:41:05,460 --> 00:41:12,100 We reasoned that if we could really get an attempt out in a two minute period, then we would be good, right? 528 00:41:12,320 --> 00:41:14,040 So how deterministic was this? 529 00:41:14,040 --> 00:41:19,180 We found that if we do a 30 second between retries, we have about a 50% chance of getting the seed right. 530 00:41:19,180 --> 00:41:20,380 And that's just like a hot loop. 531 00:41:20,380 --> 00:41:22,740 30 seconds, try, try, try, try, try. 532 00:41:22,740 --> 00:41:27,660 50% of the time we get the seed we wanted, which is actually still good enough for a stop sign or a stop light. 533 00:41:27,660 --> 00:41:36,520 But worse than that, if you just let things cool down for two and a half minutes and you try in a lower period, you actually get a way higher hit rate. 534 00:41:36,520 --> 00:41:41,720 So the chance of having that first good seed is actually way higher than the repeated seeds. 535 00:41:41,720 --> 00:41:42,920 Yes, please go ahead. 536 00:41:46,300 --> 00:41:48,460 So it's really equipment dependent. 537 00:41:49,220 --> 00:41:51,340 We didn't do any in motion testing. 538 00:41:51,340 --> 00:42:02,460 The equipment that's necessary, and for the details of that, I encourage you to look at the previous disclosure in 2022 of the wireless write vulnerability because it really depends on what are you attacking and how much money did you spend? 539 00:42:02,460 --> 00:42:08,700 But it is possible for, you know, less than 10 grand to set this up in a mobile unit. 540 00:42:08,700 --> 00:42:09,600 It is possible. 541 00:42:09,600 --> 00:42:15,660 It's also possible for like less than a grand to set this up in a ditch from the side of the road. 542 00:42:15,660 --> 00:42:19,060 So these are all tractable situations to be sure. 543 00:42:21,600 --> 00:42:22,760 Thank you for the questions. 544 00:42:22,760 --> 00:42:23,740 I appreciate it. 545 00:42:24,360 --> 00:42:27,520 So we did get a CDE for this one. 546 00:42:28,060 --> 00:42:30,900 First contact was like February 2024. 547 00:42:31,580 --> 00:42:33,920 We claimed the following. 548 00:42:34,400 --> 00:42:37,060 Ultimately assigned a medium, which I think is accurate. 549 00:42:37,060 --> 00:42:38,100 I have no problem with that. 550 00:42:38,100 --> 00:42:42,900 In this case, it's a different CWE because this unit actually did have seed key exchange. 551 00:42:42,900 --> 00:42:44,740 It did have an authentication mechanism. 552 00:42:44,820 --> 00:42:47,760 In the past, the CWE was complete lack of authentication. 553 00:42:47,760 --> 00:42:49,440 In this case, it's broken authentication. 554 00:42:50,260 --> 00:42:56,080 There was also an ICSA advisory that was released right at the top of the year regarding this. 555 00:42:56,820 --> 00:42:59,400 So the impacts are a bit nuanced. 556 00:42:59,400 --> 00:43:08,640 The good news, as I mentioned, is the seed key routine that we have reverse engineered and that an attacker could easily reverse engineer is only capable of doing diagnostic actions. 557 00:43:09,080 --> 00:43:18,620 It isn't capable of entering any of those other security levels, which are probably, and this is just conjecture, no one has told me, probably like a bootloader or field service or engineering functions. 558 00:43:18,620 --> 00:43:23,020 And usually those things are much higher privileged and you're able to do bad things in those levels. 559 00:43:23,020 --> 00:43:23,920 So this is good news. 560 00:43:23,920 --> 00:43:25,760 That seed key routine is limited. 561 00:43:25,780 --> 00:43:26,540 Excellent. 562 00:43:27,040 --> 00:43:30,360 There is some bad news. 563 00:43:30,700 --> 00:43:43,540 In the disclosure process with CISA and with the supplier, the supplier did confirm that the diagnostic software security level is sufficient to cause denial of service of the firmware, even though it's still a safe state. 564 00:43:43,540 --> 00:43:49,140 So this is not terrible news, but still that level is bad enough in some ways. 565 00:43:50,920 --> 00:44:02,440 And of course, because the diagnostic function by itself alone is good enough to do solenoid control, everything we talked about before is still possible. 566 00:44:02,440 --> 00:44:09,680 So the really good news here and why this is like a talk and not a, you know, behind closed doors, never talk about a kind of thing. 567 00:44:10,060 --> 00:44:12,240 This doesn't scale to arbitrary units. 568 00:44:12,240 --> 00:44:23,160 The NMFDA probably would have never talked about this if this was like we could predict the seed on every trailer in the world and unlock them, because that would be a really , really bad thing that would need to be fixed without talking about it. 569 00:44:23,260 --> 00:44:26,620 In this case, we were able to obtain four different units. 570 00:44:26,800 --> 00:44:29,820 These things are expensive and they're deployed pretty heavily. 571 00:44:30,260 --> 00:44:33,860 And four was about as much as the resources that we have could get. 572 00:44:33,860 --> 00:44:37,160 In all four of the cases, they had different build dates. 573 00:44:37,880 --> 00:44:43,280 Two of them had the same firmware on them, but in all four cases, they had a different first seed. 574 00:44:43,280 --> 00:44:45,140 And this is not the real first seeds. 575 00:44:46,540 --> 00:44:48,620 There are some limitations to this good news. 576 00:44:48,620 --> 00:44:57,980 Like, we don't know for sure how uniformly distributed those first seeds are in the 16-bit space. 577 00:44:57,980 --> 00:44:59,440 It's only 16-bit numbers. 578 00:44:59,440 --> 00:45:01,420 There's 65,000 possible numbers. 579 00:45:01,420 --> 00:45:04,900 There's way more than 65,000 of these units on the road. 580 00:45:05,580 --> 00:45:10,000 And even if they had them perfectly uniformly distributed, it's still not a great answer. 581 00:45:10,000 --> 00:45:16,680 We're also not equipped to obtain 1,000 units and test 1,000 units and decide how well-spaced that is. 582 00:45:16,680 --> 00:45:19,200 We feel the vendor has access to the firmware. 583 00:45:19,200 --> 00:45:20,380 They should be able to do that. 584 00:45:20,500 --> 00:45:22,220 Reverse engineering would answer this question. 585 00:45:22,220 --> 00:45:25,840 We're not going to proceed with reverse engineering to answer that question. 586 00:45:25,840 --> 00:45:30,680 We feel that it's the responsibility of the vendor to decide how uniformly distributed that is. 587 00:45:33,480 --> 00:45:35,840 And yeah, this isn't just about a blind attack, right? 588 00:45:35,840 --> 00:45:41,040 Remember, we did the blind attack so it was the minimum possible equipment for wireless access. 589 00:45:41,280 --> 00:45:47,120 We wanted to demonstrate that it's not true that any replay protection saves you from this wireless attack. 590 00:45:47,120 --> 00:45:51,700 It's possible that your replay protection is also broken and can be reduced to this attack. 591 00:45:51,700 --> 00:46:01,920 But remember that these trailer units are connected to a data bus and people are adding things to the data bus all the time, including telematics units. 592 00:46:01,920 --> 00:46:11,020 There's four different suppliers of internet-connected trailer telematics that do active diagnostics of the ECUs. 593 00:46:11,020 --> 00:46:22,240 These telematics units are capable of writing and reading Powerline and they're being connected to this bus that has ECUs whose security access controls are equivalent to y equals mx plus b, right? 594 00:46:22,240 --> 00:46:27,060 So the problem here isn't just the CVE, it's a more systematic one. 595 00:46:27,060 --> 00:46:36,580 And I'm not sure that you could even get a CVE for the security access being linear because we all kind of know there are many linear security access routines out there. 596 00:46:36,580 --> 00:46:45,360 So the point is that people should be careful about the software they're putting into their telematics systems and deploying on these very vulnerable networks. 597 00:46:45,360 --> 00:46:52,060 It's very akin to the early days of automotive and the early days of trucking CAN bus stuff. 598 00:46:52,220 --> 00:46:53,540 So we've been busy. 599 00:46:53,760 --> 00:46:55,580 We did the coordinated disclosure. 600 00:46:55,580 --> 00:46:56,580 These things take time. 601 00:46:56,580 --> 00:46:58,420 I'm sure you're all familiar with that. 602 00:46:58,880 --> 00:47:11,400 We've also been working in ATATMC, which is the Technical Maintenance Council of the American Trucking Association, to make sure that security requirements were captured in all the documents they produced for the next generation interface. 603 00:47:11,400 --> 00:47:15,800 So today we have this Powerline connection in the near future. 604 00:47:15,800 --> 00:47:16,480 I hope. 605 00:47:16,480 --> 00:47:17,720 They've been saying this for years. 606 00:47:17,720 --> 00:47:24,040 In the near future, we're going to have a CAN bus connection and possibly automotive Ethernet between the trucks and the trailers. 607 00:47:24,040 --> 00:47:29,200 And if you look at the ATATMC documentation that's produced, there is security requirements in it. 608 00:47:29,200 --> 00:47:32,200 And we hope that SAE looks at those. 609 00:47:33,280 --> 00:47:46,820 We have gone back to SAE's Truck and Bus Committee and petitioned them to reopen the standard for J2497 and to include mitigations against these wireless attacks in a reissuing of the J2497 standards. 610 00:47:46,820 --> 00:47:57,220 So that when the next interface comes up, the people that actually implement the next interface have to refer to the new version and then they have to, not have to, but they should follow the recommendations that will include defenses. 611 00:47:57,220 --> 00:47:59,680 The Truck and Bus Committee did agree to reopen it. 612 00:47:59,680 --> 00:48:05,360 There has been two different discussions of document changes that we proposed in two different quarterly meetings. 613 00:48:05,360 --> 00:48:07,720 So we feel that's moving forward in a good way. 614 00:48:07,720 --> 00:48:08,940 These things take time. 615 00:48:09,480 --> 00:48:11,840 We have also published proof of concept mitigation. 616 00:48:11,840 --> 00:48:25,260 The J2497 keyhole code is available on GitHub and that's functional Python code that, you know, you're not going to run Python code in your trucks, but it demonstrates that you can generate these signals that deny access to the bus. 617 00:48:25,680 --> 00:48:37,160 And we proved that those signals can be done with bit banging, which means if you're a supplier and you want to protect trailers by deploying something on a truck, you can do that with a microcontroller and a GPIO and a capacitor. 618 00:48:37,540 --> 00:48:40,160 We gave you the software to do that . 619 00:48:40,200 --> 00:48:42,340 It's not going to take a lot to protect a trailer. 620 00:48:42,340 --> 00:48:45,920 It's just a little bit of deployment of some more code. 621 00:48:45,920 --> 00:48:47,420 Blind code, in fact. 622 00:48:47,940 --> 00:49:00,540 And of course, we updated the telematic security requirements, which we published to apply to all trailer telematics because people are putting telematics on trailers and these trailer units are not well protected against these kind of attacks. 623 00:49:01,300 --> 00:49:05,620 So in conclusion, these timing attacks are generally applicable. 624 00:49:05,620 --> 00:49:06,880 It's not just CAN. 625 00:49:06,940 --> 00:49:08,980 You can do this in all kinds of weird places. 626 00:49:08,980 --> 00:49:14,640 If you want to know more about the CAN stuff, I highly recommend reading Sagar's paper, CANDAN. 627 00:49:14,820 --> 00:49:21,320 If you're going to be assessing time dependence of seeds, you have to make sure that you have very jitter-free timing. 628 00:49:21,840 --> 00:49:22,200 Right? 629 00:49:22,200 --> 00:49:27,700 If it is a time-dependent seed and you actually have jitter in your timing, you might not know that it's time-dependent. 630 00:49:27,700 --> 00:49:30,540 You need to have very reliable timing to be sure about that. 631 00:49:30,680 --> 00:49:32,160 Scapi Automotive is awesome. 632 00:49:32,260 --> 00:49:33,500 I think that's the conclusion. 633 00:49:33,500 --> 00:49:34,600 I hope you agree. 634 00:49:34,940 --> 00:49:41,080 And we found some novel ways to use, you know, previous J2497 stuff to make this happen. 635 00:49:42,020 --> 00:49:45,100 Here is the QR code for the white paper. 636 00:49:45,620 --> 00:49:49,500 It should be free to access without, like, a paywall or a login wall or anything. 637 00:49:50,000 --> 00:49:51,920 All the code is copy and pasteable. 638 00:49:51,920 --> 00:49:53,660 My contact information is there. 639 00:49:53,660 --> 00:49:55,120 This is the email of my boss. 640 00:49:55,120 --> 00:49:59,160 If you don't like anything I said, you can tell him that I shouldn't have said it. 641 00:49:59,340 --> 00:50:02,540 And I really do appreciate your attention to this matter. 642 00:50:02,560 --> 00:50:03,720 Thank you for your time today. 643 00:50:08,700 --> 00:50:09,600 Thank you. 644 00:50:10,800 --> 00:50:16,300 If there is a couple questions, but I am going to run to a CTF otherwise. 645 00:50:19,500 --> 00:50:19,940 Okay. 646 00:50:20,100 --> 00:50:20,600 Thank you. 647 00:50:20,600 --> 00:50:21,300 Thank you very much. 648 00:50:21,300 --> 00:50:21,980 Bye, everybody.