WEBVTT

00:00.000 --> 00:11.580
Okay, so my name is Hedlo Seek, Ricky Lausche, and this is my talk, Micro Hard More Like Micro Easy.

00:11.880 --> 00:13.960
Pause for laughter.

00:14.620 --> 00:17.400
And off to a great start.

00:17.720 --> 00:21.400
Okay, so yeah, first off, let me introduce myself.

00:21.400 --> 00:25.500
I'm a principal security researcher at Keysight Technologies.

00:25.500 --> 00:27.920
I'm based out of Austin, Texas.

00:28.220 --> 00:32.340
I focus mainly on offensive IOT research.

00:32.820 --> 00:37.420
And I've been doing this kind of stuff professionally since 2009.

00:37.420 --> 00:40.240
And I speak at conferences fairly regularly.

00:40.240 --> 00:48.960
I've spoken at DEF CON like five times on the actual stages and this is my first time speaking at IOT Village.

00:49.540 --> 00:53.160
And then I have several hobbies.

00:53.180 --> 00:56.140
Most of them involve me drinking whiskey.

00:56.920 --> 00:58.280
Okay.

00:58.400 --> 00:59.700
So that's who I am.

00:59.700 --> 01:02.060
Let's talk about who Micro Hard is.

01:02.060 --> 01:06.280
They're a Canadian based device manufacturer.

01:06.280 --> 01:13.600
They make basically cellular bridges for Ethernet and serial devices.

01:13.860 --> 01:20.380
They're used in lots of different environments that people really care about.

01:20.380 --> 01:23.340
Such as like, you know, power utilities.

01:23.860 --> 01:28.320
I see unmanned vehicles listed on their list of industries.

01:29.760 --> 01:35.180
You know, just basically everywhere you could possibly think of needing to remotely access a device.

01:35.680 --> 01:39.760
They claim to be involved in some way.

01:40.240 --> 01:43.040
Okay, so that's Micro Hard as a company.

01:43.040 --> 01:47.700
Let's talk about the device that we're going to be looking at today.

01:47.820 --> 01:51.220
It's called a Bullet LTE-NA2.

01:51.220 --> 01:53.260
NA is for North America.

01:53.800 --> 02:01.380
So yeah, this is an LTE bridge for adding cellular connectivity to serial and Ethernet devices.

02:02.680 --> 02:07.420
You know, it's meant for managing installations remotely.

02:07.820 --> 02:10.120
This is a quote from their website.

02:10.120 --> 02:19.080
Connect any device, old and new, serial or Ethernet and provide cellular remote access using the Bullet LTE-NA2.

02:19.080 --> 02:21.820
You know, what could possibly go wrong?

02:22.520 --> 02:29.700
So I actually got this device because I was doing a security audit for a utility company.

02:29.860 --> 02:36.980
And they were wanting to deploy a bunch of different devices and wanted us to check the security of the devices and this was one of them.

02:36.980 --> 02:42.380
And I did not end up recommending that they deploy this in the field.

02:43.660 --> 02:45.260
And you'll see why.

02:47.260 --> 02:57.900
Okay, so first off, from a hardware perspective, it's a 32-bit ARM Cortex A5 processor which you can see in the top view.

02:57.900 --> 03:03.080
This is kind of like the top of the board and the bottom of the board kind of picture.

03:03.860 --> 03:16.840
It's got down in the bottom of the top view next to that orange-ish, yellow-ish thing is expansion flash firmware chip, 128 megs.

03:20.700 --> 03:24.760
The it's also got 256 megs of RAM.

03:24.800 --> 03:32.080
And then on the underside of the board, they've got this QuekTel modem, EC25-AF.

03:32.320 --> 03:44.340
And then they've also got connections for a SIM card slot, PoE, Ethernet, USB and serial in addition to a couple of programmable I.O.

03:44.340 --> 03:45.300
ports.

03:48.760 --> 04:00.520
And then from the firmware perspective, the firmware updates are completely unsigned and unencrypted so you can pretty easily forge your own if you wanted to.

04:01.260 --> 04:05.080
And they were also easy to extract with bin walk.

