1 00:00:00,000 --> 00:00:05,580 Great. Let's go ahead and get started here. About me, my name is BitBane. I also go by Tim 2 00:00:05,580 --> 00:00:11,640 occasionally. I am a largely recovered software developer. I started my career doing a lot of 3 00:00:11,640 --> 00:00:19,460 safety critical aerospace and automotive embedded systems. Came over to security about three 4 00:00:19,460 --> 00:00:25,800 years ago. And apparently, as you'll discover through this talk, I enjoy looking at bad 5 00:00:25,800 --> 00:00:33,900 situations and going, how can I make this worse? I work with a company called Grim. Grim does 6 00:00:33,900 --> 00:00:38,380 not take this view of making things worse all the time. We actually try to help people. We're a 7 00:00:38,380 --> 00:00:43,500 cybersecurity research development company located in Arlington, Virginia. As a company, we do 8 00:00:44,100 --> 00:00:52,940 most aspects of cybersecurity between our various teams. We're going to do a little bit of 9 00:00:52,940 --> 00:00:55,780 overview. We're going to talk about what is CAN bus. We're going to start with the 10 00:00:55,800 --> 00:01:02,260 basic, high-level Wikipedia overview of how CAN bus works. And then we're going to dive into how 11 00:01:02,260 --> 00:01:09,140 CAN bus works at much greater detail than you typically get, typically need to know. Because 12 00:01:09,140 --> 00:01:14,440 all the low-level details are handled by an onboard CAN peripheral. And then we're going to 13 00:01:14,440 --> 00:01:23,920 talk about what we did this time. A little bit of history. CAN bus was developed by Bosch. It was 14 00:01:25,800 --> 00:01:33,400 released in 1990. The latest version, version 2.0, was released in 1991. It is a fairly old 15 00:01:33,400 --> 00:01:37,800 standard. And like many fairly old standards, when they developed it, they weren't really 16 00:01:37,800 --> 00:01:43,100 thinking about how to incorporate cybersecurity best practices, because there was no such thing 17 00:01:43,100 --> 00:01:49,140 back then. The first production vehicle was in 1991. This here is patient zero, the 1991 18 00:01:49,140 --> 00:01:55,780 Mercedes Benz W140. ISO 11898 is the set of ISO specs for the CAN bus. And this is the 19 00:01:55,800 --> 00:02:07,820 ISO specs that define CAN bus for automotive. So why do the car manufacturers love CAN bus so 20 00:02:07,820 --> 00:02:14,020 much and put it everywhere they possibly can? A lot of it, it's cheap. It's really cheap. 21 00:02:14,180 --> 00:02:19,800 Nearly any microcontroller you buy will have a CAN peripheral built into it, because it's cheap. 22 00:02:19,880 --> 00:02:25,780 Why not? It's reliable. If you don't ignore it, if you ignore it or don't use it, it's 23 00:02:27,400 --> 00:02:30,620 going to cost a lot of money to build. Plus it's really reliable. It's designed from the 24 00:02:30,620 --> 00:02:35,420 ground up to be extremely reliable to environmental noise. It's used in a lot of situations, 25 00:02:35,700 --> 00:02:40,260 like a building automation or some industrial applications where there's a lot of 26 00:02:40,260 --> 00:02:45,220 electromechanical noise going on. It's designed to be very reliable for that. And oh yeah, by 27 00:02:45,220 --> 00:02:50,580 the way, it's been mandated by law since 2008. Turns out a good way to get the OEMs to do 28 00:02:50,580 --> 00:02:55,760 something is to say you cannot sell your cars unless you do the thing. It's mandated, but you can't 29 00:02:55,760 --> 00:03:06,080 40 CFR 86 1806-05. That mandates that all the cars have to follow the ISO spec 15765-4. 30 00:03:06,700 --> 00:03:11,980 Rolled vehicle diagnostics on controller area network. This is required for your emissions 31 00:03:11,980 --> 00:03:17,460 related system. So any of you who live in a state that mandates that you do emissions tests, 32 00:03:17,720 --> 00:03:22,060 this is so that they can basically do those emissions tests more easily. They just have one 33 00:03:22,060 --> 00:03:26,240 tool, they plug in an OBD2 port, regardless of tool, and it can go in and make sure that all 34 00:03:26,240 --> 00:03:31,840 your emissions stuff is reporting that it is up to snuff. As I mentioned, CAN bus is used quite 35 00:03:31,840 --> 00:03:38,080 extensively outside of automobiles. It's used a lot in some aviation areas, like I mentioned 36 00:03:38,080 --> 00:03:45,740 building automation, some industrial control type applications as well. Those often use a 37 00:03:45,740 --> 00:03:50,380 different physical layer. There's quite a few different physical layers that CAN bus 38 00:03:50,380 --> 00:03:52,040 controls. So you can see here, you can see that the CAN bus is using a different physical layer. 39 00:03:53,040 --> 00:04:03,960 We're going to focus on ISO 11898-2. Which is the spec that the CAN bus uses in an automobile. 40 00:04:06,060 --> 00:04:14,100 So the way that ISO 11898-2, the physical layer works, is you have this diagram here of a CAN 41 00:04:14,100 --> 00:04:20,440 bus. So we have bits going across the bus. CAN bus uses differential signaling. So anywhere you 42 00:04:20,440 --> 00:04:27,660 see that the voltages are the same on the two lines, that is an area that's transmitting a 43 00:04:27,660 --> 00:04:33,960 recessive bit, which is interpreted as a one. And here, where there are different voltages, that's a 44 00:04:33,960 --> 00:04:40,020 dominant bit, which is interpreted as a zero. This is the signaling across the lines on the 45 00:04:40,460 --> 00:04:46,220 actual wires that run through your car. This is what they carry. Those come into a CAN transceiver. 46 00:04:46,440 --> 00:04:50,420 And all the CAN transceiver really does is it takes this data, there's more than a hundred tons,enta, 47 00:04:50,440 --> 00:04:56,740 signaling and outputs your standard digital logic signal for your microcontroller to 48 00:04:56,740 --> 00:05:01,420 interface with. There's generally not really much in the way of smarts in a CAN transceiver. 49 00:05:01,960 --> 00:05:07,520 Some will do things like if you transmit a dominant state for too long, they'll shut off for 50 00:05:07,520 --> 00:05:13,420 you. But they don't really generally do a whole lot in terms of logic. If I'm sending a one, it 51 00:05:13,420 --> 00:05:17,420 leaves the output of the recessive voltage I'm receiving. If I'm sending a zero, it puts the 52 00:05:17,420 --> 00:05:29,780 output at a dominant voltage and does the opposite for any signals that it receives. So 53 00:05:29,780 --> 00:05:34,620 that's how the physical layer works. And as we'll get to later, something that's important to 54 00:05:34,620 --> 00:05:42,240 keep in mind is that any time that you're, one of the core fundamental principles of CAN bus is 55 00:05:42,240 --> 00:05:47,400 that if any node on the bus is sending a zero signal, it will send a zero signal to the 56 00:05:47,420 --> 00:05:50,860 bus. If any node is sending a zero sending this dominant voltage, then that will be the state of 57 00:05:50,860 --> 00:05:56,020 the bus. So if any node is sending a dominant, the bus will be in a dominant state. The only time 58 00:05:56,020 --> 00:06:00,960 the bus will be in a recessive state is if every node on the CAN bus is sending the recessive 59 00:06:00,960 --> 00:06:11,360 state, sending a one to the bus. This is what a CAN message looks like, a CAN frame. You have a 60 00:06:11,360 --> 00:06:17,400 start of frame, which is a zero. So CAN in an idle state is a one of the recessive state. So if you're 61 00:06:17,420 --> 00:06:21,080 sending a zero, as soon as somebody wants to start sending a message, you have the start of 62 00:06:21,080 --> 00:06:26,880 frame. So we'll start transmitting a zero. Then you have this arbitration field. This message is 63 00:06:26,880 --> 00:06:32,160 the, for an 11-bit arbitration field. This is generally more common in automotive. There's also a 64 00:06:32,160 --> 00:06:37,720 variation that has a 29-bit arbitration field. And the difference there is that this ID extended 65 00:06:37,720 --> 00:06:44,240 bit, instead of a zero, is a one. And then after that one, you have the other 18 bits of the 66 00:06:44,240 --> 00:06:47,400 arbitration ID plus two reserved bits instead of a zero. So you have a zero. So you have a zero. 67 00:06:47,420 --> 00:06:52,780 Instead of just one. But for all intents and purposes, you can, they're very similar. And 68 00:06:52,780 --> 00:06:57,720 they can operate with each other. You can have both 29-bit and 11-bit identifiers on the same 69 00:06:57,720 --> 00:07:06,960 CAN bus because you can look at this ID extension bit and know which length identifier it is. 70 00:07:08,760 --> 00:07:13,240 They have a length field. They have four bits for a length field. The maximum length of a CAN 71 00:07:13,240 --> 00:07:17,360 frame is eight bytes. And we'll talk slightly about why that can be somewhat 72 00:07:17,360 --> 00:07:24,940 problematic for some security applications in a little bit. You then have your one to eight 73 00:07:24,940 --> 00:07:32,320 bytes of data that you're sending. It computes a 15-bit CRC. It's sort of a weird CRC, but it was 74 00:07:32,880 --> 00:07:38,200 chosen, it will always detect any single bit error and is really good at detecting like two and 75 00:07:38,200 --> 00:07:43,400 three bit errors as well. So this plays into why CAN is so reliable. It is very good at 76 00:07:43,400 --> 00:07:47,340 detecting if a bit was flipped at some point. Due to, like, you know, if you're using a lot of data, 77 00:07:47,360 --> 00:07:53,200 you're going to have a little bit of noise or whatever the case may be. CRC delimiter, just a 78 00:07:53,200 --> 00:07:58,420 recessive at the end of the CRC to indicate the end of the CRC. Then you have this 79 00:07:58,420 --> 00:08:07,040 acknowledgement slot. So what the acknowledgement slot is used for is any time a node on the bus 80 00:08:07,040 --> 00:08:12,840 properly receives a message. So it's the right length, has the right CRC, everything about it 81 00:08:12,840 --> 00:08:17,200 looks good, it will send a dominant here in the acknowledgement slot. And 82 00:08:17,360 --> 00:08:21,480 whoever transmitted the message listens to this acknowledgement slot to make sure that at least one 83 00:08:21,480 --> 00:08:26,060 node acknowledges that it received the message. Otherwise you'll get an acknowledgement error if 84 00:08:26,060 --> 00:08:29,800 nobody acts the message, you'll get an acknowledgement error. And we'll talk about CAN's 85 00:08:29,800 --> 00:08:36,380 error handling when we dive into CAN a little bit more deeply. Then you have the act delimiter. You 86 00:08:36,380 --> 00:08:42,320 have a seven bit end of frame and at least three more recessive bits after the end of frame as an 87 00:08:42,320 --> 00:08:47,280 inner frame spacing. Then once all this is done, the bus will stay idle until another 88 00:08:47,360 --> 00:08:55,260 node decides it wants to transmit on the bus. So I mentioned the arbitration ID before. And the 89 00:08:55,260 --> 00:09:02,740 arbitration ID is how the CAN bus determines who's allowed to talk on the bus. So as I mentioned 90 00:09:02,740 --> 00:09:08,520 before, one of the features, one of the core fundamental things that CAN believes about how the 91 00:09:08,520 --> 00:09:14,180 world works is that if any node on the bus is sending a dominant, then the bus state will be a 92 00:09:14,180 --> 00:09:17,340 dominant. So if you have node A and node B on the bus, if you have node A and node B on the bus, 93 00:09:17,840 --> 00:09:22,380 they both send a start bit at the same time. So they're not going to know at that point that 94 00:09:22,380 --> 00:09:26,400 somebody else is transmitting because they're sending a dominant bit. They're seeing a dominant 95 00:09:26,400 --> 00:09:30,500 bit on the bus. So they assume that it's their dominant bit that's making the bus in the 96 00:09:30,500 --> 00:09:36,020 dominant state. And it will continue while it sends the arbitration ID until one of the nodes 97 00:09:36,020 --> 00:09:40,980 sends a one when the other node is sending a zero. As soon as a node sees that, hey, I'm 98 00:09:40,980 --> 00:09:46,920 sending a one, but because somebody else is asserting a dominant state on the bus, that node 99 00:09:46,920 --> 00:09:53,160 has the higher priority and will get access to the bus. So node B will drop out here and node A 100 00:09:53,160 --> 00:09:57,360 will continue with its arbitration ID. And what you'll actually see on the CAN bus if you're not 101 00:09:57,360 --> 00:10:04,260 node A or node B is the arbitration ID sent by node A. So that's how CAN ensures that people 102 00:10:04,260 --> 00:10:16,840 aren't stepping on each other on the bus, how it does its bus arbitration. Now to dive a little bit 103 00:10:16,840 --> 00:10:24,520 more deeply into how CAN bus does its error handling and et cetera. So CAN was designed to be 104 00:10:24,520 --> 00:10:31,020 resilient to transient errors. Like I mentioned, electrical noise, just stuff that happens 105 00:10:31,020 --> 00:10:37,640 because digital signaling is a lie we pretend to tell ourselves about how analog signaling works. 106 00:10:39,280 --> 00:10:46,440 CAN has five different error detection mechanisms. It can detect bit errors, stuff errors, CRC 107 00:10:46,440 --> 00:10:51,800 errors, form errors, and acknowledgment errors. Bit errors are only detected by a transmitter. 108 00:10:52,020 --> 00:10:57,520 So a bit error happens when a transmitter has one arbitration, so it knows it has access to the 109 00:10:57,520 --> 00:11:03,420 bus, and it is sending a specific bit on the bus, but the state that it reads back from the bus is 110 00:11:03,420 --> 00:11:08,160 the opposite state. It's sending a recessive and it sees a dominant or vice versa. That will be a 111 00:11:08,160 --> 00:11:16,420 bit error. And that will cause the transmitter to send an error frame and go into CAN's error 112 00:11:16,440 --> 00:11:21,180 handling. This will be detected by the transmitter, of course, because anybody receiving won't know 113 00:11:21,180 --> 00:11:27,560 what the state of the bus is supposed to be. Then you have stuff errors. Another feature that CAN bus 114 00:11:27,560 --> 00:11:33,200 uses to increase its resiliency is something called bit stuffing. And how bit stuffing works is 115 00:11:33,200 --> 00:11:38,740 that with a couple exceptions for a couple of the fields, if you send more than, if you're going to 116 00:11:38,740 --> 00:11:44,020 send more than five bits in a row that are the same, either dominant or recessive, after you send 117 00:11:44,020 --> 00:11:46,420 the fifth bit, you're supposed to send one or more bits in a row that are dominant or recessive. 118 00:11:46,440 --> 00:11:50,860 So you're sending one bit of the opposite, one opposite bit. So recessive, you're sending 119 00:11:50,860 --> 00:11:55,780 dominance and vice versa. This indicates, basically prevents the bus from going into a DC 120 00:11:55,780 --> 00:12:01,480 state where the receiver is going, am I actually still receiving something, or did the other node 121 00:12:01,480 --> 00:12:06,860 just die and is done now. So it does bit stuffing to make sure, it also helps keep clocks 122 00:12:06,860 --> 00:12:13,340 synchronized. If clocks drift a little bit on different nodes, it does re-clock on each edge that 123 00:12:13,340 --> 00:12:16,040 it receives. So it does a bit of that, but it also helps keep the clock synchronized. If the clock 124 00:12:16,040 --> 00:12:16,420 drifts a little bit on different nodes, it does re-clock on each edge that it receives. And it 125 00:12:16,440 --> 00:12:21,160 also helps make sure that your clocks don't drift too far apart from each other so you're still 126 00:12:21,160 --> 00:12:26,820 able to properly receive a message. So any time that a node sees that the bus has been in the same 127 00:12:26,820 --> 00:12:32,320 state for longer than five bits, that is a stuff error and it will then also go into CAN's error 128 00:12:32,320 --> 00:12:38,500 handling functionality. CRC error, CRC, if the CRC doesn't check out, then that will also cause 129 00:12:38,500 --> 00:12:46,360 an error to happen. Form error, form error is what happens if some of the fixed form field 130 00:12:46,440 --> 00:12:51,400 errors occur. So these three bits, the CRC delimiter, the ACK delimiter, or the ACK slot, if 131 00:12:51,400 --> 00:12:57,660 that isn't right, like if you end up seeing a zero in the ACK delimiter, that would be a form 132 00:12:57,660 --> 00:13:03,240 error because that's not how it's supposed to be. And the last error, like I mentioned before, is 133 00:13:03,240 --> 00:13:08,140 the acknowledgement error. If you send a message but nobody ACKs your message on the bus, then 134 00:13:08,140 --> 00:13:16,420 that will cause an acknowledgement error to occur. There are three other CAN files that are 135 00:13:18,340 --> 00:13:23,480 in the CAN bus. There's a remote frame and how a remote frame works is it's basically a node on the 136 00:13:23,480 --> 00:13:28,620 CAN bus saying, hey, whoever sends this arbitration ID, which is the arbitration ID that it tries to 137 00:13:28,620 --> 00:13:34,880 send on the bus, go ahead and send the data that you have. I've never actually seen a remote frame 138 00:13:34,880 --> 00:13:42,440 used in automotive. But it's a feature of the bus. There's also error frames. I'll get into more 139 00:13:42,440 --> 00:13:46,420 into error frames and overload frames and how they work. So the next slide. 140 00:13:48,240 --> 00:13:54,940 So there's two types of error frames. And we'll get into how CAN gets into its three error states in a 141 00:13:54,940 --> 00:14:00,460 couple of slides. But there's an active error. And if a bus is in the active error state, that 142 00:14:00,460 --> 00:14:05,480 means that basically it hasn't seen very many errors. And it will, whenever it detects an error 143 00:14:05,480 --> 00:14:11,600 on the bus, will send out six dominant bits. But of course, six dominant bits, that violates bit 144 00:14:11,600 --> 00:14:16,120 stuffing because it has more than five bits in a row that are the same. So all the other nodes on 145 00:14:16,120 --> 00:14:21,000 the bus will also start sending out error frames because of the bit stuffing error. So you'll end 146 00:14:21,000 --> 00:14:28,120 up with between six and 12 dominant bits on the bus, depending on exactly when, you know, what bits 147 00:14:28,120 --> 00:14:32,040 you were sending before the error frame and how long it takes for the other nodes on the bus to 148 00:14:32,040 --> 00:14:37,900 notice that there was a stuff error, essentially. When you're in the passive error state, then 149 00:14:37,900 --> 00:14:42,160 you'll send six recessive bits on the bus. And we'll talk about how that's used as part of CAN's 150 00:14:42,160 --> 00:14:46,100 error recovery as well. And then after you send out six dominant bits on the bus, you'll send six 151 00:14:46,120 --> 00:14:51,560 recessive bits. You send out your error frame, the six or 12 dominant bits, or the six recessive 152 00:14:51,560 --> 00:14:57,740 bits. You send out eight more recessive bits, essentially, to leave the bus in the idle state 153 00:14:57,740 --> 00:15:07,460 for a period of eight bits. Overload frames, I have had some fun with overload frames on this. So 154 00:15:07,460 --> 00:15:12,860 the intention behind an overload frame is that if you have a slower microcontroller on the bus, 155 00:15:12,980 --> 00:15:16,100 that needs a little bit more time to process a message. And that's because it's a little bit more 156 00:15:16,120 --> 00:15:20,000 time consuming. So it can send an overload frame in order to just kind of delay processing of CAN 157 00:15:20,000 --> 00:15:26,220 messages for a short period of time. And six dominant bits followed by eight recessive bits. It's 158 00:15:26,220 --> 00:15:30,800 sent during the intermission, which is the three recessive bits after the end of frame, that first 159 00:15:30,800 --> 00:15:35,440 three-bit interframe spacing that you saw on the previous slide. That is where the overload frame 160 00:15:35,440 --> 00:15:43,940 is sent if a node is sending the overload frame. According to the spec, it says at most two 161 00:15:43,940 --> 00:15:46,100 overload frames may be generated. So that's where the overload frame is sent. So that's the first 162 00:15:46,100 --> 00:15:51,160 point. It doesn't say anything about what to do if you generate more than two overload frames. 163 00:15:54,280 --> 00:16:01,980 This is how CAN does its error recovery. It uses error counters to do fault confinement. There's two 164 00:16:01,980 --> 00:16:06,240 error counters, the transmit error counter, which is the error counter that your node, your CAN 165 00:16:06,240 --> 00:16:11,200 peripheral will use if it's transmitting something and gets an error. And the receive error counter, 166 00:16:11,320 --> 00:16:16,080 which is the error counter that it will use if it was receiving something and saw an error. So that's 167 00:16:17,120 --> 00:16:23,320 the error. So there's three error states. There's error active. And when you're in error active is 168 00:16:23,320 --> 00:16:29,380 the default state. It's what you're in when your error counter is less than 128. So you haven't 169 00:16:29,380 --> 00:16:34,500 seen any errors, haven't seen very many errors. And that is the state where you'll send the active 170 00:16:34,500 --> 00:16:42,080 error frames if you do see an error. Once your error counter has gone over 128, then you'll move 171 00:16:42,080 --> 00:16:45,960 into the error passive state. And the error passive state is where you send the passive error 172 00:16:46,100 --> 00:16:51,080 frame. The idea here is that if you're a node on the CAN bus and you're seeing a lot of errors, 173 00:16:51,620 --> 00:16:58,560 it's possible that actually you're the problem, not somebody else. So in order to, so you'll stop 174 00:16:58,560 --> 00:17:02,960 stomping on the CAN bus every time you see an error and send that active error frame. And you'll 175 00:17:02,960 --> 00:17:10,140 go into error passive state where you'll check to see if, basically if you get recessive bits on 176 00:17:10,140 --> 00:17:15,000 the bus to tell you whether or not something else is happening on the bus. Once your error counter 177 00:17:15,000 --> 00:17:16,080 has gone to 128, then you'll move into the error passive state. Once your error counter has gone to 178 00:17:16,100 --> 00:17:20,620 over 256, then you go into the bus off state. And in the bus off state, you're supposed to 179 00:17:20,620 --> 00:17:26,980 completely stop participating in the CAN bus entirely until you either reset or get 128 180 00:17:26,980 --> 00:17:34,780 occurrences of 11 consecutive recessive bits. So you can recover that way if the bus stays quiet 181 00:17:34,780 --> 00:17:40,800 for a while. But CAN buses often don't. You know, vehicle CAN buses are often very, very 182 00:17:40,800 --> 00:17:46,080 chatty. And the way that the error counters get incremented, there's, you know, there's a lot of 183 00:17:46,080 --> 00:17:52,560 edge cases in the spec. And I'm not going to go over all of them. But in general, on a receive 184 00:17:52,560 --> 00:17:56,900 error, you'll increment the counter by one for every time you get a receive error. And you also 185 00:17:56,900 --> 00:18:00,860 decrement by one every time you successfully receive a message. That's how you can move from 186 00:18:01,330 --> 00:18:05,620 error passive back to error active. If it's going to start working properly, then you'll go back 187 00:18:05,620 --> 00:18:12,880 into the error active state. On a transmit error, though, you increase your error counter by eight 188 00:18:12,880 --> 00:18:16,060 for every time you receive a transmit error in order to kickstart the error counter. So that's a lot of 189 00:18:16,060 --> 00:18:19,540 things you can do to kick a transmitter off the bus. Because a transmitter that's behaving poorly 190 00:18:19,960 --> 00:18:28,960 is going to be more problematic than a receiver that's behaving poorly. And that's how CAN does 191 00:18:28,960 --> 00:18:40,320 its error handling and error recovering. One of my, another of my favorite parts of the CAN 192 00:18:40,320 --> 00:18:45,260 specification is this quote here. It is in the nature of the MAC sublayer that there is no freedom 193 00:18:45,260 --> 00:18:53,460 for modifications. Well, what if I want to modify some of these things? CAN is essentially based on 194 00:18:53,460 --> 00:18:57,500 the premise that every node on the bus, everything that's connected to the CAN bus will behave the 195 00:18:57,500 --> 00:19:04,780 way that it's supposed to behave all the time. Sometimes you really don't want your tools to 196 00:19:04,780 --> 00:19:08,840 behave nicely. Sometimes you want them to do things they're not supposed to do. Wouldn't it just be 197 00:19:08,840 --> 00:19:15,240 so nice if somebody would make something like that? . . . . . . . . . . . . . . . . . . . . . 198 00:19:15,260 --> 00:19:21,300 . . So existing research tools, like we have a tool we opened talking 199 00:19:21,300 --> 00:19:27,620 the CAN cat, Eric Uvanchik is, he's here somewhere and has written tools, the CAN tact. A 200 00:19:27,620 --> 00:19:32,160 bunch of tools that are all written using a standard CAN peripheral. It's something that's baked 201 00:19:32,160 --> 00:19:39,640 into silicon on a microcontroller that will behave the way it's supposed to behave. As far as 202 00:19:39,640 --> 00:19:44,480 using, as far as like the error recovery, error detection, stopping transmitting when it's supposed 203 00:19:44,480 --> 00:19:45,240 to stop transmitting again. So, I provided for the machine there's a lot of great applications to the 204 00:19:45,260 --> 00:19:50,880 transmitting, all that stuff. But we've had conversations with several people in the 205 00:19:50,880 --> 00:19:55,960 industry that there's been a need for a tool that doesn't have those restrictions on what it 206 00:19:55,960 --> 00:20:03,020 can do on the CAN bus. The final kick in the pants for me about a year ago, ICS alert 17-209-01 207 00:20:03,020 --> 00:20:09,240 was published. This ICS alert talked about essentially how you can do this sort of thing on 208 00:20:09,240 --> 00:20:17,060 the CAN bus. I remember one of my coworkers told me that when he was in college, one of his 209 00:20:17,060 --> 00:20:23,860 classmates pointed out this was a problem on CAN bus. So this isn't exactly news to anybody who 210 00:20:23,860 --> 00:20:30,180 understands CAN bus, but now we have an actual ICS alert we can point to and say, hey, CAN bus has 211 00:20:30,180 --> 00:20:36,240 some issues when it comes to security. Also tired of hearing that that can't happen. I got it 212 00:20:36,240 --> 00:20:38,940 more in aerospace, but that 213 00:20:39,240 --> 00:20:44,880 doesn't mean that the mindset that people can have that people aren't going to actively do 214 00:20:44,880 --> 00:20:50,900 malicious things in order to bypass the assumptions you've made about the system is a mindset 215 00:20:50,900 --> 00:20:57,580 that really has been bothering me for a while. So we built a tool called CANT. CANT is purpose 216 00:20:57,580 --> 00:21:04,020 built to selectively target an individual ECU by abusing the CAN specification. It's based on an 217 00:21:06,300 --> 00:21:09,220 STMicroNucleoH743ZI dev board. It's like a $20, $21, $20, $20, $20, $20, $20, $20, $20, $20, $20, 218 00:21:09,220 --> 00:21:16,000 dev board that you can actually get now. I gave this talk the first time at SchmooCon, and they 219 00:21:16,000 --> 00:21:22,300 were backordered on Mouser until April. So that was a little bit of a buzzkill. I just barely 220 00:21:22,300 --> 00:21:27,640 managed to get the two that I had before they were sold out. Currently supports five attacks. 221 00:21:28,120 --> 00:21:32,320 Denial of service attack, where it just targets all messages, essentially sends an arbitration 222 00:21:32,320 --> 00:21:37,220 ID of zero every time a node starts to transmit, so nobody else can actually talk on the bus 223 00:21:37,220 --> 00:21:39,200 because they will always lose arbitration. So that's a little bit of a buzzkill, but I think it's a 224 00:21:41,440 --> 00:21:44,860 little bit of a buzzkill. I can choose an arbitration ID and say, hey, instead of sending 225 00:21:44,860 --> 00:21:50,020 this data, send this data instead. And just ignore the other guy yelling at you for sending the 226 00:21:50,020 --> 00:21:54,820 data that you shouldn't be sending. Transmitting multiple overload frames. Something that's 227 00:21:54,820 --> 00:21:59,500 interesting about the overload frames is that they're generally not reported up to your 228 00:21:59,500 --> 00:22:05,360 software. The CAN peripheral just, oh, it's an overload frame. I'm going to ignore that. But 229 00:22:05,360 --> 00:22:09,180 they don't actually check to see if they get more than two overload frames. So, you know, it's 230 00:22:09,180 --> 00:22:12,420 a little bit of a buzzkill. So you can transmit overload frames. That doesn't even get reported up to 231 00:22:13,080 --> 00:22:18,840 the software that you're using. I also created a cyber paperclip mode and a knack attack that I'll 232 00:22:18,840 --> 00:22:25,760 talk about a little bit more in the demo videos that I have. So the advantages of CANT over a lot 233 00:22:25,760 --> 00:22:30,540 of the tools that we have right now is that we have complete control over signaling, including 234 00:22:30,540 --> 00:22:35,620 being able to force a recessive bit with the CANT shield that I made. We can follow the CANT 235 00:22:35,620 --> 00:22:39,160 spec as it suits us. Smith messages, as you would with the CANT shield. We can follow the CANT 236 00:22:39,160 --> 00:22:43,300 with the normal CANT peripheral. And then as soon as we want to start abusing the CANT spec, we can 237 00:22:43,300 --> 00:22:50,580 do that. If an ECU is giving you trouble, I've used CANT for this before. I'll just use CANT to knock 238 00:22:50,580 --> 00:22:56,480 a specific ECU offline so that it can stop interfering with what I'm trying to do. And it's 239 00:22:56,480 --> 00:23:01,080 more difficult to detect than packet injection. That's something they talked about in the paper 240 00:23:01,080 --> 00:23:08,120 that led to the ICS alert is using this sort of technique to evade car IDS and IPS type systems. 241 00:23:08,120 --> 00:23:14,300 Because you're as far as something sitting on the bus receiving is concerned, the bus is actually 242 00:23:14,300 --> 00:23:19,780 behaving properly. There's only the note that's transmitting knows that something is really going on 243 00:23:19,780 --> 00:23:30,240 often. I've got a demonstration that walks through the what we can do with CANT. 244 00:23:31,120 --> 00:23:37,740 For this demo, I'm using 3PO, our portable car hacking demo, to demonstrate some of the CAN attacks 245 00:23:37,740 --> 00:23:44,400 that we can do with two of the open source. Is that picking up at all? No? All right. 246 00:24:13,560 --> 00:24:20,920 One of those tools that Grim has developed, one of these tools is CANCAT. CANCAT is the tool that Grim has been 247 00:24:20,920 --> 00:24:28,360 developing for a few years now. It is an Arduino DUA with a CAN shield. It is more of your 248 00:24:28,360 --> 00:24:35,480 common car hacking tool. We use it for doing CAN bus packet injection, CAN bus sniffing. 249 00:24:37,120 --> 00:24:37,720 There's another tool that I've used. It's called CANCAT. It's about going through the 250 00:24:37,720 --> 00:24:42,660 The one disadvantage that CAN-CAT has, though, is it is built on top of a standard CAN peripheral. 251 00:24:42,880 --> 00:24:47,000 So it's limited in how badly we can misbehave with that. 252 00:24:47,080 --> 00:24:48,360 We'll demonstrate a little bit later. 253 00:24:48,800 --> 00:24:53,660 The other tool is the CANT tool that Graham recently released. 254 00:24:54,020 --> 00:25:00,360 CANT is a Nucleo H743ZI development board with a CAN transceiver wired to it. 255 00:25:00,520 --> 00:25:05,860 And we use that to essentially bitbang CAN over GPIO. 256 00:25:05,860 --> 00:25:11,200 This gives us complete control over the CAN messaging at the electrical level 257 00:25:11,200 --> 00:25:16,660 and allows us much greater control over what is going out on the CAN bus. 258 00:25:17,040 --> 00:25:23,780 We're going to start the demo by showing how to use CANT to act as a bus killer. 259 00:25:24,180 --> 00:25:29,320 What this attack does is any time any node on the bus tries to send a message, 260 00:25:29,540 --> 00:25:34,800 CANT will take over and send a message, a valid CAN message with an arbitration ID of zero. 261 00:25:35,240 --> 00:25:35,840 This... 262 00:25:36,380 --> 00:25:36,900 limits... 263 00:25:37,460 --> 00:25:38,480 effectively this... 264 00:25:39,260 --> 00:25:42,280 limits any other node from transmitting on the CAN bus. 265 00:25:42,620 --> 00:25:44,320 So we'll go ahead and set up that attack. 266 00:25:44,460 --> 00:25:45,360 Set the mod rate. 267 00:25:47,800 --> 00:25:51,740 And we'll go ahead and choose the bus killer attack. 268 00:25:52,040 --> 00:25:53,720 And we see that the... 269 00:25:53,720 --> 00:25:55,780 very quickly the brake fluid light pops up. 270 00:25:55,980 --> 00:25:57,520 The instrument cluster starts shutting down. 271 00:25:58,840 --> 00:26:01,880 Currently, nothing is able to transmit on this bus. 272 00:26:02,140 --> 00:26:03,460 We can come over here to the oscilloscope. 273 00:26:03,460 --> 00:26:05,060 The video is not working. 274 00:26:05,240 --> 00:26:06,020 We see... 275 00:26:06,020 --> 00:26:06,360 Oh wait, what? 276 00:26:06,580 --> 00:26:08,940 ...that we're sending out a valid CAN... 277 00:26:10,920 --> 00:26:11,940 ...is it not? 278 00:26:25,060 --> 00:26:27,160 I can't see where the main one is. 279 00:26:27,360 --> 00:26:28,040 ...is it... 280 00:26:29,780 --> 00:26:30,300 ...is it... 281 00:26:30,300 --> 00:26:30,520 ...is it... 282 00:26:31,180 --> 00:26:32,020 ...is it... 283 00:26:32,020 --> 00:26:32,340 ...is it... 284 00:26:32,340 --> 00:26:32,720 ...is it... 285 00:26:32,720 --> 00:26:32,760 ...is it... 286 00:26:32,760 --> 00:26:32,780 ...is it... 287 00:26:55,720 --> 00:26:59,920 For this demo, I'm using 3PO, our portable car hacking demo, 288 00:26:59,920 --> 00:27:07,320 to demonstrate some of the CAN attacks that we can do with two of the open source tools that Grim has developed. 289 00:27:07,660 --> 00:27:13,720 One of these tools is CanCat. CanCat is a tool that Grim has been developing for a few years now. 290 00:27:13,900 --> 00:27:21,180 It is an Arduino Due with a CAN shield. It is more of your common car hacking tool. 291 00:27:21,280 --> 00:27:26,300 We use it for doing CAN bus and packet injection, CAN bus sniffing. 292 00:27:28,000 --> 00:27:29,900 The one disadvantage of CAN... 293 00:27:29,920 --> 00:27:33,520 CanCat has those. It is built on top of a standard CAN peripheral. 294 00:27:34,010 --> 00:27:39,240 So it's limited in how badly we can misbehave with that. We'll demonstrate a little bit later. 295 00:27:39,930 --> 00:27:44,520 The other tool is the CANT tool that Grim recently released. 296 00:27:44,900 --> 00:27:51,180 CANT is a Nucleo H743ZI development board with a CAN transceiver wired to it. 297 00:27:51,670 --> 00:27:56,720 And we use that to essentially bitbang CAN over GPIO. 298 00:27:57,240 --> 00:27:59,900 This gives us complete control over the CAN. 299 00:27:59,920 --> 00:28:07,520 We can do CAN messaging at the electrical level and allows us much greater control over what is going out on the CAN bus. 300 00:28:08,200 --> 00:28:14,640 We're going to start the demo by showing how to use CANT to act as a bus killer. 301 00:28:15,020 --> 00:28:20,200 What this attack does is any time any node on the bus tries to send a message, 302 00:28:20,400 --> 00:28:25,600 CANT will take over and send a message, a valid CAN message, with an arbitration ID of zero. 303 00:28:26,060 --> 00:28:27,960 This limits... 304 00:28:27,960 --> 00:28:28,200 This... 305 00:28:28,200 --> 00:28:29,140 Effectively... 306 00:28:29,140 --> 00:28:29,320 This... 307 00:28:29,320 --> 00:28:29,900 This... 308 00:28:29,920 --> 00:28:33,160 Limits any other node from transmitting on the CAN bus. 309 00:28:33,520 --> 00:28:36,220 So we'll go ahead and set up that attack, set the baud rate. 310 00:28:38,760 --> 00:28:42,620 And we'll go ahead and choose the bus killer attack. 311 00:28:42,900 --> 00:28:44,560 And we see that the... 312 00:28:44,560 --> 00:28:46,700 Very quickly, the brake fluid light pops up. 313 00:28:46,860 --> 00:28:48,360 The disk block cluster starts shutting down. 314 00:28:49,780 --> 00:28:52,740 Currently, nothing is able to transmit on this bus. 315 00:28:52,980 --> 00:28:54,660 If we come over here to the oscilloscope... 316 00:28:55,920 --> 00:28:59,900 We see that we're sending out the valid CAN message. 317 00:28:59,920 --> 00:29:02,860 And if you deported this, it would be a completely valid message. 318 00:29:04,180 --> 00:29:09,340 But it's only sending this message whenever any other bus tries to send its own message, 319 00:29:09,420 --> 00:29:11,020 effectively killing the CAN bus. 320 00:29:11,960 --> 00:29:18,760 Now, the effect of this isn't all that much different than you'd get from jamming a paperclip into the CAN bus 321 00:29:18,760 --> 00:29:19,840 and shorting the two wires. 322 00:29:20,120 --> 00:29:24,720 The advantage of CANT's approach is that it does that same... 323 00:29:24,720 --> 00:29:29,900 It has that same effect without violating any of the rules of the CAN bus. 324 00:29:29,920 --> 00:29:34,260 This is a perfectly valid, properly functioning CAN bus, 325 00:29:34,560 --> 00:29:37,720 just nobody else is allowed to transmit on it. 326 00:29:39,660 --> 00:29:42,540 We'll go ahead and stop this attack from happening. 327 00:29:42,780 --> 00:29:46,340 See that the CAN bus goes back to normal on the oscilloscope. 328 00:29:49,020 --> 00:29:53,280 Next step is we're going to illustrate those differences I was talking about 329 00:29:53,280 --> 00:29:56,380 between how CAN-CAT works and how CANT works. 330 00:29:58,060 --> 00:30:03,560 So CAN-CAT is a tool we've been developing for a while. 331 00:30:03,640 --> 00:30:09,440 Like I mentioned, it runs on the Arduino Due with a CAN shield on it using a standard CAN peripheral. 332 00:30:09,960 --> 00:30:13,640 So it allows us to do things like just send a CAN packet. 333 00:30:14,020 --> 00:30:19,440 What this CAN packet that I'm about to send does is it causes the brake fluid low light to come off. 334 00:30:19,580 --> 00:30:21,400 And we'll see that happen up in the instrument cluster. 335 00:30:21,480 --> 00:30:22,000 I'll send it. 336 00:30:22,240 --> 00:30:23,640 Brake fluid low pops up. 337 00:30:24,520 --> 00:30:26,300 But only for a fraction of a second. 338 00:30:26,380 --> 00:30:34,200 And this is because the body control module is sending out the brake fluid status message about three times a second. 339 00:30:34,840 --> 00:30:39,620 And of course the brake fluid level is actually okay on our demo. 340 00:30:39,760 --> 00:30:46,920 So this message that we're injecting is being overridden by the body control module almost immediately once we send it. 341 00:30:48,000 --> 00:30:52,420 If we try to flood the bus with this message, just put this in a wild loop and keep pounding on it, 342 00:30:52,480 --> 00:30:55,940 we see that the brake fluid light will pop up and go away. 343 00:30:56,380 --> 00:30:57,600 And pop up and go away. 344 00:30:57,640 --> 00:30:58,900 And pop up and go away. 345 00:30:59,220 --> 00:31:04,380 This gives us very herky-jerky control over whatever it is we are trying to control. 346 00:31:04,780 --> 00:31:08,700 This is a problem that you run into quite frequently with CAN. 347 00:31:08,800 --> 00:31:11,180 You're trying to inject a message to do something malicious. 348 00:31:12,220 --> 00:31:16,800 But your message is getting overridden by a different ECU on the system. 349 00:31:18,700 --> 00:31:25,460 CANT has a very nice data replacement tool node that has been written. 350 00:31:25,460 --> 00:31:27,480 We'll go ahead and set the arbitration ID. 351 00:31:27,520 --> 00:31:28,880 The arbitration ID is 290. 352 00:31:29,440 --> 00:31:33,500 We'll set the baud rate to 125 orbits per second. 353 00:31:34,180 --> 00:31:37,040 And we'll choose the data replacer attack. 354 00:31:37,760 --> 00:31:39,340 The data is 8 bytes long. 355 00:31:39,560 --> 00:31:44,920 If we go back, we'll see the message is 8800106000000. 356 00:31:47,780 --> 00:31:53,460 We'll go 880010600000000. 357 00:31:56,540 --> 00:32:04,440 And as soon as we start doing this, we see that our brake fluid level low light comes on in the instrument cluster and stays on. 358 00:32:04,540 --> 00:32:12,580 And the reason for this is because this attack, since we're replacing the data with our own data, violating the rules of CAN, 359 00:32:13,620 --> 00:32:18,320 we're only violating the rules of the CAN bus from the perspective of the body control module. 360 00:32:18,460 --> 00:32:21,300 The body control module should be the one sending the message. 361 00:32:21,320 --> 00:32:22,840 It should be the only one on the bus. 362 00:32:23,020 --> 00:32:25,440 But we're taking the bus away from the body control module. 363 00:32:25,460 --> 00:32:29,920 So the body control module is going into an error state. 364 00:32:30,140 --> 00:32:33,000 If we take a look at the scope here, we'll see. 365 00:32:36,680 --> 00:32:42,140 Right here, we see that the body control module is hitting out these longer pulses. 366 00:32:42,180 --> 00:32:43,360 These are error frames. 367 00:32:43,860 --> 00:32:45,760 The error frames we were discussing earlier. 368 00:32:47,480 --> 00:32:49,360 We'll see there's quite a few of them. 369 00:32:49,520 --> 00:32:51,500 Down below, there should be 16 of them. 370 00:32:51,660 --> 00:32:54,780 Because the body control module is going into its plus off state. 371 00:32:54,780 --> 00:32:55,680 Resetting. Resetting. 372 00:32:56,460 --> 00:33:00,540 Sending active error frames until it accumulates 128 send errors again. 373 00:33:00,800 --> 00:33:05,640 And once it's accumulated those 128 send errors, it goes into error passive. 374 00:33:05,680 --> 00:33:07,540 And then eventually into plus off. 375 00:33:13,940 --> 00:33:19,300 So CAT allows us to then just override any message on the bus. 376 00:33:19,540 --> 00:33:24,240 Eventually knocking that ECU offline to allow us to have complete control. 377 00:33:24,780 --> 00:33:28,400 Over whatever message it is we are trying to control. 378 00:33:31,040 --> 00:33:37,620 The last attack I want to demonstrate is an attack of the overload inserter attack. 379 00:33:37,840 --> 00:33:41,420 So the overload frame jumped out at me when I was reading the CAN specification. 380 00:33:42,120 --> 00:33:49,100 The CAN spec says that no device on the bus should send more than two overload frames. 381 00:33:49,640 --> 00:33:53,940 But it doesn't say what should happen if somebody does send more than two overload frames. 382 00:33:53,940 --> 00:34:05,100 Now the purpose of the overload frame is to allow slower nodes on the CAN bus to request a little bit of extra processing time after they receive a message. 383 00:34:05,480 --> 00:34:07,000 So they send out the overload frame. 384 00:34:07,120 --> 00:34:12,480 This gives them just a little bit more time to process a message that they've received. 385 00:34:13,900 --> 00:34:17,980 Let's go ahead and set the baud rate again. 386 00:34:18,800 --> 00:34:22,340 And choose the overload inserter. 387 00:34:22,340 --> 00:34:24,460 Let's just send two overload frames. 388 00:34:24,720 --> 00:34:28,540 Just behave in a nice appropriate manner. 389 00:34:28,920 --> 00:34:33,900 And we see that things seem to be functioning quite normally. 390 00:34:34,380 --> 00:34:35,360 So let's go. 391 00:34:37,080 --> 00:34:39,760 We go in and we see we have one, two overload frames. 392 00:34:40,240 --> 00:34:42,340 Everything looks nice and kosher. 393 00:34:43,960 --> 00:34:45,600 Let's send more. 394 00:34:45,780 --> 00:34:48,140 Let's send five overload frames. 395 00:34:48,280 --> 00:34:49,100 See what happens. 396 00:34:51,500 --> 00:34:56,280 Now that we're here at the scope, we see we have our one, two, three, four, five overload frames. 397 00:34:56,740 --> 00:34:59,720 And we also see that everything still seems to be running properly. 398 00:34:59,880 --> 00:35:05,260 So apparently sending more than two overload frames doesn't immediately cause any issues. 399 00:35:06,420 --> 00:35:07,540 Let's try sending more. 400 00:35:07,660 --> 00:35:17,400 Let's try sending 50 of these overload frames. 401 00:35:17,400 --> 00:35:18,900 We'll be sending quite a few. 402 00:35:19,620 --> 00:35:22,080 Now we see that this is taking some effect. 403 00:35:22,280 --> 00:35:25,260 The brake fluid level low light comes on for some reason. 404 00:35:25,620 --> 00:35:28,900 And that it's not a camera glitch. 405 00:35:29,140 --> 00:35:31,960 That instrument cluster really is kind of dimming. 406 00:35:32,340 --> 00:35:34,720 You can still see it's still kind of running. 407 00:35:34,840 --> 00:35:36,980 But it's definitely something weird going on. 408 00:35:37,580 --> 00:35:43,600 And if we come over here to the oscilloscope, we see, as we expect, that we're sending a whole bunch of overload frames. 409 00:35:43,840 --> 00:35:47,380 We also see that the amount of time we're spending on this, 410 00:35:47,380 --> 00:35:51,980 when we're sending overload frames, is vastly more than we're sending actual messages. 411 00:35:52,160 --> 00:35:56,700 So we're actually seeing a significant increase in bus loading here. 412 00:35:58,280 --> 00:35:59,300 We want to send more. 413 00:35:59,380 --> 00:36:01,040 Let's try sending 100 of these things. 414 00:36:02,020 --> 00:36:03,020 No, 1,000. 415 00:36:03,080 --> 00:36:04,040 Send 1,000 of these things. 416 00:36:04,640 --> 00:36:10,700 And if we send 1,000, it causes the instrument cluster to completely shut off at this point. 417 00:36:10,920 --> 00:36:15,180 And if we come back here to the scope, we see the amount quite a bit. 418 00:36:15,180 --> 00:36:20,200 We see we're spending very little time actually sending messages. 419 00:36:20,340 --> 00:36:25,260 And we're almost spending the entire bus time is spent in these overload frames. 420 00:36:26,140 --> 00:36:27,740 This is a demonstration of CANT. 421 00:36:27,880 --> 00:36:29,580 What CANT allows you to do. 422 00:36:29,660 --> 00:36:32,040 CANT allows you to do things that you can't do. 423 00:36:32,960 --> 00:36:35,340 And see what the effects of that is. 424 00:36:39,910 --> 00:36:40,780 So after... 425 00:36:42,260 --> 00:36:43,740 Since that demo, 426 00:36:43,740 --> 00:36:45,540 I've added a couple new features, 427 00:36:45,720 --> 00:36:48,180 which are also interesting. 428 00:36:48,500 --> 00:36:50,620 And I have a demo for those as well. 429 00:36:51,940 --> 00:36:52,500 Maybe. 430 00:37:30,160 --> 00:37:31,860 You know, I recorded these videos, 431 00:37:31,980 --> 00:37:34,500 so I didn't have to go through all the problems you get with a live demo. 432 00:37:54,060 --> 00:37:54,760 But I'm going to show you how to do that. 433 00:37:57,120 --> 00:37:57,640 I'm going to show you how to do that. 434 00:37:57,640 --> 00:37:59,520 When I released CANT back in January, 435 00:37:59,620 --> 00:38:03,080 there was one thing that CANT couldn't do at the time. 436 00:38:03,100 --> 00:38:05,900 And I figure if I'm going to release a tool called CANT, 437 00:38:06,060 --> 00:38:09,480 I should probably make sure there's nothing that CANT can't do. 438 00:38:09,940 --> 00:38:13,160 The thing that CANT couldn't do at the time was, 439 00:38:13,160 --> 00:38:17,120 CANT couldn't assert a recessive state on the bus. 440 00:38:17,800 --> 00:38:21,320 This is how CANT handles all of its arbitration, 441 00:38:21,520 --> 00:38:23,520 all of its error handling and error recovery, 442 00:38:23,800 --> 00:38:29,580 is by assuming that a node cannot assert a recessive state on the bus. 443 00:38:29,660 --> 00:38:33,080 That if any node on the bus is asserting a dominant state, 444 00:38:33,360 --> 00:38:36,780 then the state of the bus will be in the dominant state. 445 00:38:37,360 --> 00:38:39,280 So in order to accomplish this, 446 00:38:39,340 --> 00:38:40,920 I created this piece of hardware. 447 00:38:40,920 --> 00:38:47,700 It's a shield that plugs into the Nucleo STM32H7ZI dev board that we've been using. 448 00:38:48,040 --> 00:38:50,780 And it is a standard CANT transceiver. 449 00:38:51,000 --> 00:38:52,400 It has a... 450 00:38:57,160 --> 00:39:00,660 It has a CANT transceiver connector, 451 00:39:01,040 --> 00:39:02,080 a couple of passives on it. 452 00:39:02,200 --> 00:39:06,160 The thing that I added that makes it special is this little device here at U2. 453 00:39:06,360 --> 00:39:07,660 It's an analog switch. 454 00:39:08,000 --> 00:39:10,280 And what this analog switch allows me to do 455 00:39:10,920 --> 00:39:14,920 is it allows me to short CANT HIGH and CANT LOW together. 456 00:39:15,200 --> 00:39:18,080 And when CANT HIGH and CANT LOW are shorted together, 457 00:39:18,460 --> 00:39:19,780 it allows... 458 00:39:19,780 --> 00:39:23,380 It will cause any node on the bus to read a recessive state 459 00:39:23,380 --> 00:39:24,700 because they'll be in the same potential. 460 00:39:25,140 --> 00:39:29,600 So this allows me to violate that last inviolable for the CANT bus, 461 00:39:29,720 --> 00:39:32,600 is by asserting a recessive state on the bus. 462 00:39:32,800 --> 00:39:35,780 And this allows me to create two new attacks 463 00:39:36,480 --> 00:39:40,520 plus adding an enhancement to a third attack. 464 00:39:41,000 --> 00:39:42,840 So the first attack I'm going to demonstrate 465 00:39:42,840 --> 00:39:45,040 is the cyber paperclip mode. 466 00:39:45,360 --> 00:39:47,540 This just turns on the bus. 467 00:39:47,740 --> 00:39:49,960 It does the same thing that 468 00:39:51,720 --> 00:39:53,740 shrugging a paperclip into the CANT bus would do. 469 00:39:53,880 --> 00:39:56,100 It just causes the buses to short together 470 00:39:56,100 --> 00:39:57,760 and nobody can communicate. 471 00:39:58,280 --> 00:39:59,660 We'll go ahead and start that attack, 472 00:39:59,860 --> 00:40:00,860 the bus short attack. 473 00:40:01,420 --> 00:40:04,620 And we see that this purple line here on the scope 474 00:40:04,620 --> 00:40:06,000 is the state of the switch. 475 00:40:06,160 --> 00:40:08,480 So we see that this went HIGH, turned the switch ON, 476 00:40:08,480 --> 00:40:12,900 and that now we don't really have any traffic on the CAN bus. 477 00:40:14,160 --> 00:40:16,540 And at some point we should be able to see 478 00:40:16,540 --> 00:40:18,260 some sort of message start to come up. 479 00:40:18,420 --> 00:40:21,040 We can see that the instrument cluster is dead. 480 00:40:21,160 --> 00:40:23,720 We see it's kind of trying to send a message here and there, 481 00:40:24,760 --> 00:40:26,920 but it's not able to actually send anything 482 00:40:26,920 --> 00:40:29,240 because the bus is shorted together. 483 00:40:30,440 --> 00:40:32,160 Go ahead and reset our CANT. 484 00:40:33,900 --> 00:40:37,500 Reset the car because recovering from this is difficult. 485 00:40:38,480 --> 00:40:41,020 Go ahead and get the instrument cluster running again. 486 00:40:41,840 --> 00:40:46,240 The second attack I want to demonstrate is a knack attack. 487 00:40:46,560 --> 00:40:49,360 And so what the knack attack does is it tries to 488 00:40:49,360 --> 00:40:52,400 essentially clobber the acknowledgement bit 489 00:40:52,400 --> 00:40:54,820 that the node and the bus are supposed to send back 490 00:40:54,820 --> 00:40:57,540 once they properly receive a message. 491 00:40:58,000 --> 00:41:00,160 So go ahead and set our baud rate. 492 00:41:02,400 --> 00:41:04,060 Choose the knack attack. 493 00:41:05,480 --> 00:41:08,360 And this should, as we see here, 494 00:41:10,100 --> 00:41:13,420 this is where the knack slot should be here on the scope. 495 00:41:13,600 --> 00:41:17,800 We see that our switch goes high for one CAN fray or one CAN bit, 496 00:41:17,980 --> 00:41:21,700 and it does cause all this crazy stuff to happen on the bus, 497 00:41:21,780 --> 00:41:23,800 all this noise to happen. 498 00:41:24,500 --> 00:41:29,340 So as we can see, our instrument cluster is still running. 499 00:41:29,460 --> 00:41:32,380 It seems like it's still getting enough back 500 00:41:32,380 --> 00:41:34,980 that the car isn't too unhappy. 501 00:41:37,420 --> 00:41:38,460 But we're able to see 502 00:41:38,480 --> 00:41:41,320 that we're able to generate a bunch of noise on the knack frame. 503 00:41:43,700 --> 00:41:47,760 The last attack I want to show is an improvement 504 00:41:47,760 --> 00:41:50,500 to the data replacer attack. 505 00:41:51,060 --> 00:41:55,360 Previously, the data replacer attack would only work 506 00:41:55,360 --> 00:41:58,620 if we were wanting to send a dominant bit 507 00:41:58,620 --> 00:42:00,660 where a recessive bit was being sent. 508 00:42:01,000 --> 00:42:04,240 The brake fluid test that I showed 509 00:42:04,240 --> 00:42:06,900 and the previous video showed that. 510 00:42:06,900 --> 00:42:11,140 The brake fluid level low is a dominant state, 511 00:42:11,240 --> 00:42:13,880 so I was able to assert that dominant state on the bus 512 00:42:13,880 --> 00:42:17,240 and have the brake fluid level low show up on the bus. 513 00:42:17,460 --> 00:42:18,940 But what if we want to go the other way? 514 00:42:19,080 --> 00:42:21,080 So in this case, I've actually used our control box 515 00:42:21,080 --> 00:42:24,940 to cause the body control module 516 00:42:24,940 --> 00:42:27,500 to actually be sending the brake fluid level low, 517 00:42:27,640 --> 00:42:31,660 which it does by setting that bit to zero, 518 00:42:31,760 --> 00:42:32,720 to the dominant state. 519 00:42:32,980 --> 00:42:36,020 And now I want to overwrite that with the recessive state 520 00:42:36,020 --> 00:42:38,920 for that bit to cause the brake fluid level low light 521 00:42:38,920 --> 00:42:40,160 to turn off. 522 00:42:40,800 --> 00:42:43,720 I was unable to do that with the previous version of cant, 523 00:42:43,840 --> 00:42:45,120 but now I can do that. 524 00:42:45,300 --> 00:42:46,860 I'm going to go ahead and set the arbitration ID, 525 00:42:48,500 --> 00:42:49,960 choose the baud rate again, 526 00:42:50,980 --> 00:42:53,060 and do the data replacer attack. 527 00:42:53,480 --> 00:42:54,620 Set 8 bytes. 528 00:42:54,920 --> 00:43:02,500 First byte will be 98 00 01 06 00 00 00 00. 529 00:43:02,940 --> 00:43:05,000 Then I added this line here, 530 00:43:05,000 --> 00:43:06,240 the force recessive bit. 531 00:43:06,320 --> 00:43:08,400 Force and recessive is not currently the default. 532 00:43:08,660 --> 00:43:11,240 I'm going to go ahead and say yes to force the recessive bit. 533 00:43:11,560 --> 00:43:15,200 And we'll see here that the brake fluid level light goes away. 534 00:43:16,420 --> 00:43:19,740 Now we will see occasionally that the brake fluid level light 535 00:43:19,740 --> 00:43:22,740 will flash back on for just a second and turn back off. 536 00:43:23,140 --> 00:43:26,100 I haven't been able to figure out why that is happening. 537 00:43:26,240 --> 00:43:29,220 If we go and look at the actual state of the bus 538 00:43:29,220 --> 00:43:31,100 using the CanCat tool that I have hooked up, 539 00:43:31,220 --> 00:43:34,780 we can see that it's all of the 540 00:43:35,000 --> 00:43:39,480 brake fluid message bytes are being set to what I set it to, 541 00:43:39,600 --> 00:43:42,080 which would be a 78 all the way across. 542 00:43:42,280 --> 00:43:44,640 There's some other behavior in the instrument cluster 543 00:43:44,640 --> 00:43:47,080 that's causing that message to pop back up occasionally. 544 00:43:47,920 --> 00:43:49,220 But the attack works. 545 00:43:49,340 --> 00:43:51,320 All of the messages that we're targeting 546 00:43:51,320 --> 00:43:54,400 are now coming across the bus with the correct value. 547 00:44:01,560 --> 00:44:03,760 And one thing I forgot to mention in the video 548 00:44:03,760 --> 00:44:06,960 is that another advantage of being able to force the recessive bit 549 00:44:06,960 --> 00:44:09,260 is that I can also clobber the error frame 550 00:44:09,260 --> 00:44:10,460 that the body control module 551 00:44:10,460 --> 00:44:13,200 or whatever ECU is sending the message is sending. 552 00:44:13,380 --> 00:44:17,860 So that the only node on the bus that has any idea anything's wrong 553 00:44:17,860 --> 00:44:19,840 is the one that I'm specifically targeting. 554 00:44:20,020 --> 00:44:21,200 Nobody else uses an error frame. 555 00:44:21,380 --> 00:44:23,260 Nobody else does anything to its error counters. 556 00:44:23,760 --> 00:44:25,080 Whatever else you have on the system, 557 00:44:25,280 --> 00:44:28,580 it would continue to operate as if nothing was wrong 558 00:44:28,580 --> 00:44:30,900 and have no idea anything else was going on. 559 00:44:32,720 --> 00:44:33,740 So there are some things that we can do. 560 00:44:33,740 --> 00:44:35,980 There are some limitations and mitigations to this. 561 00:44:36,620 --> 00:44:39,600 One limitation is that you need physical access to the car 562 00:44:39,600 --> 00:44:41,160 in order to do this. 563 00:44:41,680 --> 00:44:42,240 Maybe. 564 00:44:42,720 --> 00:44:44,460 It's also possible to, 565 00:44:45,500 --> 00:44:46,540 theoretically possible, 566 00:44:46,720 --> 00:44:50,400 to find a way to get into the car remotely 567 00:44:50,400 --> 00:44:53,140 or wireless or cell modem or something 568 00:44:53,560 --> 00:44:56,800 and can reprogram an ECU to be a cant, essentially. 569 00:44:57,180 --> 00:44:57,980 Because there's nothing, 570 00:44:58,700 --> 00:45:01,320 minus the analog switch to force the recessive, 571 00:45:01,340 --> 00:45:02,620 which I'm guessing most, 572 00:45:03,900 --> 00:45:05,680 OEMs don't actually stick on the CAN bus 573 00:45:05,680 --> 00:45:06,980 for you to play with. 574 00:45:07,520 --> 00:45:08,520 Minus that feature, 575 00:45:08,740 --> 00:45:09,960 everything else you can do, 576 00:45:09,980 --> 00:45:11,640 just a bog standard CAN peripheral 577 00:45:11,640 --> 00:45:14,060 that is shipped with every car, 578 00:45:14,320 --> 00:45:16,280 every ECU that has a CAN bus. 579 00:45:18,860 --> 00:45:19,640 So increased, 580 00:45:19,800 --> 00:45:22,460 for the attacks that just increase CAN bus load, 581 00:45:22,620 --> 00:45:23,820 those could be detected 582 00:45:23,820 --> 00:45:26,460 by something that's looking at CAN bus. 583 00:45:26,640 --> 00:45:28,560 You wouldn't necessarily be able to tell why 584 00:45:28,560 --> 00:45:29,680 with the overload attack, 585 00:45:29,900 --> 00:45:30,300 because like I mentioned, 586 00:45:30,360 --> 00:45:33,120 those overload frames aren't actually reported up to software. 587 00:45:33,120 --> 00:45:33,260 Of course, 588 00:45:33,320 --> 00:45:34,820 you'd see your bus load increasing, 589 00:45:35,200 --> 00:45:38,200 and that stuff couldn't make its timings 590 00:45:38,200 --> 00:45:38,960 that it's supposed to make, 591 00:45:39,140 --> 00:45:42,020 but it'd be difficult to determine why 592 00:45:42,020 --> 00:45:45,240 without hooking a scope or similar up to the car. 593 00:45:46,820 --> 00:45:49,080 Power fingerprinting is something that 594 00:45:49,080 --> 00:45:51,220 some companies are working on. 595 00:45:51,280 --> 00:45:53,860 Were they able to fingerprint the nodes on the CAN bus 596 00:45:53,860 --> 00:45:55,560 to see if there's anything out of the ordinary? 597 00:45:55,960 --> 00:45:58,340 CAN is definitely out of the ordinary. 598 00:45:59,480 --> 00:46:01,540 I haven't actually used one of these 599 00:46:01,540 --> 00:46:02,520 to see what CAN looks like, 600 00:46:02,520 --> 00:46:03,860 but I'm sure it sticks out like a sore thumb, 601 00:46:04,000 --> 00:46:06,420 because I am bit banning CAN over GPIO. 602 00:46:06,760 --> 00:46:08,620 That's going to look a bit different. 603 00:46:08,960 --> 00:46:09,540 Of course, 604 00:46:09,620 --> 00:46:10,060 then the question is, 605 00:46:10,100 --> 00:46:10,340 then what? 606 00:46:10,940 --> 00:46:11,420 So, 607 00:46:11,500 --> 00:46:12,260 yay, 608 00:46:12,400 --> 00:46:13,440 something's happening, 609 00:46:13,660 --> 00:46:16,440 but what do you do now with that car 610 00:46:16,440 --> 00:46:17,420 to make it work properly? 611 00:46:18,500 --> 00:46:19,960 Increased network segmentation 612 00:46:20,340 --> 00:46:22,840 can help limit how this attack, 613 00:46:23,120 --> 00:46:24,820 some sort of encryption or authentication 614 00:46:24,820 --> 00:46:26,540 could help mitigate some of this, 615 00:46:27,300 --> 00:46:27,780 possibly, 616 00:46:28,660 --> 00:46:30,440 although CAN makes a lot of this difficult 617 00:46:30,440 --> 00:46:33,540 because of how small its data size is 618 00:46:33,540 --> 00:46:35,860 and how low power a lot of the ECUs are. 619 00:46:37,220 --> 00:46:38,000 And, of course, 620 00:46:38,000 --> 00:46:39,420 you can always switch away from CAN bus. 621 00:46:39,880 --> 00:46:41,400 Minus itself is mandated by law. 622 00:46:41,880 --> 00:46:43,640 That will give you some more options. 623 00:46:45,980 --> 00:46:46,940 As I'm further reading, 624 00:46:47,080 --> 00:46:50,300 the CAN spec is available right up there, 625 00:46:50,420 --> 00:46:54,900 and this is the paper that led to that ICS report, 626 00:46:55,140 --> 00:46:57,000 ICS alert going out. 627 00:46:58,040 --> 00:46:59,660 I've made a couple other improvements 628 00:46:59,660 --> 00:47:02,880 to CAN't backspace works now. 629 00:47:03,020 --> 00:47:04,620 I did it as of a week ago, 630 00:47:04,760 --> 00:47:06,080 so that's really handy. 631 00:47:06,400 --> 00:47:08,300 A couple other usability improvements, 632 00:47:09,300 --> 00:47:12,880 and I am pushing those up to GitHub right now. 633 00:47:20,280 --> 00:47:22,920 So that will all be available very shortly 634 00:47:22,920 --> 00:47:23,460 up on GitHub. 635 00:47:24,260 --> 00:47:28,840 I also have about 20 of those CAN't shields available. 636 00:47:29,100 --> 00:47:29,640 I don't have those. 637 00:47:29,660 --> 00:47:30,000 I have the dev boards, 638 00:47:30,160 --> 00:47:30,700 just the shields. 639 00:47:30,980 --> 00:47:31,820 But those dev boards, 640 00:47:31,900 --> 00:47:32,060 like I said, 641 00:47:32,100 --> 00:47:32,760 they're about 20 bucks. 642 00:47:33,020 --> 00:47:34,460 Get them from Mouser, Arrow, 643 00:47:34,640 --> 00:47:36,960 whoever you generally order from. 644 00:47:37,560 --> 00:47:39,360 And anybody who wants one, 645 00:47:39,440 --> 00:47:41,400 feel free to come up and get one. 646 00:47:41,680 --> 00:47:43,360 And if anyone has any questions. 647 00:47:51,400 --> 00:47:57,040 I switched to this 648 00:47:58,360 --> 00:48:00,220 because I wanted to make sure 649 00:48:00,220 --> 00:48:01,320 that I would have enough. 650 00:48:01,660 --> 00:48:05,020 This dev board is an ARM Cortex M7 at 400 megahertz. 651 00:48:05,120 --> 00:48:06,460 It's a pretty beefy board. 652 00:48:06,740 --> 00:48:08,820 I wanted to make sure that I would have time 653 00:48:08,820 --> 00:48:12,100 to actually launch the attacks I wanted to be able to launch 654 00:48:12,100 --> 00:48:14,780 and have the flexibility to do more complex attacks 655 00:48:14,780 --> 00:48:19,200 without then not being able to make timings on the CAN bus. 656 00:48:28,820 --> 00:48:29,280 All right. 657 00:48:29,320 --> 00:48:30,160 Thank you all very much. 658 00:48:30,200 --> 00:48:30,520 Like I said, 659 00:48:30,540 --> 00:48:31,740 if you have any more questions for me, 660 00:48:31,740 --> 00:48:32,420 feel free to come up. 661 00:48:32,480 --> 00:48:34,880 I have a handful of those shields that I'm handing out.