1 00:00:01,180 --> 00:00:03,000 Hello DEF CON! 2 00:00:03,000 --> 00:00:04,200 Hi! 3 00:00:10,500 --> 00:00:14,140 I hope you enjoy your time here, we definitely do. 4 00:00:14,140 --> 00:00:26,670 It's actually our first time here at DEF CON and thus we are very proud and excited to present to you our talk Redefining V2G, how to use your vehicle as a game controller. 5 00:00:27,760 --> 00:00:32,240 So, why do we need to redefine the acronym V2G? 6 00:00:37,370 --> 00:00:39,870 Well, let me tell you a story. 7 00:00:39,870 --> 00:00:45,430 Once upon a time, our professor told us we should do some research about V2G. 8 00:00:46,010 --> 00:01:01,750 And what he means by that is that we look at vehicle-to-grid communication, the communication between the car and the charge point, and also the back-end and even the power grid for bi-directional charging, for example. 9 00:01:02,250 --> 00:01:08,250 Well, that's actually a pretty cool research topic, but do you know what's even cooler? 10 00:01:09,570 --> 00:01:12,090 Using your car as a game controller. 11 00:01:12,090 --> 00:01:17,690 So, that's why we developed this little project called Vehicle-to-Game. 12 00:01:18,270 --> 00:01:22,870 But before we get started with that, a short introduction of ourselves. 13 00:01:22,870 --> 00:01:34,650 My name is Tim, I'm a PhD student at Darmstadt University of Applied Sciences in Germany, and I mainly do automotive security, so also a lot of theoretical stuff. 14 00:01:34,650 --> 00:01:45,610 I look at protocols and standards and do a formal analysis of these standards to see if they meet certain security goals. 15 00:01:45,730 --> 00:01:48,050 Yeah, hello from my side too. 16 00:01:48,050 --> 00:01:58,550 I'm Janis, I'm also a PhD student at our small automotive research group called ACSD, Automotive Cyber Security Darmstadt. 17 00:01:58,550 --> 00:02:00,810 It's located in Germany. 18 00:02:00,810 --> 00:02:12,630 I finished my master's at the end of the last year, and now I'm a PhD student about resilience in the automotive topic, but also for IoT systems. 19 00:02:12,630 --> 00:02:27,850 It means what happens if an ECU in a car breaks or is going to be compromised, how you can migrate functionality to another ECU and strengthen the safety inside the car by such a resilient concept. 20 00:02:28,830 --> 00:02:33,350 Our research group is also very focused on teaching. 21 00:02:33,350 --> 00:02:54,910 We have a lecture called Automotive Security, and therefore we have to motivate students, of course, and that's why we have created this motivating and beginner-friendly talk and our project V2G to get students excited and motivated about the topic of automotive research. 22 00:02:55,730 --> 00:03:00,290 Maybe the most important member of our research group is our research car. 23 00:03:00,290 --> 00:03:02,190 It's a Volkswagen ID.3. 24 00:03:02,190 --> 00:03:04,010 It's an electric vehicle. 25 00:03:04,290 --> 00:03:08,210 And since, of course, we are Germans, we have to do research on the Volkswagen. 26 00:03:13,740 --> 00:03:23,300 Usually, the initial step of the automotive research, but also other security research, is considering attack vectors. 27 00:03:23,300 --> 00:03:26,620 And that's what we have to do also for the automotive context. 28 00:03:26,620 --> 00:03:32,320 You can see there are various attack... it's a huge attack surface. 29 00:03:32,320 --> 00:03:38,700 First of all, you have long-range attacks, you have short-range attacks, but you have also physical attack possibilities. 30 00:03:38,720 --> 00:03:49,220 For the long-range attacks, for example, the cellular communication between the car and the back-end of the OEM, for example, for over-the-air updates. 31 00:03:49,560 --> 00:03:59,400 In newly upcoming cars, you have also the V2X communication, cars communicating to each other about their location, about their speed. 32 00:03:59,400 --> 00:04:09,900 You have cars communicating with road signs to get a status about allowed speed, for example, of this street section. 33 00:04:10,420 --> 00:04:27,180 You have short-range attacks, that's more or less classical cyber security, considering Bluetooth, Wi-Fi connection for your infotainment system between the smartphone, for example, for playing via Apple CarPlay, for example, the music on your car. 34 00:04:27,860 --> 00:04:49,760 And the maybe most interesting and car-specific attack vectors are these physical attacks, that's the bus systems inside the car, there are several of them, but we want to focus on two, and we go into them a little bit later in detail, because we need them for our V2G project, 35 00:04:49,760 --> 00:04:54,640 for getting all information required for our game controller out of this car. 36 00:04:57,960 --> 00:05:02,180 So, here you can see our two main research cars. 37 00:05:02,180 --> 00:05:09,900 We are focused on electric vehicles, so on the left side you can see our Volkswagen ID.3, on the right side you can see the Tesla Model 3. 38 00:05:11,000 --> 00:05:26,740 We use them for practical research, Tim also introduced them as theoretical research, I'm also more theoretical part, but you cannot do the whole time theoretical research, so you have to do tinkering around with the car, it's also good for the motivation. 39 00:05:27,260 --> 00:05:39,480 There's a lot of information you just get when you look at the actual car, because the manufacturers won't tell you, and also for students it's quite cool to do research on the actual cars and projects. 40 00:05:40,880 --> 00:05:51,560 So, we have equipped our cars with lots of techniques to get information about them, and we show you in the following how we have done this. 41 00:05:51,860 --> 00:06:09,740 That's the back of the Volkswagen ID.3, we've equipped this with lots of measurement techniques, on the right you can see so-called vector boxes, they're from a German company called Vector, that's why we call them vector boxes, they're for capturing different buses inside the car, 42 00:06:09,740 --> 00:06:18,200 and we have equipped the car in a way that we can get a holistic view of all relevant buses in this car. 43 00:06:18,380 --> 00:06:38,220 On the left side you can also see some interesting parts, more for the electrical engineers, we have equipped the car with so-called LEM sensors, they are current measuring sensors via induction, you can clip them on the high voltage system wires to measure the current. 44 00:06:38,220 --> 00:07:00,120 The idea behind this holistic view between physical and messages inside the car is that we can compare those data and get correlations between the actual physical measurements and the recorded, for example, canvas data. 45 00:07:02,260 --> 00:07:09,120 As I've already introduced, from a theoretical way, there's also a practical attack surface, of course. 46 00:07:09,120 --> 00:07:32,200 On the left side you can see classical key fob attacks using an SDR, maybe all of you have heard about the roll jam attack, you jam the signal of the key fob because it's using a rolling code, and the owner of the car will press a second time, and you have recorded both signals, 47 00:07:32,200 --> 00:07:43,500 and you re-send the older one because the car hasn't heard this already, and so you have a newer one for the car, unlocking this in the future without the owner getting any notice about this. 48 00:07:44,340 --> 00:07:56,400 In the middle you can see, for automotive and classical attack surfaces also, unsoldering the chips where the firmware is located on, because you have physical access to your car. 49 00:07:56,400 --> 00:08:00,400 If you own the car, you can do anything you like with it, more or less. 50 00:08:01,080 --> 00:08:08,760 So that's why we have unsoldered the EMMC chip, to get in contact with the firmware. 51 00:08:09,220 --> 00:08:16,080 That's the same we've done with the key fob, you can see here there was the memory chip. 52 00:08:16,920 --> 00:08:27,840 And maybe another interesting part is that you can directly connect, here you can see such a vector box, to the internal buses of the car. 53 00:08:27,840 --> 00:08:38,980 Here you can see one such an ECU, and we have connected this box with the CAN bus of the ECU, controlling messages. 54 00:08:39,680 --> 00:08:53,150 But before we go there for a little bit in detail, how these messages look like, first we have to understand what this CAN bus actually is, how can we talk to those cars. 55 00:08:53,150 --> 00:09:06,230 For a game controller, we require, as I've already mentioned, information about specific actuators of the car, for example the steering wheel. 56 00:09:06,230 --> 00:09:11,610 We later want to transfer the angle of the steering wheel, to our virtual game controller. 57 00:09:11,610 --> 00:09:14,810 So we have to get this information out of the car. 58 00:09:14,830 --> 00:09:18,210 And this information is transferred via the CAN bus. 59 00:09:22,050 --> 00:09:39,350 The topology of such a car looks like follows, it's a very condensed view, it's a very simplified view of our Volkswagen ID.3, where you can see there's a main gateway ECU, and several domains. 60 00:09:39,450 --> 00:09:51,270 Each domain consists of several other ECUs, and each of those domains is separated in a way, based on criticality of those functionality and the ECUs. 61 00:09:51,270 --> 00:10:03,490 For example, in the middle domain you can see, in the drive domain you can see, there's located the engine ECU, but also the brake ECU, they're all safety relevant, so they're very critical for the safety behavior of the car. 62 00:10:03,490 --> 00:10:12,490 On the left side you can see a separated domain, with less criticality for, for example, the light controlling inside the car. 63 00:10:13,990 --> 00:10:23,490 The special thing in this topology is, that those domains are separated, based on this gateway ECU. 64 00:10:23,490 --> 00:10:41,330 The gateway ECU is responsible for, for shielding the inside of the car against the outside, because, you know, maybe you know this from combustion engine, the outside of the car is connected with so-called OBD2 port. 65 00:10:41,330 --> 00:10:46,890 It's for diagnosis, if you bring your car to a garage, they will plug there in. 66 00:10:46,890 --> 00:10:52,710 And you want to prevent that via the OBD2 port, everyone can read everything of the car. 67 00:10:52,710 --> 00:10:57,770 So that's why such a gateway ECU is introduced into this topology. 68 00:10:57,970 --> 00:11:01,630 But this strongly depends on the actual car you want to consider. 69 00:11:01,630 --> 00:11:07,410 That's just for the Volkswagen ID.3 and the group of vehicles from Volkswagen. 70 00:11:11,230 --> 00:11:14,570 Now we get a little bit into detail about this CAN bus. 71 00:11:14,570 --> 00:11:17,770 The CAN bus was developed by Bosch in 1986. 72 00:11:18,070 --> 00:11:23,870 It's a dual wire twisted pair cable, and as I said before, it's a bus topology. 73 00:11:23,870 --> 00:11:26,210 What does it mean? 74 00:11:26,210 --> 00:11:39,010 A bus topology means that the ECUs are connected to the same wire, or wire pair, and all ECUs get the same state of information in the respective time frame. 75 00:11:39,010 --> 00:11:51,310 We have a frequency in this CAN bus, and all this information is distributed in this time frame to all ECUs connected to this CAN bus. 76 00:11:51,310 --> 00:11:53,690 It's also a multi-master protocol. 77 00:11:53,690 --> 00:12:02,710 It means that all ECUs can send and receive on demand, and there's no master required to control them. 78 00:12:06,570 --> 00:12:10,590 Now we have the foundations how this CAN bus works. 79 00:12:10,590 --> 00:12:15,790 Now we get to gain access to this physical CAN bus inside the car. 80 00:12:16,510 --> 00:12:22,090 Maybe the most convenient way is to find just a repair manual or a wiring diagram of the car. 81 00:12:22,090 --> 00:12:24,830 They're usually available for garages. 82 00:12:24,850 --> 00:12:27,310 For Volkswagen, you can get them online. 83 00:12:27,310 --> 00:12:31,370 If you claim you have a garage, then you can buy it. 84 00:12:32,790 --> 00:12:37,370 Otherwise, you have to find it out by yourself, but this can become very, very hard. 85 00:12:37,370 --> 00:12:40,810 So we recommend having such a wiring diagram. 86 00:12:41,270 --> 00:12:51,190 Based on this wiring diagram, you can find a good exposed position of an interesting CAN bus where you can connect to. 87 00:12:51,190 --> 00:12:57,270 For example, here you can see the Tesla Model 3, which is in the mid console of the car. 88 00:12:57,530 --> 00:13:06,330 There's one of three CAN buses, which you can easily open and connect to ready-to-buy adapter. 89 00:13:06,330 --> 00:13:09,590 You can buy those adapters easily on eBay, for example. 90 00:13:09,810 --> 00:13:13,650 And then you can gain access to this CAN bus. 91 00:13:14,270 --> 00:13:21,170 If you don't want to destroy your car or altering this, there are also less intrusive techniques. 92 00:13:21,170 --> 00:13:24,050 These are called contactless CAN readers. 93 00:13:24,050 --> 00:13:28,390 They read CAN messages based on induction of the signal. 94 00:13:28,850 --> 00:13:31,290 And that's more or less... it looks like a crocodile. 95 00:13:31,290 --> 00:13:34,170 That's why some products are called CAN crocodile. 96 00:13:34,170 --> 00:13:46,690 You clamp the CAN wires high and low, those dual wires, between the clamp of the contactless CAN reader, and you can read those messages. 97 00:13:47,430 --> 00:13:55,790 So, you have gained access to the physical layer, you have read those physical signals of the CAN bus. 98 00:13:55,790 --> 00:14:01,170 Now you have to transfer them into software, and therefore you need such... 99 00:14:01,690 --> 00:14:11,970 for the Raspberry Pi, for example, a CAN head, where those physical CAN signals are interpreted and transferred to the kernel of the Raspberry Pi. 100 00:14:12,190 --> 00:14:22,630 There are also other options available, which can conveniently be used, where you can connect your CAN bus directly via USB to your PC. 101 00:14:22,630 --> 00:14:26,850 This also works for Windows, so maybe it's for part of you interesting. 102 00:14:27,330 --> 00:14:35,290 So, now we have transferred the message to the software part of our project, and that's where Tim continues. 103 00:14:35,290 --> 00:14:41,350 Alright, so very conveniently in the Linux kernel, there's already a CAN driver built in. 104 00:14:41,350 --> 00:14:48,690 And if you want to work with that, there's CANutils, which has all the basic tools to use that. 105 00:14:48,890 --> 00:14:55,590 Also, if you want to do more advanced stuff for scripting, you can use, for example, PythonCAN as a really good library. 106 00:14:55,590 --> 00:14:57,350 That's what we use for our project. 107 00:14:57,830 --> 00:15:01,050 There's also CANtools for more advanced command-line tools. 108 00:15:01,350 --> 00:15:06,670 If you're into GUIs, there's SavvyCAN, which is a really good open-source GUI tool. 109 00:15:07,110 --> 00:15:09,430 And, of course, there are a lot of commercial tools. 110 00:15:09,430 --> 00:15:11,790 We talked about all this vector stuff before. 111 00:15:12,750 --> 00:15:14,830 But let's stick with the very basics. 112 00:15:14,830 --> 00:15:23,710 So you install CANutils, and then there's this CANdump command, which will just print out all of the CAN messages on the bus. 113 00:15:23,710 --> 00:15:28,170 It looks somehow like this, but probably a lot faster if you're on a real car. 114 00:15:28,810 --> 00:15:36,430 For Tesla, for example, it might be on one bus, I think, like 3,000 messages a second, so it can be quite a lot. 115 00:15:37,070 --> 00:15:51,410 One step back, even, if you connect to this, for Linux, the CAN interface is like any other network interface if your adapter is compatible with SocketCAN. 116 00:15:52,410 --> 00:16:03,510 The only difference is that you don't have a network manager to directly get your interface up and running, and you also need a bitrate. 117 00:16:03,890 --> 00:16:09,740 So you have to tell the computer how fast the bus operates. 118 00:16:09,740 --> 00:16:14,260 You can measure that by using an oscilloscope, of course. 119 00:16:14,800 --> 00:16:20,780 Luckily for automotive, it's usually 500 kilobits per second, so you can also try that. 120 00:16:20,900 --> 00:16:37,680 And just as a disclaimer, there are also more modern standards, like improvements on the CAN standards, for example, CAN FD, and there you will also need to have the data rate, for example. 121 00:16:38,280 --> 00:16:41,320 But let's assume standard CAN for now. 122 00:16:41,880 --> 00:16:44,540 And then we've already seen the candab command. 123 00:16:44,660 --> 00:16:49,040 I just want to walk very quickly through what you can see here. 124 00:16:49,040 --> 00:16:51,900 That's one single message picked out. 125 00:16:51,900 --> 00:16:59,860 You see the interface in the front, if you have multiple CAN interfaces connected, that's important. 126 00:16:59,860 --> 00:17:04,620 Then the CAN ID, and the data length, and the data. 127 00:17:04,620 --> 00:17:14,560 The thing is, this CAN ID, if you're used to IP, you're usually used to having a source and a destination address. 128 00:17:14,640 --> 00:17:17,300 The CAN ID is actually neither. 129 00:17:17,300 --> 00:17:20,040 Think of it more like a publish-subscribe topic. 130 00:17:20,040 --> 00:17:28,500 So it will tell you how to define or how to interpret the bits in the data part. 131 00:17:29,040 --> 00:17:31,180 Also, it's the priority of the message. 132 00:17:31,180 --> 00:17:33,560 So the lower the ID, the higher the priority. 133 00:17:35,240 --> 00:17:40,940 And this data, it can be really arbitrarily defined. 134 00:17:40,980 --> 00:17:49,160 The information in there is called signals, and it can be like 1-bit, it can be 5-bit, it can be all 8-bytes. 135 00:17:49,820 --> 00:17:59,700 So that's up to the manufacturer to define that, and that's why we usually need some reverse engineering to make sense of this information. 136 00:18:00,680 --> 00:18:09,920 Okay, so you might want to get started, but maybe you do not want to remove all the plating of your car. 137 00:18:10,100 --> 00:18:16,520 It sounds like a lot of work to figure out all the wiring and stuff. 138 00:18:17,480 --> 00:18:24,600 So that's actually how we started, but if you don't want to do that, there's also the way the garages do that. 139 00:18:24,600 --> 00:18:33,080 So Janice already spoilered it, that you have this OBD2 connector, and for vehicle diagnostics. 140 00:18:33,720 --> 00:18:45,540 And this connector is usually very conveniently located somewhere in the driver area of your vehicle in front, and you can just plug in a diagnostic connector there. 141 00:18:45,540 --> 00:18:54,640 It's usually an OBD2 dongle, which connects via Bluetooth to a diagnostic device, and will read out data like that. 142 00:18:54,740 --> 00:19:02,540 And the protocol to do this is called UDS, Unified Diagnostic Services, and it's basically a request-response protocol. 143 00:19:02,760 --> 00:19:10,680 The diagnostic tester will, for example, in our case, we want the steering wheel angle, so it will ask, is you responsible for that? 144 00:19:10,680 --> 00:19:12,320 Can you give me the steering wheel angle? 145 00:19:12,320 --> 00:19:14,620 And it will respond with the correct value. 146 00:19:15,000 --> 00:19:19,300 So that's on top of the CAN protocol. 147 00:19:19,300 --> 00:19:23,680 It can also be IP, but usually CAN, or both. 148 00:19:23,700 --> 00:19:31,460 And in between, there's actually another protocol, which is called ISOTP, and which allows to basically combine multiple CAN measures. 149 00:19:31,460 --> 00:19:39,700 They are limited to 8-byte, to one message in UDS, so you can send longer data. 150 00:19:41,040 --> 00:19:46,520 But that comes with the difference that now we also... 151 00:19:46,520 --> 00:19:54,980 I told you before that this is not like source and destination address to CAN ID, but for UDS, it's actually the destination address now. 152 00:19:55,100 --> 00:20:01,780 So there's also, if you want to read data, there's also a data identifier, which identifies which data it is. 153 00:20:01,780 --> 00:20:10,620 So you can have now multiple different interpretations for data with the same CAN ID, and data can be split over multiple CAN frames. 154 00:20:10,620 --> 00:20:11,980 Just watch out for that. 155 00:20:11,980 --> 00:20:16,860 All right, and with that, I think we should have everything ready to go. 156 00:20:16,960 --> 00:20:17,940 Yeah, I think so. 157 00:20:17,940 --> 00:20:28,920 We have considered the physical layer, we have considered the transfer to the software, we have considered how we can interpret those CAN messages, so we have all together to create our game. 158 00:20:29,120 --> 00:20:34,360 And as a small in-between motivation, that's the actual result. 159 00:20:34,360 --> 00:20:37,920 Here you can see Tim sitting in our Volkswagen ID.3. 160 00:20:38,020 --> 00:20:45,440 In front, we have placed a big monitor, playing Need for Speed Most Wanted from 2008, with the actual car. 161 00:20:48,690 --> 00:20:49,790 Thank you. 162 00:20:54,690 --> 00:20:58,630 Here you can see a little bit more of our V2G experience. 163 00:20:58,630 --> 00:21:03,770 On the left side, you can see our setup, a laptop where the game is actually running. 164 00:21:03,770 --> 00:21:12,210 In front of the car, we have placed a huge monitor for a very immersive experience for the driver, but also for all other people inside the car. 165 00:21:12,210 --> 00:21:16,870 On the right side, you can see me playing, again, Need for Speed Most Wanted. 166 00:21:16,930 --> 00:21:19,930 And you can see I'm very focused on this game. 167 00:21:19,930 --> 00:21:26,210 So, as I said, it's very immersive, and it's a very cool experience sitting in such an equipped car. 168 00:21:28,290 --> 00:21:34,770 But how can we now connect the laptop, the game, with the car? 169 00:21:34,770 --> 00:21:37,410 You can see on the right, the topology again. 170 00:21:38,050 --> 00:21:42,490 Therefore, we have several possibilities to connect the car. 171 00:21:42,490 --> 00:21:44,490 First, we can use wires. 172 00:21:44,490 --> 00:21:55,030 We can use the USB-based P-CAN Pro, for example, connecting, as one possibility, to the internal CAN bus. 173 00:21:55,230 --> 00:22:00,310 Therefore, we have to figure out which CAN bus relevant messages are located on. 174 00:22:00,630 --> 00:22:15,070 We have to find the relevant messages, figuring out the relevant signals of the CAN messages, and there's an overwhelming number of CAN messages on this internal bus. 175 00:22:15,070 --> 00:22:18,330 As Tim said, several thousands per second. 176 00:22:18,330 --> 00:22:22,590 So it's quite difficult to figure this stuff out. 177 00:22:22,730 --> 00:22:43,790 Also, the whole breakout box stuff we've shown to you is required to get access to those internal buses, so the more convenient solution is connecting directly to the OBD2 port and use the diagnostic services for pulling those informations and getting conveniently just the requested information. 178 00:22:44,210 --> 00:22:48,470 But since we live in 2024, wires are a little bit outdated. 179 00:22:48,470 --> 00:23:02,650 We have created a Raspberry Pi head, which allows us to emulate an Xbox 360 controller with a Raspberry Pi Zero, connecting directly to the OBD2 port of the car. 180 00:23:02,650 --> 00:23:12,990 And this Raspberry Pi connects via Bluetooth to the laptop, emulates this controller, and the laptop can stand outside the car and runs the game. 181 00:23:13,470 --> 00:23:16,650 For this setup, we use UDS. 182 00:23:18,650 --> 00:23:23,790 Now, a little bit into detail of the actual hardware we use for it. 183 00:23:24,190 --> 00:23:30,490 The lower layer of this, you can see it's a classical Raspberry Pi Zero with no modifications. 184 00:23:30,490 --> 00:23:43,230 Above that, we have located the Raspberry Pi CAN head, which is responsible for converting those physical CAN signals to a software-readable CAN message. 185 00:23:43,370 --> 00:23:57,370 And the top layer, we have created a self-designed PCB for connecting to this OBD2 port of the car. 186 00:23:57,370 --> 00:24:03,090 From this OBD2 port, we only use four connections. 187 00:24:03,090 --> 00:24:07,670 The 12V, the ground, the CAN high and CAN low connection. 188 00:24:07,910 --> 00:24:18,690 The CAN high and CAN low connection is directly transferred via this PCB to the lower CAN head, which converts this message. 189 00:24:19,050 --> 00:24:24,710 But the more interesting part of this PCB is the 12V, 5V DC-DC conversion. 190 00:24:24,710 --> 00:24:33,970 So we can very conveniently connect this dongle to our car without the requirement for a power bank and power supply of the Raspberry Pi. 191 00:24:34,430 --> 00:24:42,150 As a short disclaimer, we are no electrical engineers, so if you have any recommendation about this, feel free to contact us. 192 00:24:42,150 --> 00:24:45,550 We are quite happy about recommendations. 193 00:24:45,570 --> 00:24:53,510 This circuit for 12V, 5V DC-DC conversion is just taken out of the datasheet of the used IC. 194 00:24:54,870 --> 00:24:58,850 Feel free to come offstage to us and discuss it with me. 195 00:25:01,990 --> 00:25:07,110 We have also added the possibility to add status LEDs, but that's to be done. 196 00:25:09,370 --> 00:25:17,490 They are connected to the GPIO pins of the Raspberry Pi, so if you want to extend the project, you can use them for your own purpose. 197 00:25:18,350 --> 00:25:20,030 So, we have the hardware. 198 00:25:20,570 --> 00:25:22,150 Now, the software. 199 00:25:23,110 --> 00:25:27,970 I'm just going very briefly over the software architecture of our tool. 200 00:25:27,970 --> 00:25:34,310 So, if you want to use it in the Bluetooth mode, as a Bluetooth controller, there's an install script for that. 201 00:25:34,310 --> 00:25:42,010 You just run it on your pre-imaged Raspberry Pi and it will set up everything which is required. 202 00:25:42,670 --> 00:25:45,810 If you don't want to do it, then just run it on your own laptop. 203 00:25:45,810 --> 00:25:48,130 There's a run script for Linux. 204 00:25:48,130 --> 00:25:51,370 For Windows, you just directly run the Python protocol. 205 00:25:52,910 --> 00:26:06,190 The run script actually will also set up some interfaces and stuff, but you can do this beforehand if you do not want to execute it with pseudo-privileges, because that's required for interface management. 206 00:26:06,810 --> 00:26:25,530 Then, for emulating the game controller, for the Bluetooth version, we used the HitPi project to emulate a Bluetooth device, and if you run it on your own laptop, we used the VGamePad library, which is also cross-platform, so it also runs on Windows. 207 00:26:27,330 --> 00:26:29,590 You can also use that. 208 00:26:29,830 --> 00:26:41,110 For the Bluetooth one, it doesn't really work on Windows so far, so if you have any recommendations on that, and are an expert on Hit devices, also pull requests are welcome. 209 00:26:42,730 --> 00:26:49,390 So, now to our actual domain components. 210 00:26:49,390 --> 00:26:50,570 We have a car detector. 211 00:26:50,570 --> 00:27:02,150 If you have multiple vehicles, as we have the ID3 and the Tesla, you can give it basically a list of CAN IDs, and it will figure out which car it is, and then use the according configuration. 212 00:27:02,470 --> 00:27:14,750 The heart of our project is the car connector, which will convert all the CAN signals in the messages to triggers for the Xbox emulation. 213 00:27:15,290 --> 00:27:21,330 And then there is the vehicle configuration, which has all the vehicle-specific stuff in there. 214 00:27:21,330 --> 00:27:25,150 And I'll just have a more detailed look on that. 215 00:27:28,490 --> 00:27:32,110 You can configure a name for your vehicle to reference it. 216 00:27:32,510 --> 00:27:37,590 Then you have to specify which operation mode, if you want to use the internal mode or the UDS mode. 217 00:27:37,590 --> 00:27:47,890 Sometimes, if you have an older car, where there is no gateway in between the internal buses and the OBD2 connector, you can also use the internal mode for that. 218 00:27:48,390 --> 00:27:54,790 Or if you install the OBD2 adapter for the Tesla. 219 00:27:56,350 --> 00:28:05,470 Otherwise, for the UDS mode, you will also have what you can see on the right side, and you will have to send those polling messages I talked about earlier. 220 00:28:05,470 --> 00:28:11,390 Basically, you can just paste them in here, and it will periodically send them to get the data. 221 00:28:11,390 --> 00:28:13,870 There is also an update interval. 222 00:28:14,510 --> 00:28:19,250 Usually, we have a higher interval for the steering angle and brakes. 223 00:28:19,250 --> 00:28:25,430 And for the buttons, we use a lower update interval, because there is a limit how fast the ECUs will respond. 224 00:28:26,170 --> 00:28:27,310 Also, we have some... 225 00:28:27,310 --> 00:28:30,430 You can see the auto-detect IDs I mentioned before. 226 00:28:30,430 --> 00:28:34,730 And also, we have some high-level configuration stuff. 227 00:28:34,730 --> 00:28:45,290 For example, we limit the steering, because if you play a racing game, and you have to two times turn the wheel for the maximum steering, it's just too slow, right? 228 00:28:45,630 --> 00:28:57,490 And also, there is the steering dead zone, which basically, you have a bit more space to set your steering wheel to zero. 229 00:28:57,490 --> 00:29:10,310 Because otherwise, if it's like 0.01 degrees, and it will always go left in the menus, or you just cannot drive straight, it's actually pretty hard to get your steering wheel to exactly zero degrees. 230 00:29:10,510 --> 00:29:12,070 So, that's pretty handy. 231 00:29:12,990 --> 00:29:17,210 I'll go a bit into detail on the signal configuration later. 232 00:29:17,870 --> 00:29:22,550 But for now, let's look at how it works out. 233 00:29:22,550 --> 00:29:24,230 Yeah, we are ready to play. 234 00:29:24,230 --> 00:29:29,930 Unfortunately, we are not allowed to bring our car with us, so we have brought some videos of the gaming experience. 235 00:29:29,930 --> 00:29:35,850 You can see me here driving with first-person view, playing SuperTux Kart. 236 00:29:39,740 --> 00:29:45,700 You can see I control the racing car with the steering wheel, left and right. 237 00:29:45,700 --> 00:29:50,740 And now I've paused, because you can see I put my foot on the brake. 238 00:29:50,880 --> 00:29:52,860 Let's see what happens next. 239 00:29:55,290 --> 00:30:01,270 As expected, the racing car slows down, and I was overtaken. 240 00:30:02,450 --> 00:30:09,690 Now, you can see I've started the indicator. 241 00:30:09,710 --> 00:30:15,590 We've mapped the indicator function for left to throwing items in this game. 242 00:30:15,590 --> 00:30:20,130 You can do this for your own purpose, for your own game, but we've mapped it like this. 243 00:30:20,450 --> 00:30:31,010 So you can see here, I'm throwing this exploding muffin to the racing car in front of me, so it will explode. 244 00:30:31,010 --> 00:30:53,130 Unfortunately, because PowerPoint is a little bit annoying, sometimes, usually you should see that I've turned on the full beam flash, full beam 2, so we've mapped the full beam trigger to the nitro activation in the game. 245 00:30:53,590 --> 00:30:58,710 So it's very cool, driving in the night, igniting, and the car speeds up. 246 00:30:59,930 --> 00:31:01,050 See what happens? 247 00:31:01,050 --> 00:31:04,410 You can see the nitrogen. 248 00:31:04,490 --> 00:31:26,110 Now, you can see it's a little bit difficult to drive, especially with just one hand, but it is possible to race, it is possible to overtake enemies in this game, and it is also possible for you to get the right items, in this example, an acceleration one, 249 00:31:26,110 --> 00:31:28,270 to win racing games. 250 00:31:33,120 --> 00:31:35,300 And it's actually a lot of fun. 251 00:31:36,000 --> 00:31:38,860 You see, we're very excited about this. 252 00:31:40,580 --> 00:31:43,880 So, maybe, over to Tim. 253 00:31:43,880 --> 00:31:52,420 So, the question all of you probably have in your mind, how do you support your own car to use this? 254 00:31:52,420 --> 00:32:00,580 Well, before you get started on that, just make sure you keep in mind the safety. 255 00:32:00,640 --> 00:32:04,180 So, make sure you cannot accidentally drive into a wall. 256 00:32:04,180 --> 00:32:04,580 Why? 257 00:32:04,920 --> 00:32:14,720 Because if you're in your garage, and you're really into your game, and by accident you switch to drive mode, you don't want to do that. 258 00:32:15,500 --> 00:32:18,660 You're probably out on the gas, right? 259 00:32:18,660 --> 00:32:21,320 So, make sure you cannot do that. 260 00:32:21,320 --> 00:32:34,720 Of course, there's less of a problem on combustion engine vehicles, where you do not have to turn on the engine, but then make sure not to drain your 12-volt battery, like playing all night. 261 00:32:36,020 --> 00:32:41,160 It's probably not good if you do not have a charger connected. 262 00:32:42,120 --> 00:32:43,700 So, what do you need? 263 00:32:43,700 --> 00:32:46,060 I think we talked about everything of that. 264 00:32:47,040 --> 00:32:56,820 You can also use just an OBD2 open-ended cable, if you do not want to solder your own OBD2 head. 265 00:32:57,220 --> 00:33:01,100 So, that all should be less than 50 bucks, I think, to get started. 266 00:33:01,560 --> 00:33:10,020 If you use the diagnostic mode, and you have to get a diagnostic tester to reverse-engineer that, that really depends on the car, probably. 267 00:33:10,020 --> 00:33:17,100 There are sometimes some very cheap ones, and if you have to get a garage-level one, it's pretty expensive. 268 00:33:17,100 --> 00:33:20,580 So , yeah, probably too much. 269 00:33:21,060 --> 00:33:24,140 Okay, and then you can start reverse-engineering. 270 00:33:24,260 --> 00:33:27,540 So, here you can see the UDS tester setup, basically. 271 00:33:28,540 --> 00:33:32,080 The actuator, we are looking at a steering wheel angle, as before. 272 00:33:32,440 --> 00:33:38,880 Here we have a tablet with the diagnostic tool, which reads out the steering angle. 273 00:33:38,880 --> 00:33:47,620 And here we have my laptop, which runs CanSniffer, which is a very convenient tool to show you the differences in car messages. 274 00:33:48,120 --> 00:33:54,420 And what we'll do next is turn the steering wheel to see where the information is. 275 00:33:55,300 --> 00:34:07,300 And actually, I turn it one time completely to the left, and one time to the right to get the min and maximum value, which is possible for the signal, but you have seen where it is located. 276 00:34:08,720 --> 00:34:19,520 And, yeah, sometimes you're lucky, and you will find already complete CAN database files, those called DBC files, online for your car. 277 00:34:19,520 --> 00:34:24,680 Then you can also try to get this information out of there and use that. 278 00:34:24,680 --> 00:34:34,040 But otherwise, reverse-engineering of this data is quite good because it's like you can easily turn the steering wheel to see where the data is, right? 279 00:34:34,040 --> 00:34:39,220 It's just if there are 3,000 messages, it might take you some time to find the right one. 280 00:34:39,220 --> 00:34:49,280 Then for configuring it, you basically add all this information, the CAN ID, the position in the signal, and the length of the data. 281 00:34:49,460 --> 00:34:52,080 And then that's why we use Python for the configuration. 282 00:34:52,080 --> 00:34:58,000 You can just use a function to specify the signal mapping. 283 00:34:58,220 --> 00:35:11,180 In this case, we have the first byte turning to the left, the second to the right, and then we specify the min and maximum value and map this to a range of minus 1.0 to 1.0. 284 00:35:12,800 --> 00:35:18,360 All right, that's what you need to configure for your own car. 285 00:35:19,420 --> 00:35:29,760 In conclusion of this talk, if anybody asks you, especially our professor, now you definitely know that V2G stands for Vehicle-to-Game. 286 00:35:31,580 --> 00:35:34,320 Car hacking can be really fun. 287 00:35:34,320 --> 00:35:47,240 And I think our project is a great entry point if you want to get into that or just want to be able to say that you have a very expensive game controller at home. 288 00:35:48,240 --> 00:35:50,680 Always be careful if you do that stuff. 289 00:35:50,680 --> 00:35:52,380 Do not drive into walls. 290 00:35:53,520 --> 00:35:59,420 We actually use it, as Janis said before, as a demonstrator to motivate students to show it to visitors. 291 00:35:59,420 --> 00:36:06,080 It's always a good icebreaker to get started about talking about automotive security. 292 00:36:06,620 --> 00:36:11,680 And so the only question that remains is, what are you going to use it for? 293 00:36:18,810 --> 00:36:20,690 Feel free to contact us. 294 00:36:20,690 --> 00:36:23,190 Do any contributions to our project. 295 00:36:23,190 --> 00:36:24,070 Write us an email. 296 00:36:24,070 --> 00:36:25,770 Here you can see the QR code. 297 00:36:25,770 --> 00:36:32,850 The Git repository is public, so you can make an issue or do a pull request. 298 00:36:32,850 --> 00:36:33,770 Feel free. 299 00:36:33,870 --> 00:36:37,050 We're happy if we can keep in contact with you. 300 00:36:38,610 --> 00:36:42,890 And I think we have eight minutes left for questions, if there are any. 301 00:36:42,890 --> 00:36:46,730 Otherwise, we can also take further questions offstage. 302 00:36:50,520 --> 00:36:55,020 Have you thought about playing with heads-up display? 303 00:36:55,020 --> 00:36:56,700 You know, you can get these things now. 304 00:36:56,700 --> 00:37:05,700 You just put it on the dash and it'll actually just reflect your iPad or anything up onto the windscreen. 305 00:37:05,700 --> 00:37:09,280 And it looks like a heads-up display kind of a thing. 306 00:37:09,280 --> 00:37:10,520 Have you thought about that? 307 00:37:10,520 --> 00:37:15,960 Just for a way to project onto the screen. 308 00:37:17,520 --> 00:37:18,760 Where's the question? 309 00:37:18,760 --> 00:37:27,720 Oh yeah, so the question was if we have thought about projecting the game, basically, onto the screen of the car. 310 00:37:27,720 --> 00:37:29,640 So we've thought about that. 311 00:37:29,640 --> 00:37:30,680 We haven't done it. 312 00:37:30,680 --> 00:37:34,620 We also thought about it because the ID3 actually has a heads-up display. 313 00:37:36,540 --> 00:37:42,860 Yeah, so I think there are adapters to the protocol they use there. 314 00:37:42,860 --> 00:37:48,040 And then you can use it as an HDMI interface, basically, if you plug in there. 315 00:37:48,040 --> 00:37:50,660 So we have some plans, maybe, for the future. 316 00:37:50,660 --> 00:37:54,400 But we actually haven't done that or tested it. 317 00:37:54,400 --> 00:38:01,200 Just putting a projector in the back of the car is probably quite good. 318 00:38:01,200 --> 00:38:03,120 It's not a security-related problem. 319 00:38:03,120 --> 00:38:07,200 It's just throwing money on it via such a converter. 320 00:38:07,240 --> 00:38:11,100 And then you can easily connect your laptop with those internal screens of the car. 321 00:38:11,100 --> 00:38:13,900 That's expensive but easily doable. 322 00:38:15,900 --> 00:38:19,680 Yeah, but come up with your own setup. 323 00:38:19,680 --> 00:38:22,600 I think there's a lot of possibility, right? 324 00:38:23,140 --> 00:38:24,100 Yeah. 325 00:38:27,050 --> 00:38:32,210 The question was how if we build up a flight simulator out of this. 326 00:38:32,210 --> 00:38:35,590 If you have a real airplane, maybe you can transfer this. 327 00:38:37,030 --> 00:38:38,010 I don't know. 328 00:38:38,010 --> 00:38:40,270 Maybe you can use also your car for this. 329 00:38:40,270 --> 00:38:41,330 It should be possible. 330 00:38:41,330 --> 00:38:43,390 It's just an Xbox controller. 331 00:38:43,810 --> 00:38:46,290 You can map it to anything you want. 332 00:38:48,250 --> 00:38:49,990 Okay, any further questions? 333 00:38:49,990 --> 00:38:50,610 No? 334 00:38:50,610 --> 00:38:51,070 No. 335 00:38:51,070 --> 00:38:51,850 Alright. 336 00:38:51,950 --> 00:38:53,730 Okay, thank you. 337 00:38:53,730 --> 00:38:55,750 Thanks for listening and have a nice day. 338 00:38:55,750 --> 00:38:57,070 Enjoy the last day of DEF CON.