04:05.980 --> 04:14.840
Inside the firmware updates, it's got the boot loader, it's got the Linux kernel and it's got a full squash FS file system.

04:15.160 --> 04:22.340
So basically you could fully emulate the system if you were so inclined pretty easily.

04:25.190 --> 04:35.410
And then the software itself, the OS is based loosely on open WRT running a Linux 3.6.9 kernel.

04:36.210 --> 04:45.390
In the version that I'm going to be demonstrating today, they were using UHTPD for web.

04:45.390 --> 04:51.790
They changed to that in the subsequent version and you'll see why they decided to change it.

04:52.610 --> 04:58.170
And then yeah, they use DropBear for SSH and TelnetD for Telnet, kind of.

04:58.170 --> 05:12.550
They actually have whenever you log in with one of those services, they end up dropping you into like a jailed debug environment which we'll talk about extensively later on.

05:13.570 --> 05:32.690
And then on the UDP side, they've got a discovery service that basically depending on the type of device you're using, will send out a discovery probe or will answer a discovery probe on one of these three ports and give you a lot of information back.

05:34.190 --> 05:43.330
So it wouldn't be one of my talks if I didn't discuss a discovery protocol because I love discovery protocols.

05:44.890 --> 05:51.490
So on this one, like I said, it listens for broadcast UDP messages.

05:52.070 --> 05:59.690
Port 2077 or 20,077 is for 3G devices.

05:59.690 --> 06:04.470
87 is for IP based devices and 97 is for LTE devices.

06:04.470 --> 06:12.050
So this one would respond to broadcast messages it gets on port 20,097.

06:12.530 --> 06:16.090
The magic probe is the same across the board.

06:16.610 --> 06:19.330
And let's look at what that looks like.

06:19.850 --> 06:30.130
So you can see this is a scanner that I wrote where I just like send out that broadcast packet to each one of those three ports and then I listen for responses.

06:31.070 --> 06:34.690
And so this is what the response looks like on the wire.

06:35.070 --> 06:53.730
One kind of annoying thing is they will respond to you from a random port on their side to your source port but on the broadcast address which makes it really hard to correlate responses.

06:53.730 --> 06:54.690
There you go.

06:55.950 --> 06:56.490
Okay.

06:56.490 --> 07:01.470
So that discovery response contains a lot of useful info.

07:02.090 --> 07:04.510
It's got the MAC address and the IP address.

07:04.550 --> 07:10.510
It's also got the host name and the SSID for any kind of wireless stuff.

07:11.630 --> 07:15.950
And then it has the model name and the firmware version.

07:16.590 --> 07:19.570
And then it's got this thing called NMS.

07:20.150 --> 07:22.690
That's the network management software.

07:22.690 --> 07:30.150
It's like their cloud based thing where you can register all of your devices and track the GPS location of all of them.

07:30.810 --> 07:38.310
It's got the domain and password hash but I'm not going to be talking about NMS today because that's not part of this talk.

07:39.870 --> 07:40.350
Okay.

07:40.350 --> 07:47.750
So and yeah, I wrote a scanner and response parser and I'll put it up on my GitHub which I'll link to later.

07:49.810 --> 07:50.510
Okay.

07:50.510 --> 07:54.190
So let's actually get into the bones .

07:55.250 --> 08:02.330
So the web management portal, this was kind of the main focus of my audit when I was originally looking at these devices.

08:02.930 --> 08:11.550
Like I mentioned earlier, it's UHC2PD based on the version from open WRT in 2014.

08:12.250 --> 08:17.610
It's used for configuring basically every aspect of the device.

08:17.710 --> 08:22.130
And it is also reachable from LAN and WAN side.

08:22.490 --> 08:30.190
And that's enabled by default and you have to actually turn that off if you don't want it reachable from the WAN side.

08:30.790 --> 08:33.870
But the best part is it's all shell scripts.

08:35.650 --> 08:44.910
So like this is the directory listing and it's literally like every single page is a shell script wrapped with a GUI.

08:45.650 --> 08:52.010
So you know, of course, there are multiple command injections throughout this thing.

08:52.410 --> 08:54.930
They're all post off.

