1 00:00:00,000 --> 00:00:11,580 Okay, so my name is Hedlo Seek, Ricky Lausche, and this is my talk, Micro Hard More Like Micro Easy. 2 00:00:11,880 --> 00:00:13,960 Pause for laughter. 3 00:00:14,620 --> 00:00:17,400 And off to a great start. 4 00:00:17,720 --> 00:00:21,400 Okay, so yeah, first off, let me introduce myself. 5 00:00:21,400 --> 00:00:25,500 I'm a principal security researcher at Keysight Technologies. 6 00:00:25,500 --> 00:00:27,920 I'm based out of Austin, Texas. 7 00:00:28,220 --> 00:00:32,340 I focus mainly on offensive IOT research. 8 00:00:32,820 --> 00:00:37,420 And I've been doing this kind of stuff professionally since 2009. 9 00:00:37,420 --> 00:00:40,240 And I speak at conferences fairly regularly. 10 00:00:40,240 --> 00: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. 11 00:00:49,540 --> 00:00:53,160 And then I have several hobbies. 12 00:00:53,180 --> 00:00:56,140 Most of them involve me drinking whiskey. 13 00:00:56,920 --> 00:00:58,280 Okay. 14 00:00:58,400 --> 00:00:59,700 So that's who I am. 15 00:00:59,700 --> 00:01:02,060 Let's talk about who Micro Hard is. 16 00:01:02,060 --> 00:01:06,280 They're a Canadian based device manufacturer. 17 00:01:06,280 --> 00:01:13,600 They make basically cellular bridges for Ethernet and serial devices. 18 00:01:13,860 --> 00:01:20,380 They're used in lots of different environments that people really care about. 19 00:01:20,380 --> 00:01:23,340 Such as like, you know, power utilities. 20 00:01:23,860 --> 00:01:28,320 I see unmanned vehicles listed on their list of industries. 21 00:01:29,760 --> 00:01:35,180 You know, just basically everywhere you could possibly think of needing to remotely access a device. 22 00:01:35,680 --> 00:01:39,760 They claim to be involved in some way. 23 00:01:40,240 --> 00:01:43,040 Okay, so that's Micro Hard as a company. 24 00:01:43,040 --> 00:01:47,700 Let's talk about the device that we're going to be looking at today. 25 00:01:47,820 --> 00:01:51,220 It's called a Bullet LTE-NA2. 26 00:01:51,220 --> 00:01:53,260 NA is for North America. 27 00:01:53,800 --> 00:02:01,380 So yeah, this is an LTE bridge for adding cellular connectivity to serial and Ethernet devices. 28 00:02:02,680 --> 00:02:07,420 You know, it's meant for managing installations remotely. 29 00:02:07,820 --> 00:02:10,120 This is a quote from their website. 30 00:02:10,120 --> 00:02:19,080 Connect any device, old and new, serial or Ethernet and provide cellular remote access using the Bullet LTE-NA2. 31 00:02:19,080 --> 00:02:21,820 You know, what could possibly go wrong? 32 00:02:22,520 --> 00:02:29,700 So I actually got this device because I was doing a security audit for a utility company. 33 00:02:29,860 --> 00: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. 34 00:02:36,980 --> 00:02:42,380 And I did not end up recommending that they deploy this in the field. 35 00:02:43,660 --> 00:02:45,260 And you'll see why. 36 00:02:47,260 --> 00: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. 37 00:02:57,900 --> 00:03:03,080 This is kind of like the top of the board and the bottom of the board kind of picture. 38 00:03:03,860 --> 00: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. 39 00:03:20,700 --> 00:03:24,760 The it's also got 256 megs of RAM. 40 00:03:24,800 --> 00:03:32,080 And then on the underside of the board, they've got this QuekTel modem, EC25-AF. 41 00:03:32,320 --> 00: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. 42 00:03:44,340 --> 00:03:45,300 ports. 43 00:03:48,760 --> 00: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. 44 00:04:01,260 --> 00:04:05,080 And they were also easy to extract with bin walk. 45 00:04:05,980 --> 00: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. 46 00:04:15,160 --> 00:04:22,340 So basically you could fully emulate the system if you were so inclined pretty easily. 47 00:04:25,190 --> 00:04:35,410 And then the software itself, the OS is based loosely on open WRT running a Linux 3.6.9 kernel. 48 00:04:36,210 --> 00:04:45,390 In the version that I'm going to be demonstrating today, they were using UHTPD for web. 49 00:04:45,390 --> 00:04:51,790 They changed to that in the subsequent version and you'll see why they decided to change it. 50 00:04:52,610 --> 00:04:58,170 And then yeah, they use DropBear for SSH and TelnetD for Telnet, kind of. 51 00:04:58,170 --> 00: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. 52 00:05:13,570 --> 00: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. 53 00:05:34,190 --> 00: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. 54 00:05:44,890 --> 00:05:51,490 So on this one, like I said, it listens for broadcast UDP messages. 55 00:05:52,070 --> 00:05:59,690 Port 2077 or 20,077 is for 3G devices. 56 00:05:59,690 --> 00:06:04,470 87 is for IP based devices and 97 is for LTE devices. 57 00:06:04,470 --> 00:06:12,050 So this one would respond to broadcast messages it gets on port 20,097. 58 00:06:12,530 --> 00:06:16,090 The magic probe is the same across the board. 59 00:06:16,610 --> 00:06:19,330 And let's look at what that looks like. 60 00:06:19,850 --> 00: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. 61 00:06:31,070 --> 00:06:34,690 And so this is what the response looks like on the wire. 62 00:06:35,070 --> 00: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. 63 00:06:53,730 --> 00:06:54,690 There you go. 64 00:06:55,950 --> 00:06:56,490 Okay. 65 00:06:56,490 --> 00:07:01,470 So that discovery response contains a lot of useful info. 66 00:07:02,090 --> 00:07:04,510 It's got the MAC address and the IP address. 67 00:07:04,550 --> 00:07:10,510 It's also got the host name and the SSID for any kind of wireless stuff. 68 00:07:11,630 --> 00:07:15,950 And then it has the model name and the firmware version. 69 00:07:16,590 --> 00:07:19,570 And then it's got this thing called NMS. 70 00:07:20,150 --> 00:07:22,690 That's the network management software. 71 00:07:22,690 --> 00: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. 72 00:07:30,810 --> 00: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. 73 00:07:39,870 --> 00:07:40,350 Okay. 74 00:07:40,350 --> 00: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. 75 00:07:49,810 --> 00:07:50,510 Okay. 76 00:07:50,510 --> 00:07:54,190 So let's actually get into the bones . 77 00:07:55,250 --> 00: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. 78 00:08:02,930 --> 00:08:11,550 Like I mentioned earlier, it's UHC2PD based on the version from open WRT in 2014. 79 00:08:12,250 --> 00:08:17,610 It's used for configuring basically every aspect of the device. 80 00:08:17,710 --> 00:08:22,130 And it is also reachable from LAN and WAN side. 81 00:08:22,490 --> 00: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. 82 00:08:30,790 --> 00:08:33,870 But the best part is it's all shell scripts. 83 00:08:35,650 --> 00: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. 84 00:08:45,650 --> 00:08:52,010 So you know, of course, there are multiple command injections throughout this thing. 85 00:08:52,410 --> 00:08:54,930 They're all post off. 86 00:08:54,930 --> 00:08:59,090 So you need a valid user account in order to access these pages. 87 00:09:00,430 --> 00:09:03,070 So yeah, multiple command injections. 88 00:09:03,290 --> 00: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. 89 00:09:17,230 --> 00:09:20,010 Oh my God, is that really my time warning? 90 00:09:20,010 --> 00:09:20,470 Okay. 91 00:09:20,470 --> 00:09:22,990 I have to really book it. 92 00:09:23,150 --> 00:09:23,770 Okay. 93 00:09:23,910 --> 00:09:25,650 So yeah, it has ping. 94 00:09:25,650 --> 00:09:29,530 So they tried to sanitize input but it failed pretty horribly. 95 00:09:30,010 --> 00:09:35,090 They just sanitized the host name and didn't worry about any of the other arguments that you put in there. 96 00:09:35,750 --> 00:09:44,070 So yeah, just leave host name blank and then put whatever command you want all in the account parameter. 97 00:09:44,870 --> 00:09:48,250 And let's show a demo of that real quick. 98 00:09:49,570 --> 00:09:50,110 Okay. 99 00:09:50,110 --> 00: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. 100 00:09:59,650 --> 00:10:02,570 But yeah, so this is post off. 101 00:10:02,570 --> 00:10:08,270 So you need a valid user name and password. 102 00:10:09,650 --> 00:10:17,170 But then you run that and eventually you will, hey, you got a root shell. 103 00:10:17,870 --> 00: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. 104 00:10:29,430 --> 00:10:30,310 Okay. 105 00:10:31,010 --> 00:10:33,130 We're going to hurry up. 106 00:10:37,060 --> 00:10:37,480 Okay. 107 00:10:37,480 --> 00:10:42,120 So yeah, like I said, those phones were all post off. 108 00:10:42,560 --> 00:10:47,040 But I really wanted something that was pre off because that's so much sexier. 109 00:10:47,300 --> 00:10:52,420 So I started looking at the authentication, the way they handled authentication. 110 00:10:53,080 --> 00:10:57,600 And as far as logging in, it was vanilla open WRT. 111 00:10:57,600 --> 00:11:00,600 They used basic off. 112 00:11:00,920 --> 00:11:05,540 So basically base 64 encoded user colon pass. 113 00:11:07,080 --> 00: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. 114 00:11:15,680 --> 00:11:21,120 But it is an open source project so they were able to make their own modifications. 115 00:11:21,960 --> 00:11:27,660 And so logins were generic log outs was where they made a mistake. 116 00:11:28,820 --> 00:11:33,840 Basically they wanted to set the basic off header to log out colon log out. 117 00:11:34,480 --> 00:11:41,860 And then they did like a stir copy of that buffer to a statically sized buffer. 118 00:11:42,940 --> 00: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. 119 00:11:50,540 --> 00:11:53,200 But yeah, they didn't do any bounce checking or anything. 120 00:11:54,080 --> 00:12:00,020 So yeah, you can see, I'm just going to skip past this because I'm running out of time. 121 00:12:01,300 --> 00:12:09,500 But yeah, you can see, you know, stir copy and yeah. 122 00:12:10,380 --> 00:12:11,180 Okay. 123 00:12:11,180 --> 00:12:12,500 Let's do another demo. 124 00:12:12,500 --> 00: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. 125 00:12:22,220 --> 00:12:28,700 This was my first ever in the wild ARM ROP exploit. 126 00:12:29,300 --> 00: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. 127 00:12:46,820 --> 00: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. 128 00:12:58,380 --> 00: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 . 129 00:13:17,260 --> 00: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. 130 00:13:34,480 --> 00:13:40,360 And this one, hey, that was really fast. 131 00:13:41,040 --> 00:13:47,760 So yeah, no authentication required for that one because it's exploiting the authentication protocol. 132 00:13:48,500 --> 00:13:51,200 So there's that one. 133 00:13:54,350 --> 00:14:02,130 And this one, and, okay. 134 00:14:03,150 --> 00:14:09,270 Okay, so I disclosed those back at the, when I was doing the audit originally. 135 00:14:09,350 --> 00:14:24,230 They fixed it in R1112 by adding more sanitization and then they switched from using UHT TPD to using light TPD. 136 00:14:24,270 --> 00:14:26,930 So they no longer use UHT TPD. 137 00:14:26,930 --> 00:14:29,250 But it's still all shell scripts. 138 00:14:30,030 --> 00:14:36,910 So yeah, that was the end of the audit and I kind of stopped thinking about the device. 139 00:14:36,910 --> 00: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. 140 00:14:46,390 --> 00:14:50,130 It was miscellaneous housekeeping tasks that really, really bugged me. 141 00:14:51,830 --> 00: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. 142 00:14:58,890 --> 00:15:01,490 And this time around I was looking at the telnet portal. 143 00:15:02,090 --> 00: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. 144 00:15:16,970 --> 00:15:20,050 So yeah, you can see they give you lots of commands. 145 00:15:21,410 --> 00:15:25,150 And that's handled by slash bin slash CLI test. 146 00:15:26,090 --> 00:15:29,590 That's spawned every time you log in as the admin user. 147 00:15:30,050 --> 00:15:36,570 And that defines all of the AT commands but not all of the AT commands were documented. 148 00:15:36,570 --> 00:15:37,210 Okay. 149 00:15:37,730 --> 00:15:45,210 So yeah, there was an undocumented command called ATM bash command that lets you run two bash commands. 150 00:15:45,290 --> 00:15:47,050 PS and cat. 151 00:15:47,050 --> 00:15:49,010 And that's it, supposedly. 152 00:15:51,250 --> 00:15:56,490 But the way they verified that is by using certain case compare. 153 00:15:56,670 --> 00:16:02,290 And they were using the length of what they were comparing from either PS or cat. 154 00:16:02,290 --> 00: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. 155 00:16:10,230 --> 00:16:18,670 So basically, yeah, you just do like PS semicolon and then another command and there you go. 156 00:16:18,670 --> 00:16:22,930 Okay, one last demo and then I'm basically done. 157 00:16:26,770 --> 00:16:31,130 Okay, so again, post off. 158 00:16:38,390 --> 00:16:40,450 All right, there you go. 159 00:16:42,110 --> 00:16:49,770 Okay, so let's just blast through these last couple of slides to wrap up. 160 00:16:50,890 --> 00:16:57,710 Okay, so that one was actually coincidentally fixed like the month before I found it, which was also kind of annoying. 161 00:16:58,490 --> 00: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. 162 00:17:07,390 --> 00:17:13,190 And may have also added in some brand new command injection forms in the latest firmware. 163 00:17:13,710 --> 00: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. 164 00:17:22,730 --> 00:17:27,070 They need actual like, you know, secure development processes. 165 00:17:28,790 --> 00: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. 166 00:17:46,510 --> 00:17:49,930 Because it seems like it's something I don't have to install. 167 00:17:49,930 --> 00:17:53,130 And so it's just leaving me still vulnerable. 168 00:17:53,650 --> 00:17:58,150 But yeah, and then if it has command, or if it has ping, it has command injection. 169 00:17:59,090 --> 00:18:04,250 And that's how you get in touch with me on headless eek on most things. 170 00:18:04,590 --> 00:18:06,070 And that's my GitHub. 171 00:18:07,410 --> 00:18:10,010 And yeah, that is it. 172 00:18:10,010 --> 00:18:11,810 Sorry if I went over time. 173 00:18:12,970 --> 00:18:14,090 That's it.