[00:00.000 --> 00:06.340] Okay, so my name is Hedlo Seek, Ricky Lausche, and this is my [00:06.340 --> 00:15.220] talk, Micro Hard More Like Micro Easy. Pause for laughter. And [00:15.220 --> 00:20.340] off to a great start. Okay, so yeah, first off, let me [00:20.340 --> 00:24.360] introduce myself. I'm a principal security researcher at [00:24.360 --> 00:29.160] Keysight Technologies. I'm based out of Austin, Texas. I focus [00:29.160 --> 00:33.780] mainly on offensive IOT research. And I've been doing [00:33.780 --> 00:37.640] this kind of stuff professionally since 2009. And I [00:37.640 --> 00:41.600] speak at conferences fairly regularly. I've spoken at DEF [00:41.600 --> 00:46.460] CON like five times on the actual stages and this is my [00:46.460 --> 00:51.040] first time speaking at IOT Village. And then I have [00:51.040 --> 00:56.140] several hobbies. Most of them involve me drinking whiskey. [00:56.920 --> 01:02.060] Okay. So that's who I am. Let's talk about who Micro Hard is. [01:02.060 --> 01:07.020] They're a Canadian based device manufacturer. They make [01:07.020 --> 01:13.600] basically cellular bridges for Ethernet and serial devices. [01:13.860 --> 01:17.740] They're used in lots of different environments that [01:17.740 --> 01:22.180] people really care about. Such as like, you know, power [01:22.180 --> 01:27.180] utilities. I see unmanned vehicles listed on their list of [01:27.180 --> 01:31.660] industries. You know, just basically everywhere you could [01:31.660 --> 01:35.880] possibly think of needing to remotely access a device. They [01:36.480 --> 01:42.080] claim to be involved in some way. Okay, so that's Micro Hard [01:42.080 --> 01:46.340] as a company. Let's talk about the device that we're going to [01:46.340 --> 01:51.880] be looking at today. It's called a Bullet LTE-NA2. NA is for [01:51.880 --> 01:56.500] North America. So yeah, this is an LTE bridge for adding [01:56.500 --> 02:03.300] cellular connectivity to serial and Ethernet devices. You know, [02:03.300 --> 02:08.380] it's meant for managing installations remotely. This is [02:08.740 --> 02:12.940] a quote from their website. Connect any device, old and new, [02:12.940 --> 02:16.620] serial or Ethernet and provide cellular remote access using the [02:16.620 --> 02:21.820] Bullet LTE-NA2. You know, what could possibly go wrong? [02:22.520 --> 02:25.840] So I actually got this device because I was doing a security [02:25.840 --> 02:31.760] audit for a utility company. And they were wanting to deploy a [02:31.760 --> 02:35.000] bunch of different devices and wanted us to check the security [02:35.000 --> 02:38.820] of the devices and this was one of them. And I did not end up [02:38.820 --> 02:44.500] recommending that they deploy this in the field. And you'll [02:44.500 --> 02:51.300] see why. Okay, so first off, from a hardware perspective, [02:51.790 --> 02:57.120] it's a 32-bit ARM Cortex A5 processor which you can see in [02:57.120 --> 03:00.360] the top view. This is kind of like the top of the board and [03:00.360 --> 03:06.080] the bottom of the board kind of picture. It's got down in the [03:06.080 --> 03:09.960] bottom of the top view next to that orange-ish, yellow-ish [03:09.960 --> 03:21.280] thing is expansion flash firmware chip, 128 megs. The [03:21.280 --> 03:26.220] it's also got 256 megs of RAM. And then on the underside of the [03:26.220 --> 03:33.000] board, they've got this QuekTel modem, EC25-AF. And then they've [03:33.000 --> 03:39.620] also got connections for a SIM card slot, PoE, Ethernet, USB [03:39.620 --> 03:44.340] and serial in addition to a couple of programmable I.O. [03:44.340 --> 03:52.420] ports. And then from the firmware perspective, the [03:52.420 --> 03:56.740] firmware updates are completely unsigned and unencrypted so you [03:56.740 --> 04:01.740] can pretty easily forge your own if you wanted to. And they were [04:01.740 --> 04:07.220] also easy to extract with bin walk. Inside the firmware [04:07.220 --> 04:11.060] updates, it's got the boot loader, it's got the Linux [04:11.060 --> 04:15.280] kernel and it's got a full squash FS file system. So [04:15.280 --> 04:19.320] basically you could fully emulate the system if you were [04:19.320 --> 04:27.810] so inclined pretty easily. And then the software itself, the OS [04:27.810 --> 04:36.690] is based loosely on open WRT running a Linux 3.6.9 kernel. In [04:36.690 --> 04:41.750] the version that I'm going to be demonstrating today, they were [04:41.750 --> 04:47.270] using UHTPD for web. They changed to that in the subsequent [04:47.270 --> 04:52.930] version and you'll see why they decided to change it. And then [04:52.930 --> 04:58.170] yeah, they use DropBear for SSH and TelnetD for Telnet, kind of. [04:58.170 --> 05:01.730] They actually have whenever you log in with one of those [05:01.730 --> 05:06.850] services, they end up dropping you into like a jailed debug [05:06.850 --> 05:13.850] environment which we'll talk about extensively later on. And [05:13.850 --> 05:18.410] then on the UDP side, they've got a discovery service that [05:18.410 --> 05:23.090] basically depending on the type of device you're using, will [05:23.090 --> 05:27.750] send out a discovery probe or will answer a discovery probe on [05:27.750 --> 05:31.310] one of these three ports and give you a lot of information [05:31.310 --> 05:39.650] back. So it wouldn't be one of my talks if I didn't discuss a [05:39.650 --> 05:45.390] discovery protocol because I love discovery protocols. So on [05:45.390 --> 05:49.950] this one, like I said, it listens for broadcast UDP [05:49.950 --> 06:00.930] messages. Port 2077 or 20,077 is for 3G devices. 87 is for IP [06:00.930 --> 06:05.110] based devices and 97 is for LTE devices. So this one would [06:05.110 --> 06:13.150] respond to broadcast messages it gets on port 20,097. The magic [06:13.150 --> 06:17.990] probe is the same across the board. And let's look at what [06:17.990 --> 06:22.870] that looks like. So you can see this is a scanner that I wrote [06:22.870 --> 06:26.470] where I just like send out that broadcast packet to each one of [06:26.470 --> 06:31.390] those three ports and then I listen for responses. And so [06:31.390 --> 06:35.670] this is what the response looks like on the wire. One kind of [06:35.670 --> 06:44.010] annoying thing is they will respond to you from a random [06:44.010 --> 06:48.250] port on their side to your source port but on the broadcast [06:48.250 --> 06:53.730] address which makes it really hard to correlate responses. [06:53.730 --> 06:59.950] There you go. Okay. So that discovery response contains a [06:59.950 --> 07:04.510] lot of useful info. It's got the MAC address and the IP address. [07:04.550 --> 07:08.190] It's also got the host name and the SSID for any kind of [07:08.190 --> 07:14.870] wireless stuff. And then it has the model name and the firmware [07:14.870 --> 07:21.030] version. And then it's got this thing called NMS. That's the [07:21.030 --> 07:24.310] network management software. It's like their cloud based [07:25.370 --> 07:28.210] thing where you can register all of your devices and track the [07:28.210 --> 07:32.310] GPS location of all of them. It's got the domain and password [07:32.310 --> 07:35.990] hash but I'm not going to be talking about NMS today because [07:35.990 --> 07:42.890] that's not part of this talk. Okay. So and yeah, I wrote a [07:42.890 --> 07:46.210] scanner and response parser and I'll put it up on my GitHub [07:46.210 --> 07:53.730] which I'll link to later. Okay. So let's actually get into the [07:53.730 --> 07:57.550] bones. So the web management portal, this was kind of the [07:57.550 --> 08:01.150] main focus of my audit when I was originally looking at these [08:01.150 --> 08:07.830] devices. Like I mentioned earlier, it's UHC2PD based on [08:07.830 --> 08:14.010] the version from open WRT in 2014. It's used for configuring [08:14.010 --> 08:18.990] basically every aspect of the device. And it is also reachable [08:18.990 --> 08:24.050] from LAN and WAN side. And that's enabled by default and [08:24.050 --> 08:27.530] you have to actually turn that off if you don't want it [08:27.530 --> 08:32.870] reachable from the WAN side. But the best part is it's all shell [08:32.870 --> 08:39.990] scripts. So like this is the directory listing and it's [08:39.990 --> 08:43.890] literally like every single page is a shell script wrapped with [08:44.050 --> 08:49.950] a GUI. So you know, of course, there are multiple command [08:49.950 --> 08:55.030] injections throughout this thing. They're all post off. So [08:55.030 --> 09:00.730] you need a valid user account in order to access these pages. So [09:00.730 --> 09:04.170] yeah, multiple command injections. My example that I'm [09:04.170 --> 09:09.690] showing today is with the diagnostics page because, of [09:09.690 --> 09:13.710] course, it implements ping and if it has ping, it has command [09:13.710 --> 09:19.430] injection every single time. Oh my God, is that really my time [09:19.430 --> 09:25.030] warning? Okay. I have to really book it. Okay. So yeah, it has [09:25.030 --> 09:28.650] ping. So they tried to sanitize input but it failed pretty [09:28.650 --> 09:32.290] horribly. They just sanitized the host name and didn't worry [09:32.290 --> 09:36.590] about any of the other arguments that you put in there. So yeah, [09:36.590 --> 09:40.310] just leave host name blank and then put whatever command you [09:40.310 --> 09:46.250] want all in the account parameter. And let's show a demo [09:46.250 --> 09:54.770] of that real quick. Okay. I'm not going to go into lots of the [09:54.770 --> 09:58.170] details of the exploits because I'm about to run out of time [09:58.170 --> 10:05.250] already. But yeah, so this is post off. So you need a valid [10:05.250 --> 10:14.490] user name and password. But then you run that and eventually you [10:14.490 --> 10:20.330] will, hey, you got a root shell. Because you injected, you know, [10:20.330 --> 10:23.250] whatever command you wanted to run and it has net cat on it so [10:23.770 --> 10:26.950] I was able to get a root shell pretty easily with that one. [10:29.430 --> 10:38.740] Okay. We're going to hurry up. Okay. So yeah, like I said, [10:38.740 --> 10:43.720] those phones were all post off. But I really wanted something [10:43.720 --> 10:47.780] that was pre off because that's so much sexier. So I started [10:47.780 --> 10:51.100] looking at the authentication, the way they handled [10:51.100 --> 10:56.740] authentication. And as far as logging in, it was vanilla open [10:56.740 --> 11:03.840] WRT. They used basic off. So basically base 64 encoded user [11:03.840 --> 11:11.080] colon pass. And so since this is, you know, UHC2PD that's [11:11.080 --> 11:14.960] part of open WRT, you'd think it would be very well vetted and [11:14.960 --> 11:18.800] everything. But it is an open source project so they were able [11:18.800 --> 11:24.660] to make their own modifications. And so logins were generic log [11:24.660 --> 11:29.840] outs was where they made a mistake. Basically they wanted [11:29.840 --> 11:35.020] to set the basic off header to log out colon log out. And then [11:35.020 --> 11:39.560] they did like a stir copy of that buffer to a statically [11:39.560 --> 11:45.560] sized buffer. And then they could compare what it was to [11:45.560 --> 11:50.780] log out log out and, you know, log the person out that way. But [11:50.780 --> 11:56.120] yeah, they didn't do any bounce checking or anything. So yeah, [11:56.120 --> 11:58.880] you can see, I'm just going to skip past this because I'm [11:58.880 --> 12:04.820] running out of time. But yeah, you can see, you know, stir [12:04.820 --> 12:13.280] copy and yeah. Okay. Let's do another demo. I am actually [12:13.280 --> 12:16.100] going to talk about the code of this one because it was a very [12:17.220 --> 12:24.480] pat myself on the back kind of thing. This was my first ever in [12:24.480 --> 12:34.020] the wild ARM ROP exploit. So basically, yeah, so they do have [12:34.720 --> 12:40.020] ASLR and I wasn't able to find like a memory leak or anything [12:40.020 --> 12:49.440] to leak the base address of lib C or UC lib C. So I, for the [12:49.440 --> 12:54.040] purposes of this demo, I disabled ASLR but it is the lame [12:54.040 --> 12:58.900] version of ASLR where they only randomize the top part. So in [12:58.900 --> 13:05.980] theory, you could brute force by just like picking an address for [13:05.980 --> 13:09.460] the base of UC lib C and then just trying over and over again [13:09.460 --> 13:12.460] and it will just crash the website if it doesn't work and [13:12.460 --> 13:16.160] if it, you know, if it eventually works, then you get a [13:16.160 --> 13:22.940] shell. But yeah, so basically just, you know, calling a system [13:22.940 --> 13:31.340] from UC lib C and passing this command as the argument to UC [13:31.340 --> 13:41.560] lib C. And this one, hey, that was really fast. So yeah, no [13:41.560 --> 13:45.360] authentication required for that one because it's exploiting the [13:45.360 --> 13:55.150] authentication protocol. So there's that one. And this one, [13:55.170 --> 14:07.430] and, okay. Okay, so I disclosed those back at the, when I was [14:07.430 --> 14:15.310] doing the audit originally. They fixed it in R1112 by adding [14:15.310 --> 14:22.090] more sanitization and then they switched from using UHT TPD to [14:22.090 --> 14:27.630] using light TPD. So they no longer use UHT TPD. But it's [14:27.630 --> 14:32.450] still all shell scripts. So yeah, that was the end of the [14:32.450 --> 14:37.150] audit and I kind of stopped thinking about the device. This [14:37.150 --> 14:40.910] release note still burns me to this day though because that was [14:40.910 --> 14:44.330] the extent of the release note that they used for fixing all of [14:44.330 --> 14:47.590] my critical vulnerabilities. It was miscellaneous housekeeping [14:47.590 --> 14:54.410] tasks that really, really bugged me. Okay, so cut to like a few [14:54.410 --> 14:58.330] months ago I decided to dig this device back out and look at it [14:58.330 --> 15:01.490] again. And this time around I was looking at the telnet portal. [15:02.090 --> 15:08.330] So like I mentioned before, it's a jailed environment but they [15:08.330 --> 15:14.170] give you lots of access to like QT commands for that, not QT, AT [15:14.170 --> 15:18.290] commands for the quick tail modem. So yeah, you can see they [15:18.290 --> 15:23.410] give you lots of commands. And that's handled by slash bin slash [15:23.410 --> 15:28.490] CLI test. That's spawned every time you log in as the admin [15:28.490 --> 15:34.510] user. And that defines all of the AT commands but not all of [15:34.510 --> 15:38.970] the AT commands were documented. Okay. So yeah, there was an [15:38.970 --> 15:43.210] undocumented command called ATM bash command that lets you run [15:43.210 --> 15:51.890] two bash commands. PS and cat. And that's it, supposedly. But [15:51.890 --> 15:56.690] the way they verified that is by using certain case compare. And [15:56.690 --> 16:00.770] they were using the length of what they were comparing from [16:00.770 --> 16:05.970] either PS or cat. So as long as the string like began with PS or [16:05.970 --> 16:10.390] cat, then you could put whatever you wanted at the end of it. So [16:11.290 --> 16:15.510] basically, yeah, you just do like PS semicolon and then [16:15.510 --> 16:20.430] another command and there you go. Okay, one last demo and then [16:20.430 --> 16:39.310] I'm basically done. Okay, so again, post off. All right, [16:39.310 --> 16:47.810] there you go. Okay, so let's just blast through these last [16:47.810 --> 16:52.530] couple of slides to wrap up. Okay, so that one was actually [16:52.530 --> 16:56.170] coincidentally fixed like the month before I found it, which [16:56.170 --> 17:01.550] was also kind of annoying. But the fix like I mean, it was it [17:01.550 --> 17:05.670] was basically just bash command, they removed that one and didn't [17:05.670 --> 17:09.490] touch anything else. And may have also added in some brand [17:09.490 --> 17:14.050] new command injection forms in the latest firmware. But yeah, [17:14.050 --> 17:19.470] so you can see where they were trying to secure things and then [17:19.470 --> 17:23.890] they just failed miserably every single time. They need actual [17:23.890 --> 17:29.790] like, you know, secure development processes. And also [17:29.790 --> 17:33.290] I get really pissed off about the vague release notes because [17:33.290 --> 17:36.890] in my opinion, it like minimizes the impact if I saw something [17:36.890 --> 17:40.670] that just said, you know, miscellaneous housekeeping tasks [17:40.670 --> 17:44.370] and I'm running in a critical environment, I'm going to [17:44.370 --> 17:47.790] completely ignore that update. Because it seems like it's [17:47.790 --> 17:51.070] something I don't have to install. And so it's just [17:51.070 --> 17:55.050] leaving me still vulnerable. But yeah, and then if it has [17:55.050 --> 17:59.590] command, or if it has ping, it has command injection. And [17:59.590 --> 18:03.190] that's how you get in touch with me on headless eek on most [18:03.190 --> 18:10.490] things. And that's my GitHub. And yeah, that is it. Sorry if I [18:10.490 --> 18:14.090] went over time. That's it.