08:54.930 --> 08:59.090
So you need a valid user account in order to access these pages.

09:00.430 --> 09:03.070
So yeah, multiple command injections.

09:03.290 --> 09:15.850
My example that I'm showing today is with the diagnostics page because, of course, it implements ping and if it has ping, it has command injection every single time.

09:17.230 --> 09:20.010
Oh my God, is that really my time warning?

09:20.010 --> 09:20.470
Okay.

09:20.470 --> 09:22.990
I have to really book it.

09:23.150 --> 09:23.770
Okay.

09:23.910 --> 09:25.650
So yeah, it has ping.

09:25.650 --> 09:29.530
So they tried to sanitize input but it failed pretty horribly.

09:30.010 --> 09:35.090
They just sanitized the host name and didn't worry about any of the other arguments that you put in there.

09:35.750 --> 09:44.070
So yeah, just leave host name blank and then put whatever command you want all in the account parameter.

09:44.870 --> 09:48.250
And let's show a demo of that real quick.

09:49.570 --> 09:50.110
Okay.

09:50.110 --> 09:59.210
I'm not going to go into lots of the details of the exploits because I'm about to run out of time already.

09:59.650 --> 10:02.570
But yeah, so this is post off.

10:02.570 --> 10:08.270
So you need a valid user name and password.

10:09.650 --> 10:17.170
But then you run that and eventually you will, hey, you got a root shell.

10:17.870 --> 10:26.950
Because you injected, you know, whatever command you wanted to run and it has net cat on it so I was able to get a root shell pretty easily with that one.

10:29.430 --> 10:30.310
Okay.

10:31.010 --> 10:33.130
We're going to hurry up.

10:37.060 --> 10:37.480
Okay.

10:37.480 --> 10:42.120
So yeah, like I said, those phones were all post off.

10:42.560 --> 10:47.040
But I really wanted something that was pre off because that's so much sexier.

10:47.300 --> 10:52.420
So I started looking at the authentication, the way they handled authentication.

10:53.080 --> 10:57.600
And as far as logging in, it was vanilla open WRT.

10:57.600 --> 11:00.600
They used basic off.

11:00.920 --> 11:05.540
So basically base 64 encoded user colon pass.

11:07.080 --> 11:15.680
And so since this is, you know, UHC2PD that's part of open WRT, you'd think it would be very well vetted and everything.

11:15.680 --> 11:21.120
But it is an open source project so they were able to make their own modifications.

11:21.960 --> 11:27.660
And so logins were generic log outs was where they made a mistake.

11:28.820 --> 11:33.840
Basically they wanted to set the basic off header to log out colon log out.

11:34.480 --> 11:41.860
And then they did like a stir copy of that buffer to a statically sized buffer.

11:42.940 --> 11:49.720
And then they could compare what it was to log out log out and, you know, log the person out that way.

11:50.540 --> 11:53.200
But yeah, they didn't do any bounce checking or anything.

11:54.080 --> 12:00.020
So yeah, you can see, I'm just going to skip past this because I'm running out of time.

12:01.300 --> 12:09.500
But yeah, you can see, you know, stir copy and yeah.

12:10.380 --> 12:11.180
Okay.

12:11.180 --> 12:12.500
Let's do another demo.

12:12.500 --> 12:22.220
I am actually going to talk about the code of this one because it was a very pat myself on the back kind of thing.

12:22.220 --> 12:28.700
This was my first ever in the wild ARM ROP exploit.

12:29.300 --> 12:45.140
So basically, yeah, so they do have ASLR and I wasn't able to find like a memory leak or anything to leak the base address of lib C or UC lib C.

12:46.820 --> 12:58.000
So I, for the purposes of this demo, I disabled ASLR but it is the lame version of ASLR where they only randomize the top part.

12:58.380 --> 13:16.620
So in theory, you could brute force by just like picking an address for the base of UC lib C and then just trying over and over again and it will just crash the website if it doesn't work and if it, you know, if it eventually works, then you get a shell .

13:17.260 --> 13:32.600
But yeah, so basically just, you know, calling a system from UC lib C and passing this command as the argument to UC lib C.

