[00:00.870 --> 00:02.510] Okay, so what are we going to cover today? [00:02.510 --> 00:06.290] We're going to explain what a vehicle diagnostics adapter, [00:06.290 --> 00:07.710] or VDA, is to you. [00:08.250 --> 00:10.170] Then we're going to talk about, you know, [00:10.170 --> 00:13.330] some research we did attacking the VDA. [00:13.810 --> 00:15.370] And then we're going to talk about ways [00:15.370 --> 00:18.790] and approaches we took to defend the VDA. [00:19.390 --> 00:20.690] And then finally, we're going to talk about [00:20.690 --> 00:24.050] some educational things we did with the VDA. [00:24.210 --> 00:26.330] So specifically, we had four challenges [00:26.330 --> 00:28.330] in last year's Car-Convilled CTF [00:29.010 --> 00:31.730] that were based around the VDA. [00:31.730 --> 00:33.410] This is a picture of it here. [00:33.410 --> 00:35.170] We had it in Vegas mode, so... [00:38.780 --> 00:40.380] Yeah, look at that. [00:41.320 --> 00:43.960] Binary modification for Vegas mode, awesome. [00:44.420 --> 00:46.320] And we also did some educational things [00:46.320 --> 00:48.820] at the Cybertruck Challenge we'll talk about. [00:49.180 --> 00:51.580] So Alex and I are on stage today, [00:51.580 --> 00:54.980] but Edward and Sam did a lot of this work as well [00:54.980 --> 00:58.100] as a team effort, so we wanted to acknowledge them. [00:58.100 --> 01:01.060] We also wanted to acknowledge Dr. Jeremy Daly, [01:01.060 --> 01:05.080] who put us on the path to looking at VDAs. [01:05.720 --> 01:10.840] And Friendly Vendor Person, who will not be named today, [01:10.840 --> 01:12.840] but helped give us some of the VDAs [01:12.840 --> 01:14.800] for some of the educational things, [01:14.800 --> 01:16.700] and was a really good partner working with us [01:16.700 --> 01:21.620] to shine light on this part of trucking security. [01:21.880 --> 01:22.560] Cool. [01:26.760 --> 01:27.660] All right, so finally, [01:27.660 --> 01:29.840] what is a vehicle diagnosis adapter? [01:31.140 --> 01:36.060] So your truck has an OBD port in it. [01:36.060 --> 01:38.940] It's a thing that technicians can plug into [01:39.480 --> 01:43.140] to pull diagnostic information off the truck. [01:43.180 --> 01:45.320] I think the VIN number comes through there as well, [01:45.320 --> 01:46.900] so you can pull the VIN number through there, [01:46.900 --> 01:49.540] and also some information from some of the ECUs [01:49.540 --> 01:51.160] or the controllers on the truck. [01:51.820 --> 01:54.460] It also sometimes is used to flash the firmware [01:54.460 --> 01:56.320] of the ECUs within the truck. [01:56.360 --> 01:58.100] So the idea is you pull into a service station, [01:58.100 --> 01:59.120] you can plug in there, [01:59.120 --> 02:01.200] and I guess the way they do it [02:01.200 --> 02:03.420] is there's a little computer, the VDA, [02:03.420 --> 02:05.460] that actually plugs into the truck. [02:06.440 --> 02:07.260] And then there's a, [02:07.260 --> 02:09.040] for some reason it's always a Windows computer [02:09.540 --> 02:11.200] that plugs into the VDA. [02:11.440 --> 02:12.900] So you have like a Windows laptop [02:13.440 --> 02:16.680] with these vendor DLLs that, [02:16.680 --> 02:19.060] there's kind of like a joint protocol, [02:19.060 --> 02:20.820] I think it's called RP-1210, [02:20.820 --> 02:22.920] that everyone used to talk to the VDA, [02:22.920 --> 02:24.700] then the VDA talks to the truck, [02:24.700 --> 02:26.920] and it pulls data back and forth from it. [02:28.180 --> 02:29.900] And you can kind of see here on the right, [02:29.900 --> 02:32.300] this is kind of a diagram of the VDA we looked at. [02:32.300 --> 02:35.100] So on the right, there's the computer interface, [02:35.100 --> 02:38.600] so the USB, Bluetooth, and Wi-Fi, [02:38.600 --> 02:41.480] also is how you connect directly to the VDA. [02:41.560 --> 02:44.880] And then the micropositor connects to the vehicle network, [02:44.880 --> 02:48.300] usually over J1939, unless it's really old. [02:50.760 --> 02:52.840] Okay, so congratulations, [02:52.840 --> 02:54.460] we all now know what a VDA is. [02:56.920 --> 02:59.280] Okay, so now we're gonna talk about attacking the VDA. [03:01.780 --> 03:04.340] So we do a lot of embedded device security around balloons, [03:04.340 --> 03:06.380] so attacking embedded devices, [03:06.380 --> 03:08.660] it's a pretty simple formula. [03:09.160 --> 03:10.980] First, you need to get the thing. [03:11.880 --> 03:13.720] The internet is really good with this. [03:13.920 --> 03:17.000] Pro tip, get more than one of the things, [03:17.000 --> 03:19.880] because you'll probably break one of them in the process. [03:20.080 --> 03:22.280] I think you broke one of these, yeah. [03:23.320 --> 03:25.420] Then you wanna do the hardware reversing. [03:27.160 --> 03:29.700] Figure out, I guess, enumerate all the components [03:29.700 --> 03:32.400] on the board, figure out if it has JTAG, UART, [03:32.400 --> 03:33.440] stuff like that. [03:33.440 --> 03:35.360] Then you wanna get the firmware either from the board [03:35.360 --> 03:37.660] or from some sort of firmware update thing. [03:37.820 --> 03:39.420] Reverse the firmware, [03:39.420 --> 03:41.240] figure out how to update the firmware. [03:42.680 --> 03:44.500] And then if you can modify the firmware [03:44.500 --> 03:46.280] and put the modified firmware back on, [03:46.280 --> 03:47.840] you can change how it works. [03:48.100 --> 03:49.580] And then you win. [03:49.840 --> 03:51.100] So this is pretty complicated, [03:51.100 --> 03:53.760] so when we started working on this, [03:53.760 --> 03:55.220] we decided that it was so hard [03:55.220 --> 03:57.760] that only our interns could do it. [03:58.800 --> 04:00.200] And so that's where Alex came in. [04:00.200 --> 04:02.340] He was an intern at the time, he's a full-time employee now. [04:02.340 --> 04:05.400] So he's gonna walk you through the work he did as an intern, [04:05.400 --> 04:07.580] you know, trying to figure out how this thing works. [04:10.400 --> 04:13.720] Awesome, so the first step that we always go through [04:14.300 --> 04:15.580] when reversing a new device [04:15.580 --> 04:17.900] is grabbing your favorite screwdriver set [04:17.900 --> 04:19.100] and taking it apart. [04:19.600 --> 04:22.680] So that's what we did. [04:23.160 --> 04:26.920] This is a shot of the PCB of one of the VDAs. [04:27.440 --> 04:29.640] And as you can see, the vendor did a great job [04:30.240 --> 04:33.020] making connecting to JTAG and UART super hard [04:33.020 --> 04:36.360] by giving us really awesome adapters to use [04:36.360 --> 04:37.680] and just plug into. [04:38.540 --> 04:42.060] We've identified the flash, the microcontroller, [04:42.060 --> 04:47.420] and then a Wi-Fi chip and a Bluetooth chip on this board. [04:47.600 --> 04:50.780] Now, the more astute of you might be noticing... [04:52.880 --> 04:57.660] the Wi-Fi chip has a Wi-Fi and Bluetooth stack, [04:58.060 --> 05:00.860] but there's also a Bluetooth chip on the board, [05:00.860 --> 05:03.820] which begs the question, why? [05:06.680 --> 05:08.520] We don't have a great answer. [05:08.520 --> 05:10.240] I think these memes probably illustrate [05:10.240 --> 05:11.860] some of our confusion as to why [05:11.860 --> 05:15.100] there were two independent Bluetooth stacks on this device, [05:15.100 --> 05:17.960] but it had both. [05:18.560 --> 05:21.320] So once we took a look at the hardware [05:23.360 --> 05:26.200] and read a couple of data sheets, [05:26.200 --> 05:29.700] we were able to make a super legit power adapter [05:29.700 --> 05:33.560] to plug in the VDA in a way that it's not normally powered. [05:33.580 --> 05:35.260] Yeah, this is what happens when you tell an intern [05:35.260 --> 05:39.060] to power a VDA, but it gets the job done, so that's cool. [05:40.080 --> 05:44.480] And then just grab your favorite female adapter cables [05:44.480 --> 05:49.120] to connect to the UART and not have to do any work with that, [05:49.120 --> 05:51.140] really, because the vendor provided a handy-dandy [05:51.140 --> 05:52.400] interface. [05:54.540 --> 05:57.760] So once we connected to the UART, [05:57.760 --> 06:01.400] unlike most devices that try and obfuscate [06:01.400 --> 06:03.320] and make it really difficult to find out [06:03.320 --> 06:05.540] what the debug options are on a shell, [06:07.700 --> 06:11.720] the vendor just gave us a really easy way of dumping memory. [06:11.720 --> 06:14.980] So, you know, we typed in dump invalid option [06:14.980 --> 06:18.100] and then got every possible permutation of dumping [06:18.100 --> 06:19.260] we could ever want. [06:19.260 --> 06:20.820] So it was pretty simple. [06:20.820 --> 06:23.960] We're just like, hey, can we get the first copy of firmware [06:23.960 --> 06:25.220] on the device? [06:27.040 --> 06:30.920] And then it spits it out handy-dandy over ASCII over UART. [06:30.920 --> 06:34.480] So, you know, I wrote a really complicated extraction algorithm, [06:34.480 --> 06:37.480] which is dump the whole firmware to serial [06:37.480 --> 06:41.420] and then write a Python program to convert that into binary. [06:46.930 --> 06:50.790] So once we actually had the bytes of the firmware [06:51.350 --> 06:53.290] sitting in memory on the device, [06:53.290 --> 06:57.130] what we wanted to do is reverse engineer the file format [06:57.130 --> 06:59.330] that actually puts those bytes on the device [06:59.330 --> 07:02.090] so then we can see whether we can actually change [07:02.090 --> 07:04.590] the bytes that are put on the device. [07:04.850 --> 07:07.410] So as Wyatt mentioned, [07:07.410 --> 07:10.850] this piece of hardware uses a Windows laptop [07:10.850 --> 07:13.950] in order to do the firmware update. [07:13.970 --> 07:16.470] And so I was a little worried [07:16.470 --> 07:18.150] because I hadn't done Windows reversing [07:18.150 --> 07:20.150] that this would be kind of complicated. [07:20.150 --> 07:23.410] But it turns out the firmware update format file [07:23.410 --> 07:27.450] was just put in the files for the application on Windows, [07:27.450 --> 07:28.930] like called firmware.bin. [07:28.930 --> 07:31.480] So that took about two seconds to look at. [07:32.010 --> 07:34.730] And then we had the full firmware update file [07:34.730 --> 07:36.330] for the manufacturer. [07:40.450 --> 07:45.270] This is a colorized GIF of me reversing the firmware update. [07:45.570 --> 07:46.890] It did not take that long. [07:46.890 --> 07:48.370] We're not going to go into the details [07:48.370 --> 07:50.710] of how this firmware format actually works. [07:50.710 --> 07:53.190] But if you spend enough time looking at it, [07:53.190 --> 07:55.350] you will be able to figure it out. [07:56.050 --> 07:58.010] And once we did that, [07:58.650 --> 08:01.590] we knew how the vendor firmware update file [08:01.590 --> 08:05.470] translates to the bytes actually sitting in memory on the device. [08:08.620 --> 08:12.940] So once we'd done all that really complicated reversing work, [08:13.660 --> 08:16.260] we wanted a way to be able to replicate that [08:16.260 --> 08:18.780] so no one would have to go through the same process. [08:18.780 --> 08:22.240] So internally, this is our tool called OFrac. [08:22.240 --> 08:25.040] This is what Red Balloon Security uses internally. [08:25.200 --> 08:28.340] It's also open source. You guys can try it at home. [08:28.760 --> 08:33.240] And it allows us to very easily go through all of the steps [08:33.240 --> 08:37.020] that we normally do to reverse engineer and modify firmware [08:37.020 --> 08:41.180] so we can identify arbitrary binary formats, [08:41.180 --> 08:46.320] unpack them, analyze them, make the changes that we want, [08:46.320 --> 08:50.540] and then repack them up in the format that the device expects. [08:51.380 --> 08:55.240] It's in Python, and we have a really snazzy GUI on the right. [08:55.400 --> 08:57.460] If you guys want to take a look at it in more depth, [08:57.460 --> 09:00.060] we'll be at our booth over there demoing it. [09:03.580 --> 09:05.660] So after I reverse the format, [09:06.280 --> 09:07.940] we can write a script in Python [09:10.080 --> 09:11.840] that specifies the firmware format [09:11.840 --> 09:14.460] and allows us to make the modifications programmatically [09:14.460 --> 09:15.920] and have it spit out a binary [09:15.920 --> 09:18.840] that we can just drop back on the device. [09:19.400 --> 09:21.320] So saving a lot of time for anyone else [09:21.320 --> 09:23.080] to have to do any of the reversing. [09:29.460 --> 09:33.080] So now that we know how to make the firmware file [09:33.520 --> 09:35.420] for the device to take, [09:35.420 --> 09:38.560] we wanted a more fun way of putting it on the device [09:38.560 --> 09:41.700] than just putting that file back in the Windows file system [09:41.700 --> 09:44.920] and clicking through the vendor tool to actually put it on. [09:45.100 --> 09:48.200] So the firmware update happened over USB. [09:48.820 --> 09:52.140] So, you know, computer connected to a thing over USB. [09:52.720 --> 09:55.100] What do you do? You sniff the USB traffic [09:55.100 --> 09:56.960] and store it as a PCAP. [09:57.560 --> 10:00.700] And then we spent a really long time reversing it. [10:00.700 --> 10:02.120] We're going to go through the protocol later [10:02.120 --> 10:04.680] and then wrote our own little Python script [10:05.180 --> 10:06.480] to just do the firmware update [10:07.160 --> 10:08.600] and then got rid of our Windows laptop [10:08.600 --> 10:10.380] because we don't really like Windows. [10:15.440 --> 10:19.380] So to go over the super complicated update procedure [10:19.380 --> 10:20.940] of this device, [10:20.940 --> 10:23.680] you first have to send hex 3 [10:24.100 --> 10:26.700] and then the size of the firmware update in hex [10:26.700 --> 10:31.000] as a USB packet and then wait for it. [10:33.310 --> 10:36.990] You just send the entire bytes of the firmware update. [10:37.390 --> 10:40.150] There's no encryption. There's no signature. [10:40.150 --> 10:41.790] It has a CRC check, [10:41.790 --> 10:44.310] but you basically just slop it in a USB packet [10:44.310 --> 10:47.030] and it just takes it up and rewrites the firmware. [10:49.950 --> 10:52.370] For those playing at home, there's bonus points. [10:52.370 --> 10:56.550] This same unauthenticated firmware update works over HTTP. [10:56.550 --> 10:58.450] So if you have Wi-Fi on the device, [10:58.450 --> 11:00.610] you could very easily just connect to the access point [11:00.610 --> 11:04.850] and then do this exact same update format over HTTP. [11:10.300 --> 11:14.300] So now we have a full way of having bytes [11:14.300 --> 11:15.440] that we can modify our computer [11:15.440 --> 11:18.120] and putting it on the target device. [11:18.120 --> 11:20.320] So what do we do with that? [11:20.420 --> 11:22.140] Well, the first thing that we always do [11:22.140 --> 11:24.120] when performing this type of analysis [11:24.120 --> 11:26.500] is testing that are unpacking and repacking [11:26.500 --> 11:28.960] and this whole process works correctly. [11:28.960 --> 11:30.340] So the first thing that we normally do [11:30.340 --> 11:31.800] is just by modifying a string [11:32.190 --> 11:34.260] and seeing whether the device still boots. [11:34.900 --> 11:36.120] So that worked. [11:36.860 --> 11:38.840] And then we wanted to do something more fun, [11:38.840 --> 11:40.100] which we showed you at the beginning, [11:40.100 --> 11:44.320] which was the LED toggle that we hooked into ping. [11:44.880 --> 11:48.300] So you can see the code on the right, pretty complicated. [11:48.300 --> 11:50.160] But again, we used OFRAC, [11:50.160 --> 11:53.420] which is our custom unpacker and packer tool, [11:53.420 --> 11:56.140] in order to put this code into the binary. [11:56.140 --> 11:57.860] And specifically, we used OFRAC [11:57.860 --> 11:59.880] with a tool we wrote called Patchmaker, [11:59.880 --> 12:02.920] which allows us to compile C into bytes [12:02.920 --> 12:05.900] and then link it into the full firmware image. [12:05.920 --> 12:08.220] So it's really easy to iterate and write code [12:08.220 --> 12:10.100] and just plunk it back in the binary [12:10.100 --> 12:11.940] without having to deal with any linking. [12:12.420 --> 12:19.380] So this case was a little bit more difficult than normal. [12:19.380 --> 12:21.720] If you can see on the top left, [12:21.720 --> 12:26.620] the compiler directive, underscore, underscore, reg args. [12:27.220 --> 12:30.220] The calling convention for this toggle LED function [12:30.220 --> 12:32.540] was kind of abnormal. [12:32.980 --> 12:35.600] So the architecture of this was Motorola Coldfire. [12:36.100 --> 12:38.060] And for this specific function, [12:38.060 --> 12:41.160] you needed to pass in the first argument as a register, [12:41.160 --> 12:44.800] which kind of messed with our compiler toolchain. [12:44.800 --> 12:48.420] So we had to use a different toolchain [12:48.420 --> 12:51.280] written by the wonderful Dr. Volkel Barthelme. [12:51.880 --> 12:54.920] Shout out to him, who made the VBCC toolchain. [12:54.920 --> 12:56.860] And then we just had to integrate it into our tool [12:57.880 --> 12:59.560] and compile that code in, [12:59.560 --> 13:02.560] and then, boom, just add in our modification. [13:03.020 --> 13:06.940] Yeah, Dr. Volkel Barthelme. His website's pretty cool. [13:06.940 --> 13:08.380] I would definitely check it out. [13:09.200 --> 13:12.520] VBCC supports a lot of architectures. [13:12.520 --> 13:15.120] It looks like it's from the 90s, but we built it, [13:15.120 --> 13:17.160] and it worked right away. [13:17.540 --> 13:20.180] So just to highlight this, this is kind of how we do [13:20.740 --> 13:23.220] binary modification with OFRAC. [13:23.220 --> 13:28.120] We can use runPingCMD as a function we found in the binary, [13:28.120 --> 13:30.740] and we wanted to overplace it so whenever we pinged, [13:30.740 --> 13:32.520] we would toggle the LED lights. [13:32.780 --> 13:35.940] And so in this case, we were able to call toggleLED [13:35.940 --> 13:38.480] directly in the C code that we're writing. [13:38.620 --> 13:41.500] And then using Patchmaker, we can compile this code [13:41.940 --> 13:44.580] and then link it in so that all the addresses [13:44.580 --> 13:46.220] just work with the target binary, [13:46.220 --> 13:48.380] and then just use OFRAC to copy it back [13:48.380 --> 13:49.640] into the target binary. [13:49.640 --> 13:51.940] So you get pretty readable C, [13:53.220 --> 13:56.380] that's really useful for developing binary modifications. [14:01.950 --> 14:06.630] Awesome. So, so far we showed you a cool demo with LEDs, [14:06.630 --> 14:08.810] like why do we care about this ability [14:08.810 --> 14:11.030] to modify the former of the VDA? [14:11.130 --> 14:17.050] So most VDAs are used to update the engine control unit [14:17.050 --> 14:18.350] in these big trucks. [14:18.350 --> 14:21.170] So the workflow is you have a new engine control unit [14:21.170 --> 14:23.810] firmware from the vendor that needs to be updated. [14:23.910 --> 14:25.870] It gets passed to the VDA, [14:25.870 --> 14:27.830] which then directly uses it [14:27.830 --> 14:31.270] and sends it over to the ECU to flash it. [14:31.550 --> 14:32.770] And so the engine control unit [14:32.770 --> 14:34.730] obviously controls the engine, [14:34.730 --> 14:37.210] very important part of the car. [14:37.210 --> 14:39.910] That's why it's worrying in particular that the VDA [14:42.650 --> 14:45.750] is normally completely unsecured, right? [14:45.750 --> 14:48.630] Like this is a device that technicians use [14:48.630 --> 14:51.370] at the dealership, not really locked up, [14:51.370 --> 14:53.550] not a part of anyone's threat model. [14:53.550 --> 14:55.870] Anyone could sort of walk in [14:55.870 --> 14:58.330] and do this kind of firmware change. [14:58.450 --> 14:59.850] And then in addition, you know, [14:59.850 --> 15:03.590] since we found so many ways to update this firmware, [15:04.490 --> 15:07.010] really not a good thing that this is a critical path [15:07.010 --> 15:09.950] in terms of getting firmware on the engine controller. [15:13.990 --> 15:14.770] Excuse me. [15:14.770 --> 15:19.290] So, you know, as a result, you could, for example, [15:19.290 --> 15:21.370] put an implant on the VDA, [15:21.370 --> 15:23.670] wait for an engine controller update, [15:23.670 --> 15:25.510] add your own modifications to it, [15:25.510 --> 15:28.070] and then unbeknownst to anyone else, [15:28.070 --> 15:30.510] you now have code running on the ECU of that big truck, [15:30.510 --> 15:32.810] which is obviously really not great. [15:34.910 --> 15:38.530] Yeah, so this is kind of where the attack work ended. [15:38.530 --> 15:40.350] We were able to, as you see, [15:40.350 --> 15:42.370] modify the firmware to put it in Vegas mode, [15:42.370 --> 15:44.670] flash the LED lights, which is fun, [15:44.670 --> 15:47.470] but those LED lights are what tell the technician [15:47.470 --> 15:49.730] that the device is on or off, if Wi-Fi is connected, [15:49.730 --> 15:51.170] if data is being transmitted. [15:52.030 --> 15:53.250] So you can use your imagination [15:53.250 --> 15:55.510] to think about what things like that can do. [15:56.430 --> 15:58.930] Alex mentioned, you know, sometimes firmware updates, [15:58.930 --> 16:00.950] these ECUs pass through this device, [16:00.950 --> 16:02.410] some diagnostic data come out, [16:02.410 --> 16:04.590] so it's a really nice place for an attacker to sit. [16:04.690 --> 16:06.930] And this work kind of extends work that Dr., [16:06.930 --> 16:09.770] that Jeremy Daly and Srikanth Kumar did. [16:09.770 --> 16:11.190] They presented at ESCAR this year [16:11.190 --> 16:14.030] about attacking the Windows application [16:14.030 --> 16:15.970] that communicates with the VDA. [16:16.470 --> 16:18.050] So I'd recommend checking out that work. [16:18.050 --> 16:20.330] They looked at the Windows DLLs [16:20.330 --> 16:21.610] and found that it was pretty easy [16:21.610 --> 16:24.430] to insert shim DLLs into the process [16:24.430 --> 16:27.650] and peek and poke and manipulate packets [16:27.650 --> 16:29.150] on the Windows laptop. [16:29.150 --> 16:30.690] So kind of all the way down to the truck, [16:30.690 --> 16:32.790] there's all these places where you can insert [16:32.790 --> 16:34.490] and manipulate the traffic. [16:34.490 --> 16:36.750] Something interesting just to think about. [16:40.380 --> 16:42.440] Okay, so now we're gonna defend it, [16:42.440 --> 16:44.680] we're gonna fix all the problems and go home, yay. [16:45.640 --> 16:47.900] So we're not actually gonna fix all the problems today, [16:47.900 --> 16:50.940] we're just gonna focus on some of the low-hanging fruit. [16:51.200 --> 16:53.140] So the immediate problem here is, [16:53.140 --> 16:54.840] you might have noticed there's Wi-Fi [16:54.840 --> 16:57.280] and Bluetooth on this VDA. [16:57.600 --> 16:59.440] And I think you can imagine that some people [16:59.440 --> 17:02.800] might not want that Wi-Fi and Bluetooth enabled. [17:03.120 --> 17:04.820] I wouldn't want it enabled. [17:05.320 --> 17:07.600] I think people maintaining military vehicles [17:07.600 --> 17:10.120] might not want to have Wi-Fi access point [17:10.680 --> 17:13.700] on their VDAs they're plugging in, or Bluetooth as well. [17:14.180 --> 17:16.180] But this is kind of a classic situation [17:16.180 --> 17:18.380] in not just automotive, but all embedded devices [17:18.380 --> 17:21.760] where the vendors, either they don't want to [17:21.760 --> 17:25.100] or can't remove the hardware components [17:25.100 --> 17:28.480] and software components that these features [17:28.480 --> 17:29.920] are implemented on. [17:30.920 --> 17:32.520] And so the way you disable the features [17:32.520 --> 17:36.020] is essentially flipping a bit in a config file saying, [17:36.020 --> 17:38.780] don't turn on Wi-Fi, don't turn on Bluetooth. [17:38.940 --> 17:41.400] But as we all know, the code that underlines it [17:41.400 --> 17:42.800] and the hardware is still there. [17:42.800 --> 17:45.720] So an attacker can still modify the firmware [17:47.140 --> 17:50.520] or use an exploit to then turn on these features. [17:50.880 --> 17:53.060] So it's a very ripe attack surface. [17:53.660 --> 17:55.180] So we're going to be talking about VDAs, [17:55.180 --> 17:56.440] but I encourage you to think about, [17:56.440 --> 17:57.660] this is a broader problem. [17:57.660 --> 17:59.860] We have component access features, ABC. [17:59.860 --> 18:01.180] We don't want those features. [18:01.180 --> 18:03.980] We can't remove them because the vendor won't remove them. [18:03.980 --> 18:06.520] So how can we remove them in the binary? [18:08.800 --> 18:11.200] Okay, so what we're going to do today to talk you through [18:11.200 --> 18:13.780] and what we did is like, how can we apply a binary patch [18:13.780 --> 18:16.540] to the VDA firmware that removes all the code [18:16.540 --> 18:18.380] that underpins these features [18:18.380 --> 18:20.880] without having any side effects on the device? [18:21.020 --> 18:23.480] And of course, this is an example of a general problem. [18:23.480 --> 18:26.800] How do we remove features XYZ from component A [18:26.800 --> 18:29.340] so there's no side effects and those features can't work [18:29.340 --> 18:32.560] and the attack surface isn't there for people to use? [18:34.000 --> 18:37.280] So we use a technique called autotomic binary reduction. [18:37.280 --> 18:39.860] So the name is derived from nature, actually. [18:39.860 --> 18:41.780] It's a nice place to look for inspiration. [18:42.280 --> 18:45.220] So autotomy is when animals will shed a part of their body [18:45.700 --> 18:46.920] when they're being attacked [18:47.340 --> 18:49.840] to make it harder for predators to catch them. [18:50.180 --> 18:53.140] So ABR was proposed by our CEO Ong [18:53.140 --> 18:54.860] when he was a graduate student at Columbia. [18:54.860 --> 18:56.240] That's where the work comes from. [18:56.280 --> 18:58.180] So if you want to really get into the math behind it, [18:58.180 --> 18:59.500] you can look at his dissertation. [18:59.940 --> 19:02.620] But to simplify it, there's really just four steps. [19:02.680 --> 19:04.660] First, you identify the high-level feature [19:04.660 --> 19:05.580] that you don't want, [19:05.580 --> 19:08.200] and then you identify the entry point in the code for it. [19:08.500 --> 19:12.660] Then you can use analysis tools [19:12.660 --> 19:13.900] to identify all the code and data [19:13.900 --> 19:16.040] that are exclusively controlful, [19:16.040 --> 19:17.700] dependent on those entry points. [19:18.080 --> 19:19.800] You want to do this very carefully, [19:19.800 --> 19:22.180] so if you're not sure, you'll leave something in. [19:22.360 --> 19:24.220] And then you remove that code and data, [19:24.220 --> 19:27.020] and then you replace the high-level entry point [19:27.020 --> 19:29.380] with a return patch that makes sense [19:29.380 --> 19:31.320] if the program ever calls it. [19:31.320 --> 19:34.000] So if you think about a Bluetooth subsystem, [19:34.000 --> 19:35.420] there's usually some sort of process [19:35.420 --> 19:37.140] that initializes everything. [19:37.140 --> 19:38.440] You can remove the code for that [19:38.440 --> 19:41.160] and insert a return negative one, [19:41.160 --> 19:43.280] or it depends on what is actually in the system, [19:43.280 --> 19:45.360] but return code that will tell the system [19:45.360 --> 19:47.240] this is not up and it's not going to run. [19:48.060 --> 19:50.460] So this graph, I think, simplifies. [19:50.460 --> 19:51.780] Obviously, it's more complex, [19:51.780 --> 19:53.980] but at a high level, this is the idea. [19:53.980 --> 19:56.000] If you have feature A and feature B, [19:56.000 --> 19:57.600] we want to remove feature A. [19:57.760 --> 19:59.440] We look at the control flow graph, [19:59.440 --> 20:02.020] find all the functions that are exclusively controlful, [20:02.020 --> 20:03.520] dependent on feature A. [20:03.700 --> 20:06.600] So function five, we cannot remove, [20:06.600 --> 20:08.820] but functions one and two, three, we can. [20:08.820 --> 20:11.320] And then we insert that return patch there. [20:14.880 --> 20:19.540] So the workflow for this is fairly standard, [20:19.540 --> 20:22.060] and actually, Alex did most of the work already [20:22.060 --> 20:24.720] that you need human input for now in. [20:24.720 --> 20:27.120] So we've understood how the firmware works [20:27.120 --> 20:28.780] and how we can update the firmware. [20:28.800 --> 20:31.400] So next step is just to identify the feature points, [20:31.400 --> 20:34.660] and then all of the actual autotomy work [20:34.660 --> 20:36.940] about identifying the code that needs to be removed [20:36.940 --> 20:39.360] and removing it and packing the firmware, [20:39.360 --> 20:43.260] we can completely automate right now with the work we have. [20:43.260 --> 20:44.360] And what we're doing as a company [20:44.360 --> 20:45.500] is we're trying to move up the stack [20:45.500 --> 20:47.400] to automate this entire process. [20:47.700 --> 20:50.940] So there's minimal human interaction needed into it. [20:55.070 --> 20:57.650] Okay, so identifying the feature entry points, [20:57.650 --> 20:58.670] how do you do that? [20:58.690 --> 21:00.070] Well, this is where you have to like, you know, [21:00.070 --> 21:01.930] roll up your sleeves and do a little reversing. [21:02.590 --> 21:04.870] So on embedded systems like the VDA, [21:04.870 --> 21:06.790] this can be a little complicated, [21:06.790 --> 21:08.370] but sometimes you get lucky. [21:08.370 --> 21:10.770] So in this case, you can use symbols [21:10.770 --> 21:12.530] to find leaked source code online [21:12.530 --> 21:14.730] that you can use to then label the functions [21:15.150 --> 21:16.110] in your project. [21:16.110 --> 21:18.330] This was using ColdFire. [21:18.330 --> 21:20.350] So in this case, we use Gija, [21:20.350 --> 21:21.210] but you can use, you know, [21:21.210 --> 21:23.650] any other disassembly tool as well to do this. [21:23.650 --> 21:25.850] And then you can kind of start labeling [21:25.850 --> 21:28.350] the features inside the binary. [21:28.350 --> 21:29.570] So a new binary comes in, [21:29.570 --> 21:30.810] this whole process can be automated. [21:30.810 --> 21:35.230] You can start with the debug strings within the binary [21:35.230 --> 21:36.570] and then work up to find the functions [21:37.090 --> 21:39.370] and then automate this process removing that code. [21:41.230 --> 21:43.270] So for this like proof of concept, [21:43.270 --> 21:46.150] we generalized five entry points, [21:46.150 --> 21:49.030] the OS tasks that initialize the subsystems. [21:49.030 --> 21:51.130] We also wanted to remove the UR debug commands [21:51.130 --> 21:52.910] because we found them super useful. [21:52.930 --> 21:55.630] And yeah, it should be harder to figure out [21:55.630 --> 21:56.950] how to dump the memory from the device. [21:56.950 --> 21:57.830] I think, yeah. [21:58.750 --> 22:02.350] Then we also targeted some driver initialization code [22:02.350 --> 22:03.710] for these things as well. [22:04.870 --> 22:06.070] And these were the results. [22:06.070 --> 22:09.030] So we use the ABR algorithm that we have ever balloon. [22:09.030 --> 22:13.750] We removed in total 574 functions [22:14.510 --> 22:17.390] and ended up being 144 kilobytes of code. [22:17.390 --> 22:19.210] So that was about 7% of the binary. [22:19.210 --> 22:20.890] And you can kind of visualize it here. [22:20.890 --> 22:23.390] Everything that's dark was unmodified [22:23.870 --> 22:26.270] and the stripes of green here are the areas [22:26.270 --> 22:28.850] where ABR removed the binary code. [22:29.010 --> 22:30.070] So it's kind of cool. [22:30.070 --> 22:31.470] You can see like throughout the binary, [22:31.470 --> 22:34.210] there's huge swaths of functions that are just not needed [22:34.990 --> 22:37.270] and attackers can't use it anymore. [22:37.270 --> 22:40.990] Then we worked with friendly vendor person [22:40.990 --> 22:44.490] to test the image using the functional test suite [22:44.490 --> 22:45.570] that they used. [22:45.710 --> 22:48.250] And they confirmed that performance was consistent [22:48.250 --> 22:49.990] with the original firmware image. [22:50.010 --> 22:50.530] So that was great. [22:50.530 --> 22:52.310] We basically showed we were able to remove this feature [22:52.310 --> 22:54.310] and the regular performance of the device [22:54.310 --> 22:55.810] wasn't modified at all. [22:57.470 --> 23:00.050] Okay, so we didn't fix all the problems. [23:00.050 --> 23:04.070] So as we're reflecting on this, it's kind of Zen. [23:04.430 --> 23:06.290] We were able to use some of the reversing [23:06.290 --> 23:07.710] that attacker would use. [23:07.710 --> 23:08.930] It's the same workflow in the beginning [23:08.930 --> 23:11.090] to identify the features and remove it. [23:12.370 --> 23:15.190] So removing the Bluetooth and Wi-Fi code is good. [23:16.590 --> 23:19.790] We would challenge vendors to reconsider [23:19.790 --> 23:21.350] whether they even need it. [23:23.550 --> 23:25.730] Yeah, I think that's something we can all think about. [23:25.730 --> 23:27.310] Do we need to put this in? [23:27.450 --> 23:31.410] Can we support firmware builds that don't have it in? [23:31.970 --> 23:34.090] Another thing to think about is ideally you wanna [23:34.090 --> 23:38.190] at least not leave the headers on to JTAG and UART. [23:38.810 --> 23:40.530] Ideally disable them as well. [23:40.530 --> 23:41.670] That just makes it a little harder [23:41.670 --> 23:44.010] for people to mess with the device. [23:44.050 --> 23:45.970] For production devices, of course. [23:47.210 --> 23:50.670] So then we get to some of the lower level challenges. [23:50.670 --> 23:54.030] How can we make it so anyone can't modify the firmware? [23:54.110 --> 23:56.150] So some sort of secure firmware update mechanism, [23:56.150 --> 23:58.990] maybe a secure boot mechanism would be useful here. [23:59.350 --> 24:00.810] And then how do we know [24:00.810 --> 24:03.810] that the firmware hasn't been modified? [24:03.810 --> 24:07.050] How do we know that the VDA that's on the shelf [24:07.050 --> 24:09.790] in my technician's office hasn't been tampered with? [24:09.930 --> 24:11.350] There's some sort of runtime protection [24:11.350 --> 24:12.850] and monitoring could help there. [24:12.850 --> 24:13.470] Because then you could see [24:13.470 --> 24:14.850] that the device has been corrupted. [24:18.360 --> 24:20.440] Okay, so we've attacked, we've defended, [24:20.440 --> 24:23.540] and now let's talk about some education we did. [24:23.540 --> 24:25.980] So we repurposed this research [24:25.980 --> 24:28.620] to build two educational things [24:28.620 --> 24:30.560] to kind of take these real world problems [24:30.560 --> 24:32.520] and make it challenges that people can use [24:33.340 --> 24:36.280] to kind of learn about this specific issue. [24:38.620 --> 24:40.040] And this is another area [24:40.040 --> 24:42.320] where the friendly vendor person helped us out [24:42.320 --> 24:44.220] because we only had two of these devices, [24:44.220 --> 24:46.560] but we were able to, at the Cybertruck Challenge, [24:46.560 --> 24:49.400] have, for the last two years, a two hour workshop. [24:50.800 --> 24:52.920] So the Cybertruck Challenge is a pretty cool event [24:52.920 --> 24:56.180] that's held every year where a bunch of students [24:56.180 --> 24:58.220] are paired up with industry experts [24:59.360 --> 25:02.140] in automotive, specifically truck security, [25:02.140 --> 25:05.180] and then a bunch of vendors come with fleets, [25:05.180 --> 25:06.800] and there's a bunch of education that happens, [25:06.800 --> 25:08.000] and then a bunch of assessments [25:08.000 --> 25:09.600] that students do on the devices. [25:09.700 --> 25:11.220] So I encourage you to check it out. [25:11.220 --> 25:13.140] There's also some really good educational resources [25:13.140 --> 25:14.540] on the website as well. [25:14.720 --> 25:18.280] So if you're not super familiar with J1939, [25:18.280 --> 25:19.660] that's a good place to start. [25:20.060 --> 25:21.180] But anyway, in our workshop, [25:21.180 --> 25:22.880] we walked them through this process. [25:22.880 --> 25:25.840] They physically took apart the devices, [25:25.840 --> 25:26.980] dumped the firmware. [25:27.080 --> 25:28.720] Getting UART was a really fun moment [25:28.720 --> 25:31.760] when you get the shell there. [25:31.760 --> 25:34.680] One thing that we've kind of observed [25:34.680 --> 25:37.440] is that familiarity with command line tools [25:37.440 --> 25:41.100] is something that probably we could build on more. [25:41.100 --> 25:44.080] So connecting the UART, getting screen working, [25:44.080 --> 25:44.840] and stuff like that, [25:44.840 --> 25:46.580] it was a really good moment for the students. [25:46.780 --> 25:47.440] And then we walked them through [25:47.440 --> 25:49.040] the bootstring modification, [25:49.040 --> 25:50.720] and a contained environment [25:50.720 --> 25:52.680] where they could toggle the LED lights there. [25:55.040 --> 25:56.320] A little more fun, though. [25:56.320 --> 25:59.340] Last year, as part of the Car-Wrecking Village CTF, [25:59.820 --> 26:02.200] we had a bunch of these VDA boards here, [26:02.200 --> 26:03.680] and four challenges. [26:04.080 --> 26:05.940] So challenge one was a real-world challenge. [26:05.940 --> 26:07.760] We gave them a PCAP, [26:07.760 --> 26:10.020] and we gave them a modified firmware image [26:10.020 --> 26:13.200] and said, flash this image on the device. [26:13.400 --> 26:16.140] And so there, the flag printed in the boot shell [26:16.140 --> 26:18.440] once you're able to flash the device. [26:19.440 --> 26:21.680] Challenge two was a little too difficult. [26:21.680 --> 26:22.760] It was ambitious. [26:23.400 --> 26:26.140] I think we would remove it if we did it again at CTF. [26:26.140 --> 26:28.420] But there, the challenge was to [26:28.980 --> 26:30.980] essentially put the device in Vegas mode. [26:31.780 --> 26:32.680] And then challenge three, [26:32.680 --> 26:33.840] there's a really good write-up online [26:33.840 --> 26:36.400] that kind of walks through the process, [26:36.400 --> 26:39.780] but challenge three involved finding a [26:41.880 --> 26:44.820] super-military-grade encryption scheme on the device. [26:44.820 --> 26:47.160] I think it was just a bunch of XORing data [26:47.160 --> 26:50.660] against the XOR repeating key. [26:50.660 --> 26:51.680] And so the write-up's really cool [26:51.680 --> 26:54.020] because they showed you how they use the ability [26:54.020 --> 26:56.160] to map the firmware to load a Giger project, [26:56.160 --> 26:57.080] find the function. [26:57.080 --> 26:59.180] And I think they actually emulated the function in this [26:59.180 --> 27:01.200] to get the decrypted key there. [27:01.340 --> 27:03.500] And then challenge four was OTA to save the day. [27:03.500 --> 27:05.320] So we had the Wi-Fi access points turned on [27:05.320 --> 27:08.320] and you had to do the firmware update procedure, [27:08.320 --> 27:10.660] but over the air. [27:14.120 --> 27:16.440] Okay, so just to recap. [27:20.150 --> 27:23.330] Yeah, so that's the binary modified image in Vegas mode. [27:23.330 --> 27:25.630] We talked about what VDAs are. [27:26.090 --> 27:30.730] We showed how it's relatively straightforward [27:30.730 --> 27:33.390] to try to modify the firmware on them and attack it. [27:33.390 --> 27:35.550] We can think about what that implies to the industry. [27:35.830 --> 27:38.570] We talked through some ways which binary modifications [27:38.570 --> 27:40.330] can be made to harden the image, [27:40.330 --> 27:43.230] so we don't need to go to the end manufacturers if we want to. [27:43.470 --> 27:44.850] And we talked about how we can use... [27:44.850 --> 27:46.290] I think this is a really good takeaway point. [27:46.290 --> 27:48.470] You've used real-world research and convert it [27:48.470 --> 27:51.250] into challenges to educate both students [27:51.250 --> 27:53.970] and also push people out of their comfort zone. [27:53.970 --> 27:55.210] I think this was the first VDA [27:55.210 --> 27:57.110] that was at the Carr-Akenville CTF. [27:57.970 --> 28:00.470] And yeah, I think we just wanna acknowledge Edward and Sam [28:00.470 --> 28:01.810] who couldn't be here today. [28:02.870 --> 28:05.050] Jeremy and the friendly vendor person [28:05.050 --> 28:06.470] for helping out with this. [28:09.410 --> 28:11.150] So, oh, and lastly... [28:13.510 --> 28:14.450] We're at Red Balloon. [28:14.450 --> 28:16.050] We're hiring now. [28:16.790 --> 28:18.930] So if you wanna learn more about OFRAC for this work, [28:18.930 --> 28:20.350] we can take some questions now, [28:20.350 --> 28:22.290] but we also have a booth over at the Carr-Akenvillage. [28:22.330 --> 28:24.710] And we have two different CTF challenges [28:25.970 --> 28:28.090] that we contributed to the Carr-Akenvillage CTF [28:28.090 --> 28:29.130] this year as well. [28:29.130 --> 28:31.390] So yeah, thanks for your time.