1 00:00:00,000 --> 00:00:06,300 So, my name is Pedro Joaquin, and I will be talking about some recent attacks and vulnerabilities on the 2IR residential gateway. 2 00:00:08,900 --> 00:00:14,840 First some info about me. I was born in Cozumel Island, which is in the Mexican Caribbean, near Cancun. 3 00:00:16,040 --> 00:00:20,740 I have worked as a forensic investigator, malware analyst, and an incident response. 4 00:00:20,740 --> 00:00:30,220 My personal webpage is joaquin.ws, and my forums that I opened like about 8 years ago are underground.org.mx. 5 00:00:30,720 --> 00:00:37,800 Over the past few years I have been researching on residential router vulnerabilities, focusing primarily on the 2IR residential gateway. 6 00:00:39,760 --> 00:00:43,420 This is the 2IR residential gateway, like the one I brought right here. 7 00:00:43,960 --> 00:00:50,680 It's a modem and router which has different functions, such as firewall capabilities, home networks, 8 00:00:50,740 --> 00:00:52,200 networking, and many others. 9 00:00:52,660 --> 00:00:56,700 It also comes in black, and it's available in many different countries. 10 00:00:58,040 --> 00:01:03,860 Actually, yesterday we went limo-wiredriving, and we saw many 2IRs around here also. 11 00:01:05,540 --> 00:01:13,280 Of course, it's provided by many different providers, including Telmex in Mexico, which is where I based all my research upon. 12 00:01:13,880 --> 00:01:18,780 In Mexico, we used to have only one telecommunications company. It was a big monopoly. 13 00:01:19,120 --> 00:01:20,660 Up until recently. 14 00:01:20,740 --> 00:01:25,560 In recent years, many other, well, some other companies have tried to enter the market. 15 00:01:25,880 --> 00:01:34,140 But primarily, Telmex has the most amount of users out there in Mexico, and this is their main device for connecting to the internet. 16 00:01:35,020 --> 00:01:39,480 I'm going to talk about vulnerabilities in the web interface of the 2IR modem. 17 00:01:39,760 --> 00:01:45,460 Typical cross-site request forgery, authentication bypass, some denials of service, and others. 18 00:01:46,880 --> 00:01:50,400 This is the web interface of the modem. 19 00:01:50,400 --> 00:01:52,100 As you can see, it's pretty simple. 20 00:01:52,260 --> 00:01:59,600 It has the firewall, the home networking, and I don't know if you can see it, but the speed is almost 4 megabytes. 21 00:01:59,820 --> 00:02:04,140 That is the fastest DSL speed a corporate user in Mexico can get. 22 00:02:06,300 --> 00:02:11,540 A home user can only get about 3 megabytes, and they never actually give you that speed. 23 00:02:12,420 --> 00:02:14,760 It's for about $90 a month. 24 00:02:16,500 --> 00:02:17,020 Yeah. 25 00:02:17,020 --> 00:02:23,340 Well, to enter this configuration interface, you can use the default IP or the default domain, which is gateway.2ir.net. 26 00:02:24,500 --> 00:02:28,820 And there's also an advanced configuration interface, which is the management and diagnostic console. 27 00:02:29,420 --> 00:02:38,240 It has several advanced functions, including a DNS name table, which acts just as a normal host table like any operating system. 28 00:02:38,420 --> 00:02:40,520 You know, it points a domain to a specific IP. 29 00:02:42,180 --> 00:02:51,060 Of course, all of these vulnerabilities are client-side, which means that you have to force the client to perform a request to the modem in order to change certain configuration. 30 00:02:51,760 --> 00:02:53,500 There are many ways of doing this. 31 00:02:53,600 --> 00:03:00,540 The typical ways are like by sending some kind of file or by visiting a web page, which has many different ways of doing it. 32 00:03:00,900 --> 00:03:04,360 But that's not the scope of this presentation, so I'll just go on. 33 00:03:04,640 --> 00:03:08,660 The first vulnerability I'm going to talk about is cross-site request forgery. 34 00:03:08,660 --> 00:03:12,340 You can see from the first example, it's pretty simple. 35 00:03:12,520 --> 00:03:15,500 What it does, it disables the wireless encryption. 36 00:03:15,800 --> 00:03:21,160 So if you have WEP or WPA or whatever, you visit a web page and it gets disabled. 37 00:03:21,560 --> 00:03:23,860 And the second one is the popular one. 38 00:03:24,240 --> 00:03:27,460 What it does is actually it adds a domain to the host table. 39 00:03:28,620 --> 00:03:30,280 I have a quick video here. 40 00:03:30,460 --> 00:03:31,360 Let's see if it works. 41 00:03:46,620 --> 00:03:47,780 It's a simple demonstration. 42 00:03:48,060 --> 00:03:53,100 I'm trying to look up the domain prueba.hola, and it doesn't exist. 43 00:03:53,740 --> 00:03:58,860 So I visit this web page, a malicious web page, 44 00:04:00,140 --> 00:04:07,860 which actually only contains an HTML image tag with the code I just showed you before, and it gets added to the host table. 45 00:04:08,660 --> 00:04:15,160 So next time you try to resolve the domain, you get the IP. 46 00:04:22,180 --> 00:04:27,000 Of course, I tried telling to Wire about this and my provider, and I got no response. 47 00:04:27,440 --> 00:04:31,580 So I made it public, and in about a month, it got like 50,000 views. 48 00:04:32,240 --> 00:04:36,640 And of course, it was used on the wild to perform router farming. 49 00:04:36,640 --> 00:04:47,040 This is a typical example, which is quite funny, because you got an email which had HTML in it from a greeting card service, right? 50 00:04:47,140 --> 00:04:50,840 The greeting card's name is gusanito.com, which actually means little worm. 51 00:04:53,160 --> 00:04:54,700 And it contained... 52 00:04:55,420 --> 00:04:59,620 And it's for the domain gusanito actually exists, and it's for greeting cards. 53 00:04:59,820 --> 00:05:04,560 It contained HTML code with the typical image tag that redirected the domain banamex to that IP. 54 00:05:05,060 --> 00:05:08,360 Banamex is one of the largest banking sites... banks in Mexico. 55 00:05:10,420 --> 00:05:13,760 Symantec reported this as being the first case of drive-by farming. 56 00:05:15,340 --> 00:05:22,060 Their example showed, of course, a fake email that came from a known news agency in Mexico. 57 00:05:22,320 --> 00:05:27,140 And when you click the link, it sends you to a web page, and in that web page, you've got your router farmed. 58 00:05:27,140 --> 00:05:29,900 Now, next time you try to access Banamex, you go to the fake website. 59 00:05:30,620 --> 00:05:40,100 The only kind of response I got from my provider was that right now you can download from their site a router DNS cleaning guide. 60 00:05:40,660 --> 00:05:45,400 But it suggests that you remove the domain banamex from your router, and also my domain. 61 00:05:46,480 --> 00:05:53,660 But thankfully this got patched. Well, not thankfully, because actually the patch opened a bigger vulnerability. 62 00:05:55,420 --> 00:05:59,760 Yeah, we thought that if you had a password set in your modem, you were fine. 63 00:05:59,760 --> 00:06:02,980 Because in order to perform the request, you needed a valid session. 64 00:06:03,580 --> 00:06:07,520 So it was easy to just create a page that forced you to set a password. 65 00:06:07,860 --> 00:06:13,720 So this page was so good at setting a password that it even set the password if it was already set. 66 00:06:16,600 --> 00:06:23,600 So all the routers that had a password set and we thought were safe, well, with the patch, now they are all vulnerable. 67 00:06:25,400 --> 00:06:25,880 Yeah. 68 00:06:25,880 --> 00:06:29,900 But this got patched like two or three months after that. 69 00:06:30,080 --> 00:06:36,180 So we thought that there was no other way to reset the password, except for the real function of resetting the password. 70 00:06:36,660 --> 00:06:38,020 Which was, oh well. 71 00:06:38,760 --> 00:06:40,280 This was also used on the wild. 72 00:06:40,400 --> 00:06:44,980 For example, in ATT&CK, for the authentication bypass, they used a shockwave flash. 73 00:06:45,340 --> 00:06:47,020 You know the classic skip intro page? 74 00:06:47,400 --> 00:06:50,480 The main intro page for any website. 75 00:06:51,360 --> 00:06:53,280 That animation, that flash, 76 00:06:54,200 --> 00:06:58,760 it contained the code to change the password to admin. 77 00:06:59,080 --> 00:07:06,300 And then inside the page, there was another flash animation that did the cross-head request forgery, the farming. 78 00:07:07,060 --> 00:07:10,460 So we thought there was no other way to reset the password except for the real function, 79 00:07:10,700 --> 00:07:15,220 which consisted on using the web key, the default web key, in order to change the password. 80 00:07:15,360 --> 00:07:19,980 You can see from the images that they call it in one page, the system code. 81 00:07:20,060 --> 00:07:22,080 It's really little, but it says system code. 82 00:07:22,080 --> 00:07:25,880 And in another page, the exact same system code is the default web key. 83 00:07:26,060 --> 00:07:29,760 And I'm going to show you how to obtain the default web key very easy in a few. 84 00:07:30,020 --> 00:07:34,320 But this has been changed in modern versions of the firmware. 85 00:07:36,160 --> 00:07:38,220 And of course, it was used on the wild. 86 00:07:38,360 --> 00:07:40,140 The password reset with web key. 87 00:07:40,340 --> 00:07:43,480 This is a very complete tool for hacking to wire modems. 88 00:07:43,580 --> 00:07:47,160 I'm only showing the part where it resets the password by using the web key. 89 00:07:49,760 --> 00:07:52,000 And there's also denials of service. 90 00:07:53,400 --> 00:07:58,200 For example, the first one, this one is for like three years ago. 91 00:07:59,580 --> 00:08:02,280 It was published by a friend, and it reboots the complete device. 92 00:08:02,580 --> 00:08:08,540 And the second one, I found it like a few months ago, and it only resets the DSL connection. 93 00:08:12,860 --> 00:08:13,620 Let's try it. 94 00:08:15,920 --> 00:08:20,080 I'm going to tell you, this was published like three years ago in BugTrack. 95 00:08:20,080 --> 00:08:22,080 So everybody knows about this. 96 00:08:28,860 --> 00:08:29,760 I can't see. 97 00:08:59,360 --> 00:09:02,760 So you can see the modem has two steady green lights. 98 00:09:04,700 --> 00:09:09,760 And now, it turned into a blinking red light. 99 00:09:21,800 --> 00:09:24,700 You can see how easy it was to perform the denial of service. 100 00:09:24,980 --> 00:09:25,460 But guess what? 101 00:09:25,700 --> 00:09:28,100 There are also tools to perform this denial of service. 102 00:09:28,360 --> 00:09:28,680 Why? 103 00:09:28,780 --> 00:09:30,440 I don't know, because it's really easy. 104 00:09:30,620 --> 00:09:32,740 I guess these people just have a lot of free time or something. 105 00:09:34,240 --> 00:09:36,220 And of course, it still works. 106 00:09:36,860 --> 00:09:37,780 And there are many. 107 00:09:37,780 --> 00:09:42,780 I'm just showing you this so you know how widespread the knowledge of these vulnerabilities is. 108 00:09:44,460 --> 00:09:45,900 Oh yeah, cross-site scripting. 109 00:09:46,060 --> 00:09:47,760 There are many all over the place. 110 00:09:48,040 --> 00:09:49,640 I mean, I'm not even going to go into details. 111 00:09:49,840 --> 00:09:55,840 But the second place I checked was the device's name, and it has a persistent cross-site scripting. 112 00:09:55,980 --> 00:09:57,040 But who cares, right? 113 00:09:58,740 --> 00:10:00,280 Oh, this one is a good one. 114 00:10:00,400 --> 00:10:02,160 It's a configuration disclosure vulnerability. 115 00:10:02,420 --> 00:10:06,760 It was first published as being a magic URL. 116 00:10:07,780 --> 00:10:18,820 This magic URL contains the complete router configuration, including very important information in plain text, such as the DSL credentials, wireless, MAC, and other information. 117 00:10:19,480 --> 00:10:23,020 The guy that published this never gave away the complete URL. 118 00:10:23,280 --> 00:10:29,080 He always said that in order to obtain it, you had to sniff the communications when you installed the provider's software. 119 00:10:30,220 --> 00:10:31,260 Which is pretty good. 120 00:10:31,760 --> 00:10:34,620 Oh, remember that cross-site scripting nobody cared about? 121 00:10:34,620 --> 00:10:42,120 Well, you can use this cross-site scripting in order to remotely, of course, client-side, obtain the complete configuration of the modems. 122 00:10:44,420 --> 00:10:46,500 You can see here the code. 123 00:10:46,620 --> 00:10:52,260 First, I am trying to see where the web interface is by trying to load an image from the IP. 124 00:10:52,500 --> 00:10:57,040 And if that doesn't work, I try then loading the domain, the default domain name. 125 00:10:57,580 --> 00:11:03,960 Then I get the page, I cut it in little chunks, and I send it via a GET request, which is kind of loud. 126 00:11:04,620 --> 00:11:06,400 Noisy, but I don't care. It works. 127 00:11:07,200 --> 00:11:07,580 So... 128 00:11:10,360 --> 00:11:12,520 Oh, I'm going to show you a video about this also. 129 00:11:34,620 --> 00:11:36,180 So here we are at the web interface. 130 00:11:36,720 --> 00:11:40,340 We visit a page, and you can see it makes some connections to the modem. 131 00:11:41,940 --> 00:11:44,220 And for the demo, I made some alert box. 132 00:11:44,420 --> 00:11:52,160 So you can see how it pops your username and your password for the DSL connection in clear text. 133 00:11:52,420 --> 00:11:56,160 And then you can see the ESS ID and also the custom key. 134 00:11:56,260 --> 00:11:58,200 It doesn't matter if it's WPA or WEP. 135 00:11:58,740 --> 00:12:01,260 And also some information about the modem. 136 00:12:01,260 --> 00:12:06,420 Such as the MAC address, firmware version, etc. 137 00:12:06,780 --> 00:12:08,500 And other stuff as well. 138 00:12:08,920 --> 00:12:12,680 And of course, it locks it in the server. 139 00:12:14,220 --> 00:12:15,700 There it is. 140 00:12:25,440 --> 00:12:27,980 So these were all known vulnerabilities. 141 00:12:28,400 --> 00:12:29,620 Well, public vulnerabilities. 142 00:12:29,620 --> 00:12:33,700 The following one, this one, I found about three months ago. 143 00:12:33,980 --> 00:12:38,460 I tried contacting 2Wire three months ago, but I got no response. 144 00:12:38,560 --> 00:12:45,200 Well, I tried to get a private email in order to report this, but they wanted me to post it in their support page or something. 145 00:12:45,640 --> 00:12:55,400 So I just waited, and like three weeks ago, I told them again about this vulnerability, and I got no response. 146 00:12:55,720 --> 00:12:58,960 So a week ago, I sent them the complete advisory. 147 00:12:59,620 --> 00:13:04,800 I was uploading the videos and everything, and the only response I got was that the status of the ticket changed to escalated. 148 00:13:04,940 --> 00:13:05,660 But that's about it. 149 00:13:06,260 --> 00:13:07,500 I didn't get anything. 150 00:13:09,020 --> 00:13:14,000 So this works as the typical H04 page that I told you about. 151 00:13:14,060 --> 00:13:15,820 It changes the password even if the password is set. 152 00:13:28,620 --> 00:13:32,620 So here we are trying to get into the interface of the modem. 153 00:13:32,800 --> 00:13:36,760 When we try to get into the advanced interface, it asks for a password. 154 00:13:41,560 --> 00:13:43,440 So we try 2Wire as a password. 155 00:13:45,740 --> 00:13:47,480 No, the password is incorrect. 156 00:13:49,440 --> 00:13:51,080 So we go to our page. 157 00:13:53,960 --> 00:13:56,060 And also put 2Wire everywhere. 158 00:14:00,040 --> 00:14:01,280 And that's it. 159 00:14:13,260 --> 00:14:21,440 But of course, if you change somebody's password, well, next time somebody wants to configure the modem, 160 00:14:21,480 --> 00:14:25,460 they probably won't know about my CD35 page, and they won't be able to set a new password. 161 00:14:25,960 --> 00:14:34,000 So you might as well just delete the password by using a really long password with more than 512 characters. 162 00:14:34,000 --> 00:14:38,080 Next time the person tries to access the modem, 163 00:14:38,200 --> 00:14:42,760 they will be prompted by our friendly H04 page in order to set a new password. 164 00:14:43,000 --> 00:14:43,560 You made me shoot. 165 00:14:59,900 --> 00:15:02,780 It doesn't let me go into the management and diagnostic console. 166 00:15:04,600 --> 00:15:05,060 2Wire. 167 00:15:08,800 --> 00:15:10,100 Well, password is incorrect. 168 00:15:12,020 --> 00:15:13,840 So we try our long URL. 169 00:15:19,480 --> 00:15:20,340 Oh, here, wait. 170 00:15:21,340 --> 00:15:23,020 Yeah, I wanted to show you this. 171 00:15:23,160 --> 00:15:26,420 It says, if password protection is enabled, enter new password. 172 00:15:26,820 --> 00:15:27,960 It's kind of weird. 173 00:15:30,600 --> 00:15:33,400 So there we are trying to access it from another session. 174 00:15:33,620 --> 00:15:36,880 And there's our H04 page asking us to set a new password. 175 00:15:39,620 --> 00:15:40,420 And that's it.