13:34.480 --> 13:40.360
And this one, hey, that was really fast.

13:41.040 --> 13:47.760
So yeah, no authentication required for that one because it's exploiting the authentication protocol.

13:48.500 --> 13:51.200
So there's that one.

13:54.350 --> 14:02.130
And this one, and, okay.

14:03.150 --> 14:09.270
Okay, so I disclosed those back at the, when I was doing the audit originally.

14:09.350 --> 14:24.230
They fixed it in R1112 by adding more sanitization and then they switched from using UHT TPD to using light TPD.

14:24.270 --> 14:26.930
So they no longer use UHT TPD.

14:26.930 --> 14:29.250
But it's still all shell scripts.

14:30.030 --> 14:36.910
So yeah, that was the end of the audit and I kind of stopped thinking about the device.

14:36.910 --> 14:45.990
This release note still burns me to this day though because that was the extent of the release note that they used for fixing all of my critical vulnerabilities.

14:46.390 --> 14:50.130
It was miscellaneous housekeeping tasks that really, really bugged me.

14:51.830 --> 14:58.890
Okay, so cut to like a few months ago I decided to dig this device back out and look at it again.

14:58.890 --> 15:01.490
And this time around I was looking at the telnet portal.

15:02.090 --> 15:16.490
So like I mentioned before, it's a jailed environment but they give you lots of access to like QT commands for that, not QT, AT commands for the quick tail modem.

15:16.970 --> 15:20.050
So yeah, you can see they give you lots of commands.

15:21.410 --> 15:25.150
And that's handled by slash bin slash CLI test.

15:26.090 --> 15:29.590
That's spawned every time you log in as the admin user.

15:30.050 --> 15:36.570
And that defines all of the AT commands but not all of the AT commands were documented.

15:36.570 --> 15:37.210
Okay.

15:37.730 --> 15:45.210
So yeah, there was an undocumented command called ATM bash command that lets you run two bash commands.

15:45.290 --> 15:47.050
PS and cat.

15:47.050 --> 15:49.010
And that's it, supposedly.

15:51.250 --> 15:56.490
But the way they verified that is by using certain case compare.

15:56.670 --> 16:02.290
And they were using the length of what they were comparing from either PS or cat.

16:02.290 --> 16:09.670
So as long as the string like began with PS or cat, then you could put whatever you wanted at the end of it.

16:10.230 --> 16:18.670
So basically, yeah, you just do like PS semicolon and then another command and there you go.

16:18.670 --> 16:22.930
Okay, one last demo and then I'm basically done.

16:26.770 --> 16:31.130
Okay, so again, post off.

16:38.390 --> 16:40.450
All right, there you go.

16:42.110 --> 16:49.770
Okay, so let's just blast through these last couple of slides to wrap up.

16:50.890 --> 16:57.710
Okay, so that one was actually coincidentally fixed like the month before I found it, which was also kind of annoying.

16:58.490 --> 17:07.250
But the fix like I mean, it was it was basically just bash command, they removed that one and didn't touch anything else.

17:07.390 --> 17:13.190
And may have also added in some brand new command injection forms in the latest firmware.

17:13.710 --> 17:22.610
But yeah, so you can see where they were trying to secure things and then they just failed miserably every single time.

17:22.730 --> 17:27.070
They need actual like, you know, secure development processes.

17:28.790 --> 17:46.210
And also I get really pissed off about the vague release notes because in my opinion, it like minimizes the impact if I saw something that just said, you know, miscellaneous housekeeping tasks and I'm running in a critical environment, I'm going to completely ignore that update.

17:46.510 --> 17:49.930
Because it seems like it's something I don't have to install.

17:49.930 --> 17:53.130
And so it's just leaving me still vulnerable.

17:53.650 --> 17:58.150
But yeah, and then if it has command, or if it has ping, it has command injection.

17:59.090 --> 18:04.250
And that's how you get in touch with me on headless eek on most things.

18:04.590 --> 18:06.070
And that's my GitHub.

18:07.410 --> 18:10.010
And yeah, that is it.

18:10.010 --> 18:11.810
Sorry if I went over time.

18:12.970 --> 18:14.090
That's it.

