[00:00.860 --> 00:05.880] That was quite the introduction for compromising an electronic logging device [00:05.880 --> 00:08.260] and creating a truck-to-truck worm. [00:08.300 --> 00:09.800] But that's what we're going to be talking about. [00:09.800 --> 00:11.860] So, my name is Jake. This is Rick. [00:11.860 --> 00:14.360] And, Rick, take it away. [00:15.700 --> 00:17.200] Thanks, Jake. [00:18.340 --> 00:23.180] So, we are systems engineering master's students from Colorado State University [00:23.180 --> 00:26.700] and we work with Dr. Jeremy Daly [00:26.700 --> 00:32.360] and primarily concentrate our research on cybersecurity of heavy vehicles. [00:34.040 --> 00:38.580] And, here's a video of the work we have done. [00:38.580 --> 00:39.980] Hopefully, it plays. [00:48.130 --> 00:51.890] Alongside the truck, you reflash the electronic device, [00:51.890 --> 00:55.070] which is running its software with a malicious firmware [00:55.070 --> 00:59.590] that will slow down the truck once it starts executing. [00:59.950 --> 01:01.650] We were successful in this attack. [01:01.650 --> 01:03.770] The car broke up alongside it. [01:03.770 --> 01:08.930] About 30 seconds later, the truck begins to slow down and the car pulls out. [01:09.130 --> 01:10.750] This is a wireless attack. [01:10.750 --> 01:14.690] It gives us the freedom to explore creative attack vectors, [01:14.690 --> 01:16.050] including flying a drone. [01:16.050 --> 01:19.570] Critical infrastructure is becoming more and more connected, including trucks. [01:19.570 --> 01:22.290] One of the reasons is due to the ELD mandate. [01:22.290 --> 01:26.510] When the ELD mandate first came out, it did not have much security in it. [01:26.510 --> 01:28.970] They couldn't use many security improvements. [01:28.970 --> 01:33.730] Here at Colorado State University, we are exploring the security of heavy vehicles, [01:33.730 --> 01:38.010] as well as the security of the devices attached to the heavy vehicles, [01:38.010 --> 01:39.490] such as electronic logging. [01:43.760 --> 01:47.660] Basically, what we did is, as far as we know, [01:47.660 --> 01:50.700] the first wireless drive-by attack on a truck. [01:53.940 --> 01:55.940] I was driving the truck. [01:55.940 --> 01:59.460] Ray got to drive the smooth Tesla by it. [02:00.540 --> 02:05.060] What he did was basically flash the ELD that was plugged into the truck [02:05.060 --> 02:07.940] while the car was driving by the truck. [02:09.740 --> 02:14.160] After about 30 seconds, after the firmware was loaded, the device rebooted. [02:14.420 --> 02:18.920] Basically, what happened was the car pulled ahead and the truck started to slow down. [02:20.140 --> 02:24.740] What we found and what we did was that the accelerator pedal stopped working. [02:24.820 --> 02:28.760] It was stuck in idle, and that's why we could not move the truck any forward. [02:31.360 --> 02:37.320] So, a bit of background on what happened, why we did, and why we chose to do that. [02:39.080 --> 02:44.560] The first big question that comes up is, why do we do research on commercial vehicles? [02:45.280 --> 02:50.200] Well, one simple answer to that thing is, they are very important to the supply chain. [02:50.480 --> 02:55.060] And I think the pandemic gave us a good lesson on why it's important to the supply chain. [02:55.060 --> 03:00.900] The shortages were pretty obvious, what lack of trucks on the road can do. [03:00.920 --> 03:05.340] And they are considered part of critical infrastructure for that very same reason. [03:07.260 --> 03:09.020] What's under the hood of trucks? [03:09.360 --> 03:13.220] Well, basically, modern trucks are very much electronical. [03:13.220 --> 03:16.260] They have lots of embedded computers inside them, [03:16.260 --> 03:20.100] around 150 ECUs, as we call them, electronic controller units, [03:20.100 --> 03:22.360] to control functions of modern trucks. [03:23.060 --> 03:26.780] They use a lot of different network protocols, like CAN, CAN FD, LIN, [03:26.780 --> 03:29.820] and even the most recent ones have started using automotive Ethernet [03:29.820 --> 03:31.980] for some purposes. [03:32.320 --> 03:37.600] In most trucks here in the United States, they say J1939 is the standard of choice. [03:38.280 --> 03:42.980] And most trucks on the road do use that standard for communication between these ECUs. [03:45.580 --> 03:50.140] Now, what are electronic logging devices and how did they come into trucks? [03:50.900 --> 03:55.780] Well, it was started off as a mandate for commercial trucks, [03:55.780 --> 03:59.320] and most of them use it ever since the mandate in 2017. [03:59.980 --> 04:03.160] The goal of an ELD is to record hours of service [04:03.160 --> 04:06.700] because paper logs are not reliable enough. [04:06.700 --> 04:10.380] Truckers would more often than not be honest in those paper logs [04:10.380 --> 04:14.560] and keep driving more than the allotted hours. [04:14.600 --> 04:18.600] And the goal of electronic logging devices was to basically get rid of that [04:18.600 --> 04:22.220] and have a device log your hours of service. [04:22.580 --> 04:28.340] The big problem with that was in the entire mandate that was out there, [04:28.340 --> 04:30.600] there was no mention of security at all. [04:31.420 --> 04:36.580] The process for getting your own ELD was make one, self-certify it, [04:36.580 --> 04:39.820] and you can start selling it out to each of the trucks. [04:40.400 --> 04:45.780] There are about 880 ELDs of this time that are out there, [04:45.780 --> 04:49.820] so a lot of different variants from a few different manufacturers. [04:50.140 --> 04:54.200] And the goal of that ELD is, once again, they go into the diagnostic port of a truck, [04:54.200 --> 04:59.380] similar to that of a car, and they log data. [05:00.140 --> 05:04.600] One of the fundamental issues with this thing is that, more often than not, [05:04.600 --> 05:08.420] they require both read and write access to the internal network [05:08.420 --> 05:11.340] of a commercial vehicle to do that. [05:11.420 --> 05:16.840] And that write access may create a problem if exploited. [05:17.460 --> 05:21.880] The other thing is that ELDs don't work as standalone devices, [05:21.880 --> 05:26.820] and more often, there are other apps or other devices [05:26.820 --> 05:30.700] that are connected over Wi-Fi, Bluetooth, or sometimes even over cellular [05:30.700 --> 05:36.120] to get the data of the ELDs that the ELDs record from a modern truck. [05:37.420 --> 05:43.180] Now, when we start looking at ELDs from an attacker's perspective, [05:43.180 --> 05:48.540] the main goal is to somehow go in there, compromise the ELD, [05:48.540 --> 05:54.000] and write bad messages so that you can do something bad with the truck. [05:54.420 --> 05:59.280] The initial landscape looks very difficult because there are around 880, [05:59.280 --> 06:03.180] and launching a successful attack on 880 different variants [06:03.180 --> 06:05.820] is extremely difficult. [06:05.900 --> 06:11.240] The other big problem is most trucks have started incorporating gateways, [06:11.240 --> 06:13.580] which basically act as firewalls. [06:13.580 --> 06:17.940] They sit between your diagnostic port and the internal components [06:17.940 --> 06:20.720] which need to be shielded from attacks. [06:21.660 --> 06:24.900] The other thing is that it's a device that plugs in, [06:24.900 --> 06:27.560] so plugging it out would stop the attack. [06:28.780 --> 06:33.240] So a typical threat scenario would involve two things, [06:33.240 --> 06:36.220] either short-range access over Bluetooth or Wi-Fi, [06:36.460 --> 06:39.380] or long-range access via cellular networks. [06:39.840 --> 06:43.420] But doing a deeper dive into the world of ELDs [06:43.420 --> 06:45.720] reveals something entirely different. [06:46.420 --> 06:50.360] Actually, there are only a few distinct ELDs, [06:50.360 --> 06:52.060] let's say about 10 of them, [06:52.060 --> 06:55.860] and most of them are basically rebranded clones of one another, [06:55.860 --> 07:00.280] and there is significant code reuse among all the ELDs. [07:01.440 --> 07:05.740] Okay, that takes out 880 and leaves us with 10 to look at. [07:05.920 --> 07:07.980] The other problem is gateways, [07:07.980 --> 07:11.420] but gateways have become popular most recently, [07:11.420 --> 07:13.560] and trucks run for a lot of time. [07:13.560 --> 07:16.300] They run for 20, 30 years on the road, [07:16.300 --> 07:18.400] and gateways are relatively modern. [07:18.700 --> 07:22.460] So most trucks out on the road today don't have gateways. [07:22.660 --> 07:26.720] So the question of having a firewall inside a truck is gone. [07:27.060 --> 07:29.480] Even the ones that do have gateways, [07:29.480 --> 07:33.060] they can be subjected to some configuration errors, [07:33.060 --> 07:35.740] and recently our team has discovered [07:35.740 --> 07:37.580] some diagnostic protocol flaws [07:37.580 --> 07:40.360] that allows you to write messages in a way [07:40.360 --> 07:41.900] that can bypass a firewall [07:41.900 --> 07:44.180] and go into the parts of the truck [07:44.900 --> 07:48.400] where it should not go and actually cause some harm. [07:49.380 --> 07:51.580] The other thing about ELDs is that [07:51.580 --> 07:53.460] if something bad happens, [07:53.460 --> 07:56.420] the first thing a diagnostic technician would do [07:56.420 --> 08:00.600] is remove the ELD to plug their own maintenance tool there [08:00.600 --> 08:03.020] to find out what's wrong with the truck. [08:03.620 --> 08:06.340] So actually finding out the issue becomes a big problem [08:06.340 --> 08:09.080] if an attack is launched through an ELD. [08:10.580 --> 08:13.480] And thus, we introduce in this research [08:14.000 --> 08:17.140] a novel approach of actually compromising an ELD [08:17.140 --> 08:20.460] and creating a truck-to-truck warm. [08:20.940 --> 08:23.480] With that, I would like to hand it over to Jake [08:23.480 --> 08:26.380] to go into the in-depths of this research. [08:30.880 --> 08:33.380] Alrighty, so since it's DEF CON, [08:33.380 --> 08:35.560] instead of just going over what we found, [08:35.560 --> 08:37.380] I'm also going to go over how we did it [08:37.380 --> 08:39.280] because it's a bit of a journey. [08:39.280 --> 08:43.740] This was the first big thing that I've reverse-engineered [08:43.740 --> 08:49.280] and therefore, in comparison to CTS and stuff like that. [08:49.680 --> 08:51.340] Alright, so real quickly, [08:51.340 --> 08:53.780] I want to make it clear that I'm not up here [08:53.780 --> 08:55.500] to shame the company. [08:55.820 --> 08:59.100] In my opinion, all companies have security vulnerabilities. [08:59.100 --> 09:01.160] Some might not have been found yet. [09:01.160 --> 09:04.840] But this company did a great job in their response. [09:04.840 --> 09:07.500] So we did a responsible disclosure with them [09:07.500 --> 09:11.000] and they ended up putting out a patch. [09:11.360 --> 09:14.160] And in our opinion, they responded pretty well. [09:15.460 --> 09:18.960] So one day, Dr. Daly, which is our advisor, [09:18.960 --> 09:22.820] just went onto Amazon and he bought some of these devices. [09:22.900 --> 09:25.060] It's actually... oh, screens are up there. [09:25.060 --> 09:27.200] It's actually the little disk, right? [09:27.200 --> 09:28.500] So it's about this big. [09:28.500 --> 09:32.200] And the reason he bought them is that they all look very similar. [09:32.280 --> 09:33.320] And they work. [09:33.320 --> 09:37.760] They were the exact same devices being sold by many different major brands. [09:37.760 --> 09:42.240] So the devices are IO6, IO1020 micro-ELDs. [09:42.240 --> 09:45.680] We found that this device was sold by like 50 plus different brands. [09:46.120 --> 09:50.020] And this is kind of commonplace in the ELD industry. [09:50.020 --> 09:51.900] So as Rick mentioned before, [09:51.900 --> 09:54.880] these devices come with additional wireless networks on them. [09:54.880 --> 09:59.360] So this one had Bluetooth and GPS, which were mentioned in the manual. [09:59.360 --> 10:02.460] But what was interesting is that when you first powered it on, [10:02.460 --> 10:04.860] it actually popped up a Wi-Fi network as well, [10:04.860 --> 10:09.540] which is curious because why would you go through all the effort of programming the Wi-Fi [10:10.120 --> 10:12.300] if you don't mention it in the manual? [10:12.300 --> 10:18.180] So that's kind of the first thing that kind of was a clue initially. [10:18.360 --> 10:21.120] And if you go ahead and look at the picture of the PCB, [10:21.660 --> 10:23.120] that's the PCB of the board. [10:23.120 --> 10:25.220] It's an ESP32-based device. [10:25.320 --> 10:29.440] And that port right there is kind of what we're going to talk about next. [10:29.440 --> 10:33.100] So it was labeled PROG, which we assumed was likely programming. [10:33.100 --> 10:34.700] It's an ESP32 device. [10:34.700 --> 10:36.720] So doing a little bit of hardware reverse engineering, [10:36.720 --> 10:39.640] figuring out what pins, what communication, what programs to use, [10:39.640 --> 10:42.420] we were eventually able to check the eFuses on it. [10:42.420 --> 10:47.020] And checking the eFuses allowed us to determine that it had no protections on it at all. [10:47.020 --> 10:49.580] So we could go ahead and just dump the firmware off of it. [10:49.640 --> 10:52.900] And the first thing we're going to do with the firmware is run strings on it. [10:52.920 --> 10:56.800] And normally you don't hit the jackpot with just strings. [10:56.800 --> 10:58.420] But in this case, we did. [10:58.420 --> 11:03.300] So as we're looking through strings, I come across that SSID. [11:03.380 --> 11:09.560] And then two lines down, I see what I can only describe as a Wi-Fi password. [11:09.560 --> 11:10.700] And that is what we found. [11:10.700 --> 11:14.220] It was the hard-coded default Wi-Fi password for this device. [11:14.220 --> 11:17.800] We continue scrolling down, and we start seeing stuff about web servers [11:17.800 --> 11:21.060] and these endpoints, this slash upload.php. [11:21.060 --> 11:23.480] It's talking about OTAs and flashing. [11:23.480 --> 11:24.980] But it needs a key. [11:25.160 --> 11:27.060] And as we go down a little bit more, [11:27.060 --> 11:31.260] we see something that starts with a 1 and it ends with a 6. [11:31.260 --> 11:33.640] And I'll let you figure out what's in between that. [11:33.680 --> 11:40.080] And that was the hard-coded key that protected the over-the-air updates for this device. [11:42.120 --> 11:45.600] All right. So once we now got onto the Wi-Fi network, of course, [11:45.600 --> 11:47.420] we can go ahead and do an NMAP scan. [11:47.420 --> 11:51.820] The NMAP results there are incomplete, but essentially it would find three services. [11:51.820 --> 11:54.520] We had a Telnet service on port 23. [11:54.520 --> 11:58.660] We had SSH. Well, NMAP thought it was SSH on port 22. [11:58.660 --> 12:00.300] I did not think it was that. [12:00.540 --> 12:02.960] And then we had an HTTP server on port 80. [12:02.960 --> 12:07.860] So if we look at the screenshot of the HTTP server, we can see it's listing serial version. [12:07.900 --> 12:10.600] And then we have that key and a little bit of foreshadowing. [12:10.600 --> 12:15.520] We have a firmware-mal standing for a malicious firmware that we created. [12:16.040 --> 12:19.960] All right. So this slide is, of course, the part that takes the longest. [12:19.960 --> 12:21.380] This is the reverse engineer. [12:21.380 --> 12:24.220] We found a device that has these vulnerabilities. [12:24.220 --> 12:27.800] We went ahead and did a little bit of testing to confirm it's not doing firmware signing [12:27.800 --> 12:31.520] and that we could actually upload a modified binary to it. [12:31.520 --> 12:33.060] But now what do we do with that? [12:33.060 --> 12:37.200] So at this point, we need to reverse engineer the binary, figure out how it works to the point [12:37.200 --> 12:41.660] that we can create a malicious firmware for it and get it to do what we want it to do. [12:41.820 --> 12:44.800] So this was on ESP32. [12:44.920 --> 12:50.100] So the code for it is Extensa. [12:50.160 --> 12:52.140] And Extensa was not well supported. [12:52.140 --> 12:53.980] It's now officially supported by Ghidra. [12:53.980 --> 12:59.220] But at the time, it was not on any of the major ones that I at least had the money for. [12:59.680 --> 13:01.880] And so we were looking at community support. [13:01.880 --> 13:06.020] And the best community support was for Ghidra at the time, but still needed a lot of work. [13:06.020 --> 13:12.080] So after spending weeks fixing up the decomp and going through all that, I had a bunch of flows. [13:12.260 --> 13:15.960] And it's kind of hard to describe what I mean by flows, but essentially I had a bunch of functions. [13:15.960 --> 13:17.420] They all kind of connected to each other. [13:17.420 --> 13:19.440] It was clear what their purpose was. [13:19.440 --> 13:23.820] But I was missing the thing that connected them and the main function. [13:23.820 --> 13:25.640] And that was a giant thing. [13:25.640 --> 13:27.020] I still don't have main. [13:27.020 --> 13:30.560] So I did what any good hacker would do, is I went snooping. [13:30.560 --> 13:32.900] And I learned that there's an Expressive Forms. [13:32.900 --> 13:34.900] I created an account, logged on. [13:34.900 --> 13:39.200] And after looking around, I found that there is an account called io6llc. [13:39.220 --> 13:45.700] And I guess that was probably related to someone that was working at that company. [13:45.700 --> 13:49.020] And most of their questions and that stuff were pretty normal. [13:49.020 --> 13:55.400] They were either reporting bugs or they were asking about help for certain things. [13:55.400 --> 14:00.160] But on one of them, they posted a full crash dump, which was beautiful. [14:00.160 --> 14:04.480] Because if we look at the crash dump, we can see it's talking about having a bunch of different threads. [14:04.680 --> 14:07.300] And it actually gives names to each of those threads. [14:07.480 --> 14:13.660] And so if I cross-reference those strings that we were looking at earlier, and I look at where those names are used, [14:13.660 --> 14:18.880] I came across a function that ended up being main, and it just wasn't decompiled correctly. [14:18.880 --> 14:23.680] So now that I had that, I was actually able to get the full picture of how it all worked. [14:23.800 --> 14:26.980] And we went from there. [14:27.760 --> 14:32.460] So quick overview of the vulnerabilities that were discovered through the reverse engineer. [14:32.460 --> 14:35.700] We already talked about the default network credentials. [14:36.560 --> 14:41.060] And we had this web server that seemingly was unused by these resellers. [14:41.140 --> 14:43.560] But it was always on and it was always there. [14:43.560 --> 14:46.600] We had Bluetooth and Wi-Fi being on at the same time. [14:46.600 --> 14:48.280] Firmware wasn't being signed. [14:48.280 --> 14:51.600] Firmware updates were protected by the weak password. [14:52.120 --> 14:58.220] And then what I ended up finding was that service on port 22 was actually a debug service. [14:58.220 --> 15:03.460] It essentially acted as an echo server, which we had no use for. [15:03.460 --> 15:11.180] And it was beautiful because it gave us a giant function to go ahead and put our malicious code in that would always get called. [15:11.180 --> 15:12.680] It was in its own thread. [15:12.680 --> 15:16.520] We didn't have to make any trampolines out for space or anything like that. [15:16.520 --> 15:21.700] And so we went ahead and just put in a pretty simple little bit of malicious code. [15:21.700 --> 15:25.200] And it's what you kind of see on the screen up there. [15:25.460 --> 15:28.280] And so essentially this would check a status variable. [15:28.280 --> 15:34.040] And once the status variable was equal to certain conditions, we knew that CAN was initialized. [15:34.040 --> 15:36.440] And it actually had a connection to the CAN bus. [15:36.440 --> 15:40.720] And then at this point, we just went ahead and spammed TSC1 messages. [15:40.940 --> 15:44.520] TSC1 messages are Torque Speed Control 1 messages. [15:44.520 --> 15:51.660] They are a J1939 message that are essentially there to allow you to tell the engine to go to a certain torque. [15:51.800 --> 15:57.580] So in the video, you saw us slowing down the truck because for safety reasons, we're going to slow down the truck. [15:57.580 --> 16:00.500] But we could have also sped up the truck as well. [16:01.980 --> 16:05.520] In terms of like how long it takes, it's a wireless attack. [16:05.520 --> 16:08.500] So if you're really close to the device, it goes pretty quickly. [16:08.500 --> 16:11.180] It can go in like 30 seconds, the entire thing. [16:11.180 --> 16:14.060] But the farther you move away, the longer it takes. [16:14.980 --> 16:19.080] We also found that the service on port 23 was this Telnet service. [16:19.080 --> 16:24.980] And this provided a pretty comprehensive API that not only allowed you to do all the normal ELD stuff, [16:24.980 --> 16:31.100] but it also allowed you to go ahead and change those defaults. [16:31.100 --> 16:33.460] Unfortunately, those weren't being used. [16:33.460 --> 16:35.060] And then we found something interesting. [16:35.060 --> 16:39.640] As we were looking through a function that was essentially the main command handler, [16:39.640 --> 16:46.780] we can see that most of the commands are a pretty normal string compare between essentially the command and whatever your input is. [16:46.780 --> 16:52.620] But if you go all the way down to the bottom, and you see these like five consecutive if statements, [16:52.620 --> 16:59.360] and you match all of these very specific criteria, you'll see it goes all the way down to a send can function. [16:59.600 --> 17:01.340] And that's what it allows you to do. [17:01.340 --> 17:07.440] And this secret function would allow you to arbitrarily wirelessly send whatever can messages you want, [17:07.440 --> 17:12.220] if you were connected over Bluetooth, Wi-Fi, anything like that. [17:13.980 --> 17:19.120] All right, so while I was doing this, I didn't have much experience with ESP32s, [17:19.120 --> 17:21.980] but I know that they're loved in the IoT community. [17:21.980 --> 17:28.140] And one of the things I knew about them is that they could simultaneously be an access point and a station, [17:28.140 --> 17:31.640] or a client and access point, essentially. [17:31.980 --> 17:37.080] And so this would allow us to create a worm, a device that would not only be able to execute the attack, [17:37.080 --> 17:41.220] but could also scan for and spread to other devices. [17:41.480 --> 17:45.100] So we get a lot of truck deliveries to our building where we were working. [17:45.220 --> 17:49.440] And we didn't really think it was worth it to build this full cyber weapon on the actual device. [17:49.440 --> 17:53.280] So we switched over to dev boards. And on these dev boards, we developed this worm. [17:53.280 --> 17:57.300] And essentially it does work exactly like how it would on the actual devices. [17:57.300 --> 18:01.600] It just goes ahead, uses the default credentials to log in, perform an over-the-air update, [18:01.600 --> 18:04.180] and copy itself onto the new device. [18:04.560 --> 18:07.600] So is this realistic? I would argue yes. [18:07.600 --> 18:09.440] Trucks congregate a lot. [18:09.440 --> 18:13.940] They have truck stops, gas stations, rest stops, ports, distribution centers, hubs. [18:14.260 --> 18:18.880] And if you've ever been on the highway, sometimes they take a really long time to pass each other. [18:19.400 --> 18:22.860] We found that with the normal ESP32 dev boards, [18:22.860 --> 18:28.400] we were able to get a total distance of about 120 feet in a dense parking lot. [18:28.400 --> 18:32.260] So this is between all of the different cars that were parked there. [18:32.260 --> 18:34.440] So that's about 12 parking spaces. [18:36.640 --> 18:41.740] Now, the other thing that we found that for many trucks, the diagnostic port is also left on all the time, [18:41.740 --> 18:48.300] which means that it can continually spread even while the driver is sleeping in one of those large sleeper trucks. [18:49.040 --> 18:50.360] So this is fixed, right? [18:50.360 --> 18:55.800] This ability for us to drive up alongside of a truck that's using these popular ELD devices, [18:55.800 --> 19:01.780] reflash it, and then control the vehicle, causing it to speed up, slow down, spread a worm, something like that. [19:01.880 --> 19:03.240] It's fixed. [19:03.260 --> 19:05.340] Well, IO6 responded great. [19:05.340 --> 19:08.940] They went ahead and they pushed out a patch to fix these issues. [19:09.020 --> 19:12.740] And they overall responded well to the vulnerability report. [19:12.740 --> 19:19.820] But these vulnerabilities arose from government-mandated, self-certified devices that lacked sufficient security standards. [19:19.820 --> 19:27.880] So we argue that since government regulators have little incentive to get security right, the problem is not fixed until that changes. [19:27.880 --> 19:28.820] Thank you.