1 00:00:13,600 --> 00:00:14,280 Hi, everyone. 2 00:00:14,460 --> 00:00:15,280 Oh, my God. 3 00:00:19,600 --> 00:00:19,960 Hi. 4 00:00:19,960 --> 00:00:20,620 Will that go over there? 5 00:00:20,680 --> 00:00:21,360 We'll give you 10 minutes. 6 00:00:21,520 --> 00:00:22,060 We have 10 minutes. 7 00:00:24,300 --> 00:00:24,660 Test. 8 00:00:26,240 --> 00:00:26,600 Okay. 9 00:00:26,700 --> 00:00:27,420 Hello, everyone. 10 00:00:27,420 --> 00:00:31,580 Welcome to the annual phenolate speech at DEF CON. 11 00:00:33,700 --> 00:00:38,660 We got plenty of material to cover, so I might actually step over some stuff pretty quick. 12 00:00:39,200 --> 00:00:44,260 And if you got questions, the idea is I will hang out on the first pool, and you're going 13 00:00:44,260 --> 00:00:46,240 to buy me beer, and I answer your questions. 14 00:00:48,660 --> 00:00:49,560 Okay, let's go. 15 00:00:49,680 --> 00:00:50,360 What we're going to do. 16 00:00:50,660 --> 00:00:56,460 First, if you catch Richard Thiem's talk, lots of people are concerned about what's 17 00:00:56,460 --> 00:00:56,820 the matrix? 18 00:00:56,820 --> 00:00:57,840 Are we in the matrix? 19 00:00:58,000 --> 00:00:58,760 How to hack the matrix? 20 00:00:59,020 --> 00:01:02,560 So we thought we're going to look at it and tell you how to hack the matrix. 21 00:01:05,740 --> 00:01:08,680 Then we have some GSM stuff, you know. 22 00:01:10,920 --> 00:01:16,720 After that short, fun excurs, we will actually cover GSM and GPRS basics. 23 00:01:17,780 --> 00:01:22,300 GSM is swapping over, finally, to the United States, so you finally got decent phones. 24 00:01:22,760 --> 00:01:26,800 And I thought it would be quite useful. 25 00:01:26,820 --> 00:01:30,060 To actually give you an introduction and how the backbones work. 26 00:01:30,240 --> 00:01:37,700 So we will also discuss two things about the mobile phone networks, attacking mobile phones 27 00:01:37,700 --> 00:01:39,420 and attacking mobile phone backbones. 28 00:01:39,860 --> 00:01:47,280 And of course, this being a phenolate speech, we have the usual Cisco Oday crap and shell 29 00:01:47,280 --> 00:01:48,460 codes and stuff. 30 00:01:49,780 --> 00:01:50,700 Hacking the matrix. 31 00:01:51,180 --> 00:01:55,320 There is a product from made by Interisys. 32 00:01:55,340 --> 00:01:56,460 They used to be Cabletron. 33 00:01:56,820 --> 00:01:57,720 It's called the Matrix. 34 00:01:58,320 --> 00:02:02,000 So just because they gave it the wrong name, I started looking at it. 35 00:02:03,840 --> 00:02:06,320 This is basically a switch router. 36 00:02:06,560 --> 00:02:11,200 So you have a switch and you basically can say this and that port is now going to be 37 00:02:11,200 --> 00:02:11,580 a router. 38 00:02:12,140 --> 00:02:15,880 And well, to sum it up, the vulnerabilities it got. 39 00:02:18,260 --> 00:02:23,100 If you do anything for management, you better have TCP IP working, right? 40 00:02:23,800 --> 00:02:25,920 So this being an embedded system. 41 00:02:25,920 --> 00:02:34,020 You do like 10 connections or you complete 10 TCP handshakes to any given service that 42 00:02:34,020 --> 00:02:34,900 you use for management. 43 00:02:35,140 --> 00:02:38,560 Let's say it's Telnet or SSH and that's about it. 44 00:02:38,640 --> 00:02:40,000 Nobody else is going to do that anymore. 45 00:02:42,280 --> 00:02:46,420 The same thing on the switch ports that are not assigned to a router. 46 00:02:47,480 --> 00:02:53,240 They used this very advanced technique for calculating initial sequence numbers for TCP. 47 00:02:53,540 --> 00:02:55,840 That's known as the 64K rule. 48 00:02:57,900 --> 00:03:02,480 So NMAP will actually tell you it's a piece of crap and it's easy to hijack. 49 00:03:02,820 --> 00:03:06,980 So well, when you unpack the box, it is a switch. 50 00:03:07,240 --> 00:03:10,460 So as soon as someone Telnets there, you can hijack the connection easily. 51 00:03:11,780 --> 00:03:14,860 And also of course it does OSPF. 52 00:03:16,020 --> 00:03:23,660 For those of you I talked to years ago, you know that OSPF is quite useful and you can 53 00:03:23,660 --> 00:03:24,720 do lots of things with it. 54 00:03:24,720 --> 00:03:31,600 The bad thing is vendors tend to read RFCs incompletely, so they actually read the part 55 00:03:31,600 --> 00:03:35,500 that told them how to build the packets for OSPF, but they didn't read the part that told 56 00:03:35,500 --> 00:03:40,540 them how to make OSPF work. So you just sit there and flood it with OSPF 57 00:03:40,540 --> 00:03:45,320 hello messages, which basically means here's a new router, here's the next new router, 58 00:03:45,400 --> 00:03:49,220 here's the next new router. And instead of validating that first and then 59 00:03:49,220 --> 00:03:54,520 tell everyone else, it will tell everyone else in the network right away, which translates 60 00:03:54,520 --> 00:04:00,260 to all you need is one of those boxes in your OSPF network and it will actually kill the 61 00:04:00,260 --> 00:04:06,920 whole network for you. And, well, to make a long story short, last 62 00:04:06,920 --> 00:04:11,880 year I said if you got an embedded system and it got port 80 TCP open, you can bet your 63 00:04:11,880 --> 00:04:16,580 assets vulnerable. So same holds true for the matrix, which answers 64 00:04:16,580 --> 00:04:19,200 the question how to hack the matrix, use ADCP. 65 00:04:21,080 --> 00:04:27,320 Okay, GSM basics. The global system for mobile communication, 66 00:04:28,840 --> 00:04:35,060 GSM, is actually used for quite a while and was standardized by the ETSI. 67 00:04:36,180 --> 00:04:43,280 In contrast to the mobile networks you got here, usually there is a very specific difference 68 00:04:43,280 --> 00:04:48,900 between what they call the terminal equipment and everyone else calls a phone, and the SIM 69 00:04:48,900 --> 00:04:49,200 card. And, you know, it's a very specific difference 70 00:04:49,220 --> 00:04:49,380 between what they call a phone and what they call a SIM card. 71 00:04:49,380 --> 00:04:53,460 That is actually a smart chip handling all your information. 72 00:04:54,540 --> 00:05:00,220 You use the SIM card to authenticate the key material on the SIM card to authenticate 73 00:05:00,220 --> 00:05:04,160 and you use your caller ID and other IDs to authenticate. 74 00:05:04,360 --> 00:05:10,700 The phone does not matter. The GSM core networks actually rely on this 75 00:05:10,700 --> 00:05:14,880 information to find out who you are and actually bill you for the service they provide. 76 00:05:15,920 --> 00:05:19,200 So lots of people have tried to do call-to-call. 77 00:05:19,200 --> 00:05:25,120 Caller ID spoofing and other stuff with GSM. Some succeeded in very limited environments. 78 00:05:25,560 --> 00:05:30,580 But, in general, it's all fine and all good. Which actually changes. 79 00:05:31,240 --> 00:05:36,040 It changes with what's known as GPRS, the General Packet Radio Service. 80 00:05:37,440 --> 00:05:42,280 Well, this service now is pretty much like the internet was compared to leased line services. 81 00:05:43,000 --> 00:05:48,620 So, you had, in the beginning of networking, you had leased line services and direct connections 82 00:05:48,620 --> 00:05:49,180 and then you had GPRS. And, you know, you had GPRS. And, you know, you had GPRS. And, you know, 83 00:05:49,200 --> 00:05:49,360 you had GPRS. And, you know, you had GPRS. And, you know, you had GPRS. And, you know, 84 00:05:49,360 --> 00:05:53,080 someone came up with the internet thingy and all the packet forwarding crap. 85 00:05:53,220 --> 00:05:56,420 And all hell broke loose. Same here. 86 00:05:57,340 --> 00:06:00,600 So, this is actually packet services for mobile phones. 87 00:06:00,760 --> 00:06:05,080 So, you can surf web faster and do all kinds of stuff with it. 88 00:06:05,200 --> 00:06:09,400 And, consequently, the whole backbone infrastructure is running on IPv4. 89 00:06:10,820 --> 00:06:16,800 Now, authentication is a bit different here. If you want to find out which network you're 90 00:06:16,800 --> 00:06:19,120 talking to, you use the APN. 91 00:06:19,200 --> 00:06:23,940 And the access point name. This is something you transmit to the GSM network and it will 92 00:06:23,940 --> 00:06:29,640 figure out on which site you will pop up. So, that does not have to be the internet 93 00:06:29,640 --> 00:06:35,400 or a web gateway. And then, optionally, you got PPP running 94 00:06:35,400 --> 00:06:40,340 over that, giving you IP addresses and, of course, doing this chat path thingy, find 95 00:06:40,340 --> 00:06:42,560 out who you are if you got the right username and password. 96 00:06:44,340 --> 00:06:48,900 APNs. You should actually think of an APN as a URL. 97 00:06:49,700 --> 00:06:57,740 It is quite similar, actually, because you give it a name and it will tell you which 98 00:06:57,740 --> 00:07:02,760 network you're talking to, in contrast to a real URL telling you which server you're 99 00:07:02,760 --> 00:07:03,240 talking to. 100 00:07:05,880 --> 00:07:13,640 So, the same thing in full color. What you got here is actually a very basic 101 00:07:13,640 --> 00:07:17,460 picture of a GSM network. 102 00:07:18,900 --> 00:07:23,160 You got the guy here being the mobile phone, talking to the PLMN, which is the public land 103 00:07:23,160 --> 00:07:25,640 mobile network. Everyone else just says the mobile network. 104 00:07:26,780 --> 00:07:31,540 You got the HLR, which is the home location register, and you can actually think of it 105 00:07:31,540 --> 00:07:35,580 as a huge fucking database. Often it runs Oracle. 106 00:07:36,300 --> 00:07:40,100 If you're Rome, there's another thing that's called the visitor location register. 107 00:07:41,600 --> 00:07:47,300 And the HLR actually holds all the information about you and your credentials and what you're 108 00:07:47,300 --> 00:07:48,880 supposed to do. And what you're supposed to do. 109 00:07:48,900 --> 00:07:52,840 What you're not supposed to do. Then you got the SGSNs and the GGSNs. 110 00:07:52,840 --> 00:07:59,100 The SGSNs are the serving GPRS support node. And GGSN gateway GPRS support node. 111 00:07:59,560 --> 00:08:07,880 Think of the GGSN as a backbone router and the SGSN as the one actually talking to the 112 00:08:07,880 --> 00:08:11,760 HLR and forwarding this stuff. So, it's pretty much like a framework network. 113 00:08:12,800 --> 00:08:16,920 And of course, you got more than one GGSN. So, you got one facing the internet. 114 00:08:17,260 --> 00:08:18,620 You got others facing... 115 00:08:18,900 --> 00:08:20,680 You got them in the same company dedicated networks. 116 00:08:21,100 --> 00:08:24,120 So, big companies go there and say, OK, you're doing GPRS. 117 00:08:25,200 --> 00:08:28,940 That is quite useful. So, you got, let's say you got any kind 118 00:08:28,940 --> 00:08:34,620 of logistics company like UPS or FedEx and they got what I call the oversized Game Boys 119 00:08:34,620 --> 00:08:39,640 and where you're supposed to sign on. These devices have to talk back and actually 120 00:08:39,640 --> 00:08:42,800 make sure that, well, you signed and the package was delivered. 121 00:08:43,180 --> 00:08:47,980 And well, it's quite easy for them to actually order GPRS services. 122 00:08:48,900 --> 00:08:54,360 an APN and every time those devices have to talk to the network, they open the APN, say, 123 00:08:54,500 --> 00:09:01,740 this is where I want to talk to, and now they end up being in the UPS internal network instead 124 00:09:01,740 --> 00:09:05,720 of the internet. Of course, nobody prevents you from doing the same. 125 00:09:08,060 --> 00:09:15,580 So GPRS attack points. First, the GGSN, as I said, is just another IPv4 device. At stake, 126 00:09:15,580 --> 00:09:22,800 I actually figured that out. They had a Nokia GPRS box hanging off the internet and they 127 00:09:22,800 --> 00:09:27,880 actually found a vulnerability there, something totally simple like a special TCP option. 128 00:09:28,960 --> 00:09:35,540 You can actually expect a lot of stuff going on with those, especially on the networks 129 00:09:35,960 --> 00:09:38,560 that face not the internet, but some company networks. 130 00:09:39,580 --> 00:09:43,780 The scary thing here is Cisco also does GGSNs. 131 00:09:45,140 --> 00:09:45,560 Now, as I said, GPRS is an IPv4 device, so it's not necessarily a GPRS device, but it's a GPRS device. 132 00:09:45,560 --> 00:09:51,200 APNs can actually be gassed. They're not considered a secret. It's like the URL. 133 00:09:51,520 --> 00:09:57,760 Most of the APNs are actually either the URL of the company's homepage or the company name, 134 00:09:57,880 --> 00:10:03,400 so you can just go ahead and try it. I did that in Germany and it turned out that 135 00:10:03,400 --> 00:10:08,520 lots of major companies actually have their company name as APN and you get asked for 136 00:10:08,520 --> 00:10:15,420 a username and password via PPP. Of course, this being a large user base, you often find usernames and passwords 137 00:10:15,420 --> 00:10:18,560 where it's called test and test and yeah, you know how that works. 138 00:10:20,560 --> 00:10:27,180 The thing here is you can actually do APN filtering in an HLR, but no provider does it for a simple 139 00:10:27,180 --> 00:10:33,600 design failure reason. You can only say that a user account is allowed 140 00:10:33,600 --> 00:10:39,020 to do all APNs you want or a limited list. Now, that would be pretty bad for the database 141 00:10:39,020 --> 00:10:45,300 if they had to write that down into the database for 22 million customers, so they don't, say, 142 00:10:45,300 --> 00:10:52,540 that. They just say, oh, one can go to whatever APN he wants and yeah, the GGSN were the 143 00:10:53,580 --> 00:10:56,840 authentication servers or radio servers that are hanging off there doing the authentication 144 00:10:57,520 --> 00:11:04,840 and with a large username and actually user account database, you sure as hell find weak 145 00:11:04,840 --> 00:11:11,760 passwords. So but there is actually more to it. 146 00:11:12,240 --> 00:11:15,260 So if you happen to have for what ever... 147 00:11:15,260 --> 00:11:21,580 Another reason, maybe for staying at DEF CON or talking to some guys, you happen to have 148 00:11:22,000 --> 00:11:26,380 one single computer in a mobile phone provider's network. 149 00:11:26,660 --> 00:11:29,100 It can be the secretary's Windows PC or whatever. 150 00:11:29,480 --> 00:11:32,740 You can actually do quite some interesting stuff. 151 00:11:33,260 --> 00:11:36,180 There is the GPRS tunneling protocol, GTP. 152 00:11:36,960 --> 00:11:40,400 It's standardized here for everyone who loves to read boring documents. 153 00:11:40,400 --> 00:11:43,840 You can actually get that off the ETSI web page. 154 00:11:45,840 --> 00:11:53,300 The protocol is actually designed to transport user data and control data via IPv4 in the 155 00:11:53,300 --> 00:11:59,720 GPRS backbones and is also used in UMTS backbones, so the third generation that you didn't even 156 00:11:59,720 --> 00:12:00,120 hear of. 157 00:12:01,360 --> 00:12:05,940 The protocol can control pretty much everything in the network. 158 00:12:06,400 --> 00:12:09,120 This includes setting up modifying tunnels. 159 00:12:09,120 --> 00:12:11,160 Connections, data transfer path. 160 00:12:11,540 --> 00:12:15,260 You can modify the VPN access for an active subscriber. 161 00:12:16,320 --> 00:12:18,540 You control how they roam. 162 00:12:18,880 --> 00:12:21,480 Of course, you control how the accounting works. 163 00:12:22,960 --> 00:12:28,780 Both the control connections and the user data are ran over the same protocol, so we 164 00:12:28,780 --> 00:12:30,080 are talking about all the same thing. 165 00:12:31,140 --> 00:12:36,760 The most funny thing is actually already on the fifth page of the standard because it 166 00:12:36,760 --> 00:12:38,220 says that every device... 167 00:12:38,220 --> 00:12:39,100 SGSN and GDN. 168 00:12:39,100 --> 00:12:43,840 SGSN is supposed to support this protocol, including version zero. 169 00:12:44,280 --> 00:12:48,620 What they did was actually they standardized their inability to fix the protocol. 170 00:12:51,360 --> 00:12:56,940 Even if they come up with a new version that isn't so screwed as the one we're now talking 171 00:12:56,940 --> 00:13:00,620 about, the devices are supposed to support the screwed version. 172 00:13:01,220 --> 00:13:02,620 This is in the standard. 173 00:13:02,920 --> 00:13:04,920 I would say that was not a good move. 174 00:13:09,000 --> 00:13:10,020 What's it all about? 175 00:13:10,160 --> 00:13:10,980 What's the cool about it? 176 00:13:12,180 --> 00:13:16,460 This is in protocol running over IP, so we're quite familiar with it. 177 00:13:16,920 --> 00:13:21,220 It runs on UDP, which enables us to spoof. 178 00:13:21,860 --> 00:13:23,320 It has no authentication. 179 00:13:24,540 --> 00:13:30,660 You can create, update, or delete user contexts to your Lightning with one UDP packet. 180 00:13:31,680 --> 00:13:35,280 You can modify or remove billing information with one UDP packet. 181 00:13:35,300 --> 00:13:41,960 You can actually reroute traffic and redirect traffic over the backbone, guess what? 182 00:13:42,240 --> 00:13:43,280 One UDP packet. 183 00:13:44,780 --> 00:13:48,260 You can actually invite people into VPNs. 184 00:13:48,840 --> 00:13:52,780 You've got one of those boxes, and you've got a friend who got a GPRS phone. 185 00:13:53,060 --> 00:13:58,760 You can actually invite him actively to one of the company VPNs, one UDP packet. 186 00:14:00,080 --> 00:14:03,100 Of course, you can force people to roam. 187 00:14:03,460 --> 00:14:05,280 Roaming is handled by GDPR. 188 00:14:05,300 --> 00:14:07,260 It's the same thing as the UDP between the SGSNs. 189 00:14:07,760 --> 00:14:16,700 I was actually wondering why there isn't someone, maybe I did, starting a company as a mobile 190 00:14:16,700 --> 00:14:21,840 phone provider and just having one SGSN and constantly sending out UDP packets and make 191 00:14:21,840 --> 00:14:27,020 all the users roam over you, which I think is a good business concept, but it wasn't 192 00:14:27,020 --> 00:14:28,500 declared as such in the standard. 193 00:14:29,320 --> 00:14:29,880 . 194 00:14:33,520 --> 00:14:34,880 The fun thing is. 195 00:14:34,880 --> 00:14:37,320 How they dealt with security is this. 196 00:14:37,560 --> 00:14:42,480 They say, we're ETSI, we're doing GSM, so we don't care about IP. 197 00:14:42,800 --> 00:14:46,300 Someone else is going to make IP secure, period, end of statement. 198 00:14:50,000 --> 00:14:52,960 Assume you do not have a computer in a mobile phone network. 199 00:14:54,080 --> 00:14:56,500 Of course, most of you are not supposed to have one. 200 00:14:57,400 --> 00:15:00,540 There is other stuff you can actually do with GPRS and Bob. 201 00:15:01,600 --> 00:15:03,520 This is anonymous HTTP. 202 00:15:03,520 --> 00:15:10,300 The good thing here is a lot of people, especially at this conference, have a certain interest 203 00:15:10,300 --> 00:15:15,440 in doing HTTP without revealing their real IP address to the server they're talking to. 204 00:15:15,860 --> 00:15:23,420 Those reasons might include something like Unicode or web applications or other overflows 205 00:15:23,420 --> 00:15:25,320 that you might find in port 80 applications. 206 00:15:27,120 --> 00:15:28,860 How do you do that? 207 00:15:29,420 --> 00:15:32,400 The web protocol is actually the vehicle to go for. 208 00:15:32,400 --> 00:15:37,200 You have the wireless transport protocol and the wireless session protocol. 209 00:15:37,440 --> 00:15:41,900 The wireless transport protocol is used to do basic transport stuff. 210 00:15:42,180 --> 00:15:50,420 The wireless session protocol is actually the one doing a session over the UDP stuff you talk on the air interface to your mobile network. 211 00:15:51,840 --> 00:15:56,400 Now, this is used to actually talk to something that's called a WAP gateway. 212 00:15:56,400 --> 00:16:04,140 The WAP gateway is supposed to work as a proxy, both in protocol terms and in HTTP terms. 213 00:16:04,780 --> 00:16:10,600 It will accept UDP on one side, which is your phone, and it will talk TCP to the other, 214 00:16:10,780 --> 00:16:18,200 and it will grab down the webpages you asked for, do something that they call compiling, 215 00:16:18,260 --> 00:16:25,520 which basically means take an HTTP or, in this case, WML tags, make them non-tags, 216 00:16:25,620 --> 00:16:26,320 so compile them. 217 00:16:26,400 --> 00:16:30,300 And one binary format, so it's smaller, and send it to your phone. 218 00:16:32,600 --> 00:16:37,720 So, WSP in the default setting that your phones use is a connection over UDP, 219 00:16:37,880 --> 00:16:42,000 so it got actually numbers to track the connection and the session, 220 00:16:42,560 --> 00:16:48,000 which you compare for those of you who know DNS and the DNS IDs for packets, for requests. 221 00:16:48,840 --> 00:16:50,760 This is pretty much the same idea here. 222 00:16:51,260 --> 00:16:56,380 Now, an often overlooked fact is that actually the standard says there is a way, 223 00:16:56,400 --> 00:16:59,140 um, to do connectionless WSP. 224 00:17:00,200 --> 00:17:05,080 Connectionless WSP means, um, you're not setting up a connection. 225 00:17:05,240 --> 00:17:08,660 You just send the HTTP request to the WAP gateway. 226 00:17:09,860 --> 00:17:11,400 This has several advantages. 227 00:17:11,860 --> 00:17:15,960 First of all, you can tell the WAP gateway you're not really interested in the answer, 228 00:17:16,940 --> 00:17:19,140 which means it's not gonna send one. 229 00:17:19,680 --> 00:17:24,640 Um, the second thing is, this being UDP, of course, we can easily spoof again. 230 00:17:24,640 --> 00:17:32,280 Um, which now means we're actually, um, giving the company, the mobile phone company, money 231 00:17:32,280 --> 00:17:39,220 by, um, using GPRS, and, but we're actually not using our own source IP address, 232 00:17:39,400 --> 00:17:40,960 but someone else's. 233 00:17:41,100 --> 00:17:42,420 And this is quite okay. 234 00:17:42,640 --> 00:17:44,740 Um, the WAP gateway does not filter that. 235 00:17:44,840 --> 00:17:51,320 Usually, I have not seen a WAP gateway or any other device in a mobile network that will actually detect spoofing. 236 00:17:51,920 --> 00:17:54,120 But they might exist. Correct me if I'm wrong. 237 00:17:54,920 --> 00:18:04,560 So, you actually got anonymous HTTP request capabilities, and to make it nice and have a little drop of sugar on top of it, 238 00:18:04,640 --> 00:18:05,960 it's billed to someone else. 239 00:18:06,660 --> 00:18:13,820 You just find out which IP addresses are used, which, of course, you do with this ICMP-sending utility called ping. 240 00:18:14,380 --> 00:18:16,880 And then, you use their IP addresses. 241 00:18:17,100 --> 00:18:22,760 So, um, not only is your HTTP-based attack anonymous, but someone else is gonna pay for it. 242 00:18:25,480 --> 00:18:29,540 So, um, this is the summary of how to do that, in case you wanna try that at home. 243 00:18:30,060 --> 00:18:35,560 Um, the good thing is, um, you don't actually need to have a phone. 244 00:18:35,800 --> 00:18:38,040 There are open WAP gateways in the internet. 245 00:18:38,900 --> 00:18:51,620 So, you can actually look for, um, UDP port 9200, and, well, then apply your responsible, um, procedure in dealing with new ways of exploiting things. 246 00:18:54,140 --> 00:18:54,620 Subtitles by the Amara.org community 247 00:18:55,700 --> 00:18:56,220 Yeah. 248 00:18:56,400 --> 00:18:59,440 Um, I had a certain problem with an NDA here. 249 00:18:59,760 --> 00:19:04,140 So, I just wanted to make sure that this is covered in the slides. 250 00:19:05,200 --> 00:19:06,320 Go make me drunk. 251 00:19:07,400 --> 00:19:08,440 Um, okay. 252 00:19:08,700 --> 00:19:14,220 From the backbone to the, um, actual devices, this is the thing we're talking about. 253 00:19:14,360 --> 00:19:15,400 The Siemens S55. 254 00:19:15,960 --> 00:19:23,320 Now, there are lots of smart people actually dealing with PDA-sized phones and, um, other, yeah, 255 00:19:23,380 --> 00:19:24,260 the new generation. 256 00:19:24,640 --> 00:19:26,180 The new generation stuff that runs SymbianOS. 257 00:19:26,420 --> 00:19:29,640 And I'm not really smart enough to compete with them. 258 00:19:30,320 --> 00:19:34,040 Um, so, we had a different reason looking at that one. 259 00:19:34,140 --> 00:19:36,600 Simple for the reason was, um, we had it. 260 00:19:37,020 --> 00:19:42,080 And those Simi smartphones, as I call them, are very widespread use. 261 00:19:42,300 --> 00:19:46,200 It's like the camera phones and MMS crap and Java applications. 262 00:19:46,420 --> 00:19:49,780 And so, we picked actually one, um, to play with it. 263 00:19:50,780 --> 00:19:51,960 It got Bluetooth. 264 00:19:51,960 --> 00:19:57,680 So, what's bad about the Bluetooth implementation here is every time you start a connection, 265 00:19:57,920 --> 00:20:01,180 it will, of course, ask you if you want to pair with this device. 266 00:20:01,700 --> 00:20:02,580 This is fine. 267 00:20:02,920 --> 00:20:06,500 Well, if you start the next connection, it will ask you again. 268 00:20:06,960 --> 00:20:11,760 So, you open about a hundred connections and it will have a hundred message boxes on the screen. 269 00:20:12,100 --> 00:20:14,520 Bad thing is, there's not being windows. 270 00:20:14,800 --> 00:20:19,380 You don't see that those are multiple message boxes lying on top of each other. 271 00:20:19,680 --> 00:20:21,940 So, you acknowledge one or disagree. 272 00:20:21,940 --> 00:20:23,720 You dismiss one and it still looks the same. 273 00:20:24,380 --> 00:20:26,240 You have no idea what's going on. 274 00:20:26,860 --> 00:20:32,180 Um, and, well, the same problem actually holds true for the connection, um, 275 00:20:33,040 --> 00:20:36,140 what is that, the connection resources in the phone. 276 00:20:36,400 --> 00:20:39,100 So, you do more connects to it. 277 00:20:39,240 --> 00:20:45,180 At some point in time, um, it's so busy waiting for the user to acknowledge or dismiss this pairing, 278 00:20:45,460 --> 00:20:47,940 um, that it doesn't have any connections left. 279 00:20:48,180 --> 00:20:51,040 So, if this guy had a headset or anything else, 280 00:20:51,040 --> 00:20:52,940 actually working with the phone, this changed. 281 00:20:53,360 --> 00:20:54,520 It's no longer working. 282 00:20:54,980 --> 00:20:57,460 And all you need is something that's called an L2 ping. 283 00:20:57,640 --> 00:21:00,320 It's just a layer two, um, kind of ping. 284 00:21:00,540 --> 00:21:02,240 So, that's quite easy. 285 00:21:03,140 --> 00:21:07,720 The big inbox is something I really like to do in airport lounges. 286 00:21:08,100 --> 00:21:11,720 You got all the executives with their, um, little nice phones. 287 00:21:11,840 --> 00:21:14,520 And, well, everything they do is, like, they get the phone, 288 00:21:14,580 --> 00:21:17,480 they set a new background picture and turn on every possible feature. 289 00:21:18,540 --> 00:21:20,460 So, um, the thing is, 290 00:21:20,460 --> 00:21:23,340 the S55 accepts whatever files you send it 291 00:21:23,340 --> 00:21:27,180 and puts it in a directory saying incoming data. 292 00:21:28,080 --> 00:21:33,760 Now, it is quite easy and not really time consuming to send 2,100 files. 293 00:21:34,920 --> 00:21:39,860 Unfortunately, it is quite time consuming to delete 2,100 files on your phone. 294 00:21:40,700 --> 00:21:44,840 Because they actually got a function that's called delete all. 295 00:21:45,020 --> 00:21:49,660 But this function seems to use a counter for what all actually means. 296 00:21:49,660 --> 00:21:50,940 That is byte sized. 297 00:21:51,440 --> 00:21:55,860 So, you can actually delete 255 files at the same time. 298 00:21:56,160 --> 00:22:01,120 Um, but this is not gonna win the race against the one sending the files. 299 00:22:04,460 --> 00:22:07,680 And it is, by the way, quite annoying when they're on the phone 300 00:22:07,680 --> 00:22:08,820 because it keeps peeping. 301 00:22:12,040 --> 00:22:16,620 Okay, so the next big thing that, um, the vendors of the phones actually advertise 302 00:22:16,620 --> 00:22:17,940 is the whole Java stuff. 303 00:22:17,940 --> 00:22:21,880 Well, if you remember last year, I hate Java. 304 00:22:22,360 --> 00:22:27,040 Um, but Java is actually supposed to be a secure programming language. 305 00:22:27,240 --> 00:22:32,760 And this is done by having exceptional circumstances in your program code, 306 00:22:32,880 --> 00:22:35,880 um, manifest themselves as exceptions. 307 00:22:36,240 --> 00:22:38,200 One of those exceptions is a null pointer. 308 00:22:38,660 --> 00:22:41,920 Well, a null pointer exception shouldn't kill a Java virtual machine. 309 00:22:42,360 --> 00:22:43,740 Actually, here it does. 310 00:22:44,620 --> 00:22:47,920 So, everything that could possibly trigger a null pointer exception, 311 00:22:47,940 --> 00:22:50,740 which often is just leaving out data, 312 00:22:50,940 --> 00:22:54,520 um, will result in what we call the widescreen of death. 313 00:22:54,860 --> 00:22:58,620 Because, as you see on the picture, this is how it looks like. 314 00:22:58,960 --> 00:23:02,460 All you have to do is trigger a null pointer exception, and we're gonna show you how. 315 00:23:03,820 --> 00:23:06,160 Um, there is a thing called the jot files. 316 00:23:06,680 --> 00:23:08,340 Jot files are actually text files. 317 00:23:08,460 --> 00:23:11,000 They're comparable to, like, INI files on Windows. 318 00:23:12,440 --> 00:23:14,440 Um, they're lying around on WAP servers. 319 00:23:14,780 --> 00:23:17,160 So, you serve WAP, and it says, 320 00:23:17,160 --> 00:23:18,220 download Java application. 321 00:23:18,640 --> 00:23:20,060 Or, it says, click here. 322 00:23:20,860 --> 00:23:22,880 Um, and you actually pull down a jot file, 323 00:23:23,040 --> 00:23:25,920 and it figures out what the name of the Java application is, 324 00:23:26,060 --> 00:23:27,600 what size, where it comes from, 325 00:23:27,860 --> 00:23:29,840 uh, what classes it needs, and stuff. 326 00:23:30,340 --> 00:23:33,860 And, of course, the name of the Java application is quite interesting, 327 00:23:33,960 --> 00:23:36,460 because it wants to ask you if you want to install it or not. 328 00:23:36,780 --> 00:23:39,520 Um, and that's stored in the midlet name. 329 00:23:39,880 --> 00:23:42,320 Well, if the midlet name is missing, 330 00:23:42,580 --> 00:23:45,160 you get what you see here, the widescreen of death. 331 00:23:45,940 --> 00:23:50,220 So, you can actually build, uh, WAP pages with evil Siemens links, 332 00:23:50,900 --> 00:23:51,940 which is quite funny. 333 00:23:52,920 --> 00:23:56,440 But, the other thing is even more funny. 334 00:23:56,580 --> 00:23:58,320 I didn't find a way to exploit it. 335 00:23:58,480 --> 00:24:00,940 Um, but that might be just a stupid me. 336 00:24:01,200 --> 00:24:03,640 Um, you have an overlong midlet name. 337 00:24:03,920 --> 00:24:06,740 So, in case the user actually is stupid enough 338 00:24:06,740 --> 00:24:11,920 to acknowledge the installation of the Java application A-A-A-A-A-A, 339 00:24:13,020 --> 00:24:14,580 um, what happens is, 340 00:24:14,580 --> 00:24:17,740 it will create a directory to put the Java application in. 341 00:24:18,480 --> 00:24:23,360 So, it passes, um, the Java application name 342 00:24:23,360 --> 00:24:26,280 as a directory name to the core operating system. 343 00:24:26,640 --> 00:24:28,680 Now, there seems to be a limit, 344 00:24:28,860 --> 00:24:32,080 which means that if you have a normal name, that works well. 345 00:24:32,180 --> 00:24:33,300 If you have an overlong name, 346 00:24:33,460 --> 00:24:37,300 it will actually overwrite the name of the file 347 00:24:37,300 --> 00:24:40,520 and some structures that are supposed to, um, 348 00:24:40,660 --> 00:24:42,160 yeah, run the file system. 349 00:24:42,160 --> 00:24:44,920 So, you cannot delete this. 350 00:24:45,360 --> 00:24:47,400 You actually have to flash the phone 351 00:24:47,400 --> 00:24:51,620 and remove all the data by, like, reformatting the whole phone, 352 00:24:51,780 --> 00:24:53,700 which is the reason this little fucker here 353 00:24:53,700 --> 00:24:56,440 doesn't know any other ringtones than the default one anymore. 354 00:25:02,340 --> 00:25:05,820 So, but even with the Java stuff, 355 00:25:06,040 --> 00:25:08,220 well, you can crash it, but you can actually do more. 356 00:25:08,640 --> 00:25:10,540 Spy.jar, um, 357 00:25:10,540 --> 00:25:13,520 the idea actually is here, 358 00:25:13,620 --> 00:25:16,740 um, that you can have some limited information 359 00:25:16,740 --> 00:25:18,860 pulled off the phone by Java applications. 360 00:25:20,800 --> 00:25:23,360 Most phones will actually complain 361 00:25:23,360 --> 00:25:25,740 if a Java application tries to, um, 362 00:25:25,820 --> 00:25:28,740 make a connection outgoing and, like, send data. 363 00:25:29,260 --> 00:25:30,880 Well, the Siemens doesn't. 364 00:25:30,920 --> 00:25:32,420 The Siemens just says, um, 365 00:25:32,620 --> 00:25:35,940 well, it does a tiny little beep, nobody really hears, 366 00:25:36,140 --> 00:25:38,020 and then, um, lets you through. 367 00:25:38,620 --> 00:25:39,720 The question is, 368 00:25:39,720 --> 00:25:41,180 which information can you get? 369 00:25:41,320 --> 00:25:42,520 In the standard Java classes, 370 00:25:42,600 --> 00:25:44,580 Java X and all the mid-led stuff, 371 00:25:44,780 --> 00:25:46,340 there isn't any interesting, 372 00:25:46,580 --> 00:25:49,940 but we got the company class trees, 373 00:25:50,200 --> 00:25:52,220 and, of course, Siemens got one, 374 00:25:52,320 --> 00:25:53,820 and they're growing every time. 375 00:25:53,960 --> 00:25:56,820 This is the, um, information from, like, today. 376 00:25:57,040 --> 00:25:59,060 Um, it might change with the next firmware, 377 00:25:59,120 --> 00:26:00,080 and they got new classes. 378 00:26:00,380 --> 00:26:02,200 But today, you also can, uh, 379 00:26:02,240 --> 00:26:04,100 you already can get, um, 380 00:26:04,300 --> 00:26:05,700 the list of missed calls. 381 00:26:06,240 --> 00:26:08,600 Now, the information what calls you missed 382 00:26:08,600 --> 00:26:10,240 and from which number they came 383 00:26:10,240 --> 00:26:12,740 can be quite interesting if it's, um, 384 00:26:12,900 --> 00:26:14,720 sent to some external server. 385 00:26:15,380 --> 00:26:17,580 And, of course, you can also, um, 386 00:26:17,700 --> 00:26:22,240 get the, um, IMEI of the phone, 387 00:26:22,360 --> 00:26:24,860 so you can actually identify the phone correctly. 388 00:26:25,980 --> 00:26:27,520 Um, so we tried that, 389 00:26:27,540 --> 00:26:29,220 and you can have a Java application. 390 00:26:29,340 --> 00:26:31,660 It could be a little game or whatever, um, 391 00:26:31,820 --> 00:26:33,560 whatever it is posing as, 392 00:26:33,660 --> 00:26:34,920 and every time you play the game, 393 00:26:35,000 --> 00:26:37,100 it's actually telling some web server 394 00:26:37,100 --> 00:26:38,800 in south of Russia, um, 395 00:26:39,000 --> 00:26:40,080 which calls you missed. 396 00:26:40,460 --> 00:26:41,940 I don't think that's a good idea. 397 00:26:44,060 --> 00:26:47,020 Time.jar is very, very funny 398 00:26:47,020 --> 00:26:49,020 because it shows that Java 399 00:26:49,020 --> 00:26:51,300 does not necessarily prevent you 400 00:26:51,300 --> 00:26:52,280 from doing stupid things. 401 00:26:53,460 --> 00:26:56,380 Um, sending an SMS or placing a call 402 00:26:56,380 --> 00:26:57,640 can be a costly thing, 403 00:26:57,780 --> 00:26:59,100 depending on where you call 404 00:26:59,100 --> 00:27:00,600 or where you send the SMS to. 405 00:27:00,760 --> 00:27:03,020 I don't actually know if you got, um, 406 00:27:03,200 --> 00:27:04,780 so-called value-added services, 407 00:27:04,940 --> 00:27:06,580 um, uh, SMS and MMS 408 00:27:06,580 --> 00:27:07,340 in the States already, 409 00:27:07,560 --> 00:27:10,480 so where an SMS costs you about three bucks. 410 00:27:10,800 --> 00:27:13,700 Um, but we got quite a lot of them in Europe, 411 00:27:13,740 --> 00:27:14,880 and guess what they're offering. 412 00:27:16,240 --> 00:27:17,760 Um, so normally, 413 00:27:17,820 --> 00:27:20,220 it is supposed to actually ask you, 414 00:27:20,280 --> 00:27:22,180 um, when a Java application 415 00:27:22,180 --> 00:27:24,460 will trigger the phone to call someone 416 00:27:24,460 --> 00:27:25,480 or send an SMS. 417 00:27:25,840 --> 00:27:28,940 Um, it is supposed to ask you and say, 418 00:27:29,020 --> 00:27:30,420 hey, look, um, do you want to do that? 419 00:27:31,160 --> 00:27:33,080 But we got a little problem here. 420 00:27:33,160 --> 00:27:36,440 This confirmation is done by a dialog. 421 00:27:36,580 --> 00:27:39,660 Now, Java, not being the fastest programming language 422 00:27:39,660 --> 00:27:42,420 in the world, um, has a timing issue here. 423 00:27:42,540 --> 00:27:45,020 If you, before you try to send the SMS, 424 00:27:45,620 --> 00:27:47,780 actually, um, fill the screen 425 00:27:48,440 --> 00:27:50,860 and do something else on it. 426 00:27:51,020 --> 00:27:52,900 So, to make that visual, 427 00:27:53,460 --> 00:27:55,180 this is what it is supposed to do. 428 00:27:55,300 --> 00:27:56,480 For those who cannot read it, 429 00:27:56,560 --> 00:27:58,900 it says allow sending SMS to whatever number, 430 00:27:59,480 --> 00:28:01,740 and, well, you're supposed to press yes or no. 431 00:28:02,780 --> 00:28:04,260 Due to the timing problem, 432 00:28:04,500 --> 00:28:06,060 you can ask different questions like, 433 00:28:06,060 --> 00:28:07,440 would you like to play a game? 434 00:28:07,920 --> 00:28:11,160 I had the idea, um, of actually using the two buttons 435 00:28:11,160 --> 00:28:13,140 that are supposed to say yes or no, 436 00:28:13,320 --> 00:28:16,700 um, as a control in some, uh, jump and run game. 437 00:28:16,940 --> 00:28:19,160 So, you would actually press yes, 438 00:28:19,180 --> 00:28:21,300 um, approximately 50 times, 439 00:28:21,440 --> 00:28:22,960 uh, 50% of the time, 440 00:28:23,020 --> 00:28:25,320 and send about 1,000 SMS, 441 00:28:25,460 --> 00:28:26,820 each three bucks. 442 00:28:32,560 --> 00:28:34,240 The next thing we got here 443 00:28:34,240 --> 00:28:38,520 is something that is actually, uh, related 444 00:28:38,520 --> 00:28:40,760 to the whole MMS picture phone thingy. 445 00:28:41,040 --> 00:28:43,700 Well, of course, to send pictures and do MMSs, 446 00:28:43,740 --> 00:28:45,800 you need to have, um, image formats. 447 00:28:46,160 --> 00:28:48,740 So, the image format of choice here 448 00:28:48,740 --> 00:28:50,960 is GIF and, um, JPEG. 449 00:28:51,860 --> 00:28:53,900 Now, the GIF file format, um, 450 00:28:54,440 --> 00:28:55,560 as you all know, 451 00:28:56,060 --> 00:28:58,940 supports multiple frames for animated GIFs. 452 00:28:59,080 --> 00:29:00,820 For that to be flexible, 453 00:29:01,120 --> 00:29:02,980 you got something in the file format 454 00:29:02,980 --> 00:29:04,540 that is called the virtual screen, 455 00:29:04,760 --> 00:29:06,300 which describes, um, 456 00:29:06,560 --> 00:29:09,340 which area on the screen is actually covered 457 00:29:09,340 --> 00:29:11,940 by the sum of all, um, frames in the GIF file. 458 00:29:12,860 --> 00:29:15,500 Now, what you can do here is send a GIF file 459 00:29:15,500 --> 00:29:17,620 that actually, um, has, 460 00:29:18,580 --> 00:29:20,300 in one of the frames, 461 00:29:21,060 --> 00:29:22,640 offsetting in this virtual screen. 462 00:29:22,840 --> 00:29:24,680 This is supported by the standard. 463 00:29:25,680 --> 00:29:27,680 The good thing about that is, um, 464 00:29:28,240 --> 00:29:29,880 well, the virtual screen itself 465 00:29:29,880 --> 00:29:31,580 is not really supported by Siemens. 466 00:29:31,580 --> 00:29:34,260 So, um, you're actually writing the GIF data 467 00:29:34,260 --> 00:29:36,600 into some memory that is not displayed, 468 00:29:36,900 --> 00:29:38,880 um, but holds something different. 469 00:29:39,080 --> 00:29:42,040 So, if you actually open such a GIF file 470 00:29:42,040 --> 00:29:43,860 or you get an MMS with it, 471 00:29:43,940 --> 00:29:45,560 um, your phone will crash. 472 00:29:45,780 --> 00:29:48,100 It will crash and it will just go off. 473 00:29:49,340 --> 00:29:50,980 It is very interesting, 474 00:29:51,160 --> 00:29:53,360 but, um, you can make this permanent 475 00:29:53,360 --> 00:29:56,160 by placing this picture as a background image on the phone, 476 00:29:56,760 --> 00:29:59,540 which is pretty much the last thing you did with the phone. 477 00:30:03,060 --> 00:30:03,580 Okay. 478 00:30:03,840 --> 00:30:05,060 Enough of that crap. 479 00:30:05,520 --> 00:30:08,060 Um, I'll actually go and do 480 00:30:08,820 --> 00:30:10,160 some of the Cisco stuff. 481 00:30:10,420 --> 00:30:12,200 This was not intended to be here, 482 00:30:12,360 --> 00:30:14,120 but, um, since a lot of people 483 00:30:14,120 --> 00:30:17,160 were talking about the latest, um, iOS bug 484 00:30:17,160 --> 00:30:19,400 where you could, like, deny of service a device, 485 00:30:19,660 --> 00:30:21,340 and actually some brilliant people 486 00:30:21,340 --> 00:30:24,120 sent very extensively explained, um, 487 00:30:24,240 --> 00:30:26,400 IRC chat logs to full disclosure, 488 00:30:26,740 --> 00:30:29,040 um, claiming this might be exploitable, 489 00:30:29,200 --> 00:30:30,960 I thought I'd gonna comment on it. 490 00:30:31,580 --> 00:30:33,540 So, the recently discovered bug 491 00:30:33,540 --> 00:30:35,720 is, for those of you who don't have email, 492 00:30:36,300 --> 00:30:39,120 um, that there is a way with, like, 493 00:30:39,260 --> 00:30:41,940 um, ad form packets to fill the input queue. 494 00:30:42,340 --> 00:30:45,440 Now, the question was, is this exploitable? 495 00:30:45,800 --> 00:30:47,240 Well, my question is, 496 00:30:47,360 --> 00:30:49,220 uh, when you're stuck in a traffic jam, 497 00:30:49,360 --> 00:30:51,160 does that mean you control the traffic light? 498 00:30:52,160 --> 00:30:54,500 Um, you can describe the bug as 499 00:30:55,340 --> 00:30:59,420 something like you have people checking in in Alexis Park 500 00:30:59,420 --> 00:31:01,240 and you got, like, 75 people 501 00:31:01,580 --> 00:31:02,620 that go into the front counter, 502 00:31:03,000 --> 00:31:05,760 and then, um, you kind of, like, 503 00:31:06,450 --> 00:31:07,800 kill the person behind the counter, 504 00:31:08,530 --> 00:31:10,520 which still doesn't mean you get their money. 505 00:31:10,760 --> 00:31:13,140 So, to answer the question, no, it's not exploitable. 506 00:31:13,960 --> 00:31:16,860 But the good question would really be, 507 00:31:16,940 --> 00:31:17,920 what is the problem? 508 00:31:18,480 --> 00:31:22,460 The problem here is that iOS is interrupt and message driven. 509 00:31:22,740 --> 00:31:25,880 So, the processes themselves are responsible 510 00:31:25,880 --> 00:31:27,340 for draining the queues, 511 00:31:27,480 --> 00:31:30,500 which, obviously, those four processes didn't do. 512 00:31:31,580 --> 00:31:35,380 Um, and, well, most processes in iOS, 513 00:31:35,500 --> 00:31:38,800 for what I know, do their own protocol parsing. 514 00:31:38,820 --> 00:31:42,220 Means the IP header is actually parsed at a central place, 515 00:31:42,340 --> 00:31:46,040 but everything else is parsed each and every time 516 00:31:46,040 --> 00:31:49,400 in each and every process, whoever is responsible for it. 517 00:31:49,800 --> 00:31:52,340 That means if you got 100 types processes, 518 00:31:52,960 --> 00:31:56,440 um, 99 can do IP protocol parsing quite well, 519 00:31:56,540 --> 00:31:58,020 and one is totally fucked up. 520 00:31:58,140 --> 00:31:59,940 And all you have to do is find the one. 521 00:32:02,220 --> 00:32:05,460 So, that obviously, um, leads to the point, 522 00:32:05,600 --> 00:32:06,800 can we expect more of that? 523 00:32:07,300 --> 00:32:10,780 Um, I guess the simple and short answer is yes. 524 00:32:11,200 --> 00:32:15,480 Um, the bug is actually a design failure in my eyes. 525 00:32:15,720 --> 00:32:18,960 Um, iOS 12.3 is already out, 526 00:32:19,060 --> 00:32:20,560 and it's already deferred. 527 00:32:21,160 --> 00:32:23,460 And there are some specific protocols 528 00:32:23,460 --> 00:32:24,720 that are handled differently 529 00:32:24,720 --> 00:32:26,840 and have higher priorities and stuff. 530 00:32:27,020 --> 00:32:29,000 So, it's just a matter of time. 531 00:32:29,980 --> 00:32:30,540 Um... 532 00:32:30,540 --> 00:32:33,860 The effects of the bug were not as bad as we thought, 533 00:32:34,000 --> 00:32:36,000 because Cisco actually went to the background providers 534 00:32:36,000 --> 00:32:37,240 and told them up front, 535 00:32:37,440 --> 00:32:39,720 here, um, is something major coming, 536 00:32:39,800 --> 00:32:40,700 so please filter that. 537 00:32:41,760 --> 00:32:44,960 Um, and the bug actually was found, Cisco internally, 538 00:32:45,480 --> 00:32:47,220 so, um, they could do that, 539 00:32:47,300 --> 00:32:49,240 but what if the next bug is not? 540 00:32:50,820 --> 00:32:52,580 Well, at this point in time, 541 00:32:54,580 --> 00:32:56,940 here is the one, um, finding the bug. 542 00:32:57,100 --> 00:32:59,240 Um, he's the only one from the Cisco stat team. 543 00:32:59,340 --> 00:33:00,360 I'm glad he is here. 544 00:33:00,540 --> 00:33:02,820 He didn't get credit in the advisory, 545 00:33:02,980 --> 00:33:04,420 so I wanted to give him credit here. 546 00:33:11,120 --> 00:33:13,360 Okay, back to bugs that we found. 547 00:33:14,080 --> 00:33:16,700 Um, Cisco iOS 11 and X, 548 00:33:16,760 --> 00:33:18,580 um, 11X and below, 549 00:33:19,720 --> 00:33:21,960 there is the UDP Echo service. 550 00:33:22,120 --> 00:33:24,160 Now, NASA is telling you, um, 551 00:33:24,380 --> 00:33:27,360 since ages that the UDP Echo service is bad 552 00:33:27,360 --> 00:33:29,740 because someone can do ping-pong attacks on it. 553 00:33:29,740 --> 00:33:31,440 Um, on Cisco, 554 00:33:31,640 --> 00:33:33,500 the UDP Echo service is actually worse 555 00:33:34,620 --> 00:33:36,160 because they got a bug here 556 00:33:36,160 --> 00:33:38,780 that is, on first time, very small. 557 00:33:39,100 --> 00:33:41,000 You look at it, and, um, 558 00:33:41,200 --> 00:33:44,060 you send the UDP Echo request packet, 559 00:33:44,260 --> 00:33:46,400 and in the UDP length, 560 00:33:46,580 --> 00:33:48,120 you actually say it's longer 561 00:33:48,120 --> 00:33:50,580 than you actually, um, include the data of, 562 00:33:50,700 --> 00:33:53,760 so you have one single character in the packet, 563 00:33:53,860 --> 00:33:56,060 but you say the packet was 100 bytes long. 564 00:33:56,260 --> 00:33:57,860 You get a 100 bytes answer. 565 00:33:57,860 --> 00:34:01,460 Now, we tried and tried to look at 566 00:34:01,460 --> 00:34:03,480 how much data we actually can get back, 567 00:34:03,720 --> 00:34:06,560 and it ended up being something about 19K 568 00:34:06,560 --> 00:34:07,580 with one packet. 569 00:34:08,720 --> 00:34:10,500 So that could be quite useful 570 00:34:10,500 --> 00:34:12,160 because that is I.O. memory. 571 00:34:12,880 --> 00:34:15,200 I.O. memory is used on Cisco 572 00:34:15,200 --> 00:34:17,360 for handling all the crap that, um, 573 00:34:17,440 --> 00:34:19,340 has something to do with the packets themselves 574 00:34:19,340 --> 00:34:22,020 and some limited routing information. 575 00:34:23,780 --> 00:34:24,940 So, um, 576 00:34:25,240 --> 00:34:27,120 we actually got comparable bugs 577 00:34:27,120 --> 00:34:29,500 in 12.x, um, 578 00:34:29,800 --> 00:34:32,140 like the Cisco Express forwarding. 579 00:34:32,220 --> 00:34:34,100 That's a certain way of, um, 580 00:34:34,340 --> 00:34:36,320 yeah, getting packets from A to B 581 00:34:36,320 --> 00:34:37,100 that Cisco uses. 582 00:34:37,460 --> 00:34:39,480 I think it's now the standard setting. 583 00:34:39,760 --> 00:34:42,160 Um, this one had a comparable bug 584 00:34:42,160 --> 00:34:44,620 where the IP length was the trigger. 585 00:34:44,800 --> 00:34:46,960 So there is more of it. 586 00:34:47,060 --> 00:34:48,480 But back to the UDP Echo service. 587 00:34:48,620 --> 00:34:49,380 What can we do with it? 588 00:34:49,580 --> 00:34:51,600 Oh, now here's something, um, 589 00:34:51,680 --> 00:34:54,020 because people started complaining about, um, 590 00:34:54,160 --> 00:34:56,460 finding bugs in 11 is useless 591 00:34:56,460 --> 00:34:58,100 because nobody uses 11. 592 00:34:58,420 --> 00:34:59,800 This is a founder, uh, 593 00:34:59,940 --> 00:35:02,080 this is a router actually, um, 594 00:35:02,160 --> 00:35:03,220 alive in the Internet. 595 00:35:03,420 --> 00:35:04,680 Um, he found it. 596 00:35:04,960 --> 00:35:06,540 It runs I.O.S. 9. 597 00:35:07,200 --> 00:35:09,020 Well, this one is not even available 598 00:35:09,020 --> 00:35:10,880 on the Cisco FTP service anymore. 599 00:35:11,940 --> 00:35:14,300 So people do update their routers 600 00:35:14,300 --> 00:35:14,940 once in a time. 601 00:35:16,580 --> 00:35:20,080 Okay, the UDP Echo, um, 602 00:35:20,320 --> 00:35:23,220 info leak bug actually is quite useful 603 00:35:23,220 --> 00:35:26,440 because we can do reliable I.O.S. fingerprinting. 604 00:35:27,160 --> 00:35:29,140 In the past we got the problem, um, 605 00:35:29,320 --> 00:35:32,380 that you got like 22,000 different I.O.S. images, 606 00:35:32,640 --> 00:35:34,060 um, sitting on Cisco. 607 00:35:34,920 --> 00:35:37,600 And, well, you don't know what the router 608 00:35:37,600 --> 00:35:39,120 you're targeting is running. 609 00:35:39,360 --> 00:35:41,980 Now you can because it contains block headers 610 00:35:41,980 --> 00:35:45,520 which contain addresses who allocated the block. 611 00:35:45,760 --> 00:35:48,680 Um, you got addresses of the allocating image, 612 00:35:48,880 --> 00:35:51,000 uh, allocating function, um, 613 00:35:51,160 --> 00:35:53,700 which change per image so you know which image it is. 614 00:35:53,820 --> 00:35:56,440 And you got address ranges for I.O.S. 615 00:35:56,460 --> 00:35:57,580 memory and heap memory, 616 00:35:57,800 --> 00:35:59,540 and those change by platform. 617 00:35:59,760 --> 00:36:01,120 So you can fingerprint it. 618 00:36:03,200 --> 00:36:04,660 This is what you actually get back. 619 00:36:05,300 --> 00:36:08,240 Um, you see you have the allocation stuff, 620 00:36:08,480 --> 00:36:11,040 um, and the pointers we talked about last year. 621 00:36:11,180 --> 00:36:12,480 They're all platform specific, 622 00:36:12,760 --> 00:36:15,000 but you also got the ring buffer information 623 00:36:15,000 --> 00:36:17,360 and the actual packets in the device. 624 00:36:17,600 --> 00:36:19,480 So question is, can we? 625 00:36:19,660 --> 00:36:21,500 Um, and yes, we can. 626 00:36:22,440 --> 00:36:25,020 There is, of course, the possibility 627 00:36:25,020 --> 00:36:28,840 of draining the router of memory leakage 628 00:36:28,840 --> 00:36:31,360 and actually get 19K per packet back 629 00:36:31,360 --> 00:36:32,920 and parse that correctly. 630 00:36:33,280 --> 00:36:35,340 So we came up with FinaLit I.O. Sniff, 631 00:36:35,460 --> 00:36:37,440 which is remote I.O.S. sniffing. 632 00:36:37,540 --> 00:36:39,060 You don't need any account. 633 00:36:39,200 --> 00:36:40,460 You just need UDP echo. 634 00:36:41,600 --> 00:36:44,360 What it does is actually pulling down the information, 635 00:36:44,780 --> 00:36:47,600 um, parsing the memory block, 636 00:36:47,820 --> 00:36:49,600 um, identify them, 637 00:36:49,760 --> 00:36:51,300 identify the packet offset, 638 00:36:51,640 --> 00:36:54,100 do the packet decoding and present you 639 00:36:54,100 --> 00:36:56,200 with a nice TCP dump-like output. 640 00:36:57,180 --> 00:37:00,380 So, um, this being the receive buffers, 641 00:37:00,420 --> 00:37:01,720 it's quite useful because, 642 00:37:01,820 --> 00:37:04,500 well, the router receives certain information, 643 00:37:04,760 --> 00:37:06,160 especially when people log in. 644 00:37:06,540 --> 00:37:09,360 Um, so what you see here 645 00:37:09,360 --> 00:37:11,840 are the first two lines or three lines 646 00:37:11,840 --> 00:37:15,080 of, um, stuff that actually is sent to the router 647 00:37:15,080 --> 00:37:17,020 when someone is telnetting to it. 648 00:37:17,100 --> 00:37:19,880 Well, the first lines he's probably sending 649 00:37:19,880 --> 00:37:20,720 are the passwords. 650 00:37:21,140 --> 00:37:22,480 So that's quite useful. 651 00:37:25,820 --> 00:37:27,200 But there is another bug. 652 00:37:27,800 --> 00:37:31,140 Um, Cisco has an HTTP service. 653 00:37:31,240 --> 00:37:31,960 And as I said earlier, 654 00:37:32,200 --> 00:37:33,400 if you've got an embedded system 655 00:37:33,400 --> 00:37:35,520 and it got a TCP port 80 open, 656 00:37:35,720 --> 00:37:36,740 it is vulnerable. 657 00:37:37,440 --> 00:37:38,980 Well, Cisco is no exception. 658 00:37:39,440 --> 00:37:47,400 Um, the HTTP server on 11.x and, um, 12, up to 12.2, 659 00:37:47,480 --> 00:37:49,200 um, has an integer overflow. 660 00:37:50,060 --> 00:37:53,340 It unfortunately requires you to send two gigabytes of data. 661 00:37:53,340 --> 00:37:58,140 Um, but, well, I actually did a survey on people 662 00:37:58,140 --> 00:37:59,380 and said, is this bullshit, 663 00:37:59,480 --> 00:38:01,080 or should we actually, um, go ahead 664 00:38:01,080 --> 00:38:02,380 and see if we can exploit it? 665 00:38:02,520 --> 00:38:03,940 And most said, yeah, I don't care. 666 00:38:04,060 --> 00:38:06,300 If I wait a week and I got root on a device, that's fine. 667 00:38:09,200 --> 00:38:11,580 And since that is the stack-based overflow, 668 00:38:11,860 --> 00:38:14,280 um, and it might be quite interesting to do 669 00:38:14,280 --> 00:38:16,580 because last year we did heap overflows, we did it. 670 00:38:16,960 --> 00:38:19,400 So, exploitation issues in the past 671 00:38:19,400 --> 00:38:21,180 for those who missed last year, 672 00:38:21,300 --> 00:38:23,320 um, we need server-based, 673 00:38:23,340 --> 00:38:25,680 uh, image-dependent information like previous pointers, 674 00:38:26,020 --> 00:38:28,500 size, volume, I.O. memory, stack location, 675 00:38:28,780 --> 00:38:30,960 location of the own code, um, 676 00:38:31,200 --> 00:38:32,920 which probably means, uh, 677 00:38:33,040 --> 00:38:35,080 you should already have a console connection 678 00:38:35,080 --> 00:38:36,500 to the router you're trying to hack. 679 00:38:36,840 --> 00:38:39,160 And this isn't really practical. 680 00:38:40,280 --> 00:38:42,980 So, um, things change. 681 00:38:43,860 --> 00:38:46,820 What we got now is the UDP echo memory leak. 682 00:38:47,040 --> 00:38:49,540 Um, we see Attica provide the data, 683 00:38:49,640 --> 00:38:52,240 which is the UDP stuff you send there in the first place. 684 00:38:52,240 --> 00:38:55,460 Um, we have live I.O.S. memory addresses, 685 00:38:55,780 --> 00:38:58,220 the leaked memory block headers, if you remember. 686 00:38:58,640 --> 00:39:02,380 And we have the ability to fill multiple memory locations 687 00:39:02,380 --> 00:39:03,560 because it's a ring buffer. 688 00:39:03,720 --> 00:39:05,480 So we just send it multiple times. 689 00:39:05,860 --> 00:39:07,840 And we got the HTTP overflow, 690 00:39:08,220 --> 00:39:11,060 which is a direct frame pointer overwrite 691 00:39:11,060 --> 00:39:13,000 and return address overwrite, 692 00:39:13,060 --> 00:39:14,360 so it's straightforward to exploit. 693 00:39:17,100 --> 00:39:20,140 So what we, what we can do is, 694 00:39:20,300 --> 00:39:22,220 um, we actually send full-blank 695 00:39:22,240 --> 00:39:23,260 full binary shell code there, 696 00:39:23,420 --> 00:39:26,520 um, via the UDP echo block. 697 00:39:27,320 --> 00:39:30,920 On the response, we see where it ended up, 698 00:39:31,060 --> 00:39:34,000 and we can calculate the exact address it is. 699 00:39:34,220 --> 00:39:36,560 We also have no limitations on byte 700 00:39:36,560 --> 00:39:39,200 because UDP echo doesn't care what it got in a payload. 701 00:39:40,060 --> 00:39:42,760 Um, we need actually to, um, 702 00:39:42,920 --> 00:39:46,220 select a good address from those in the ring buffers 703 00:39:46,220 --> 00:39:49,060 because if the router is not sitting in a phenolate lapse, 704 00:39:49,140 --> 00:39:51,560 it has probably something else to do, 705 00:39:51,560 --> 00:39:53,200 namely, uh, forwarding packets. 706 00:39:53,880 --> 00:39:56,900 So it's using the ring buffers actually to do the job, 707 00:39:57,040 --> 00:39:58,720 and, uh, we need to find a way 708 00:39:58,720 --> 00:40:00,920 to actually have a stable, um, 709 00:40:01,540 --> 00:40:03,380 address where the shell code survived 710 00:40:03,380 --> 00:40:05,660 and is not overwritten by other IP packets. 711 00:40:06,500 --> 00:40:08,480 But, well, if we figure that out, 712 00:40:08,540 --> 00:40:09,300 we own the box. 713 00:40:11,280 --> 00:40:13,680 So, combined, we actually send 714 00:40:13,680 --> 00:40:15,900 the maximum URL length allowed by iOS. 715 00:40:16,940 --> 00:40:21,040 Um, then we send two gigabytes of additional URL elements. 716 00:40:21,560 --> 00:40:24,120 Which has a nice side effect 717 00:40:24,120 --> 00:40:27,360 because it keeps counting and counting, 718 00:40:27,580 --> 00:40:29,420 um, the number of bytes received 719 00:40:29,420 --> 00:40:32,000 and compares it to the size of the buffer. 720 00:40:32,120 --> 00:40:34,640 Now, after you send two gigabytes of data, 721 00:40:34,780 --> 00:40:36,140 this being a signed integer, 722 00:40:36,340 --> 00:40:39,740 the number of bytes received variable will be negative. 723 00:40:40,060 --> 00:40:42,640 And this is smaller than the size of the buffer, 724 00:40:42,800 --> 00:40:44,480 so they can still copy it. 725 00:40:44,620 --> 00:40:46,620 Which means they're overflowing the buffer. 726 00:40:47,740 --> 00:40:50,080 Then, after sending all the crap over there, 727 00:40:50,080 --> 00:40:53,020 uh, we perform a UDP memory leak several times 728 00:40:53,020 --> 00:40:54,820 so we get all the code addresses, 729 00:40:55,520 --> 00:40:58,680 make an intelligent decision on which address to use, 730 00:40:58,900 --> 00:41:00,760 well, and complete the overflow. 731 00:41:01,580 --> 00:41:04,140 For those of you who prefer, like, all in color, 732 00:41:04,440 --> 00:41:05,120 here it is, 733 00:41:06,300 --> 00:41:09,480 um, HTTP connect legalize URL, 734 00:41:09,780 --> 00:41:11,260 um, send lots of As, 735 00:41:12,320 --> 00:41:13,580 do the UDP echo, 736 00:41:14,120 --> 00:41:15,380 get the info back, 737 00:41:15,640 --> 00:41:17,200 repeat until happy, 738 00:41:18,260 --> 00:41:19,360 send the overflow, 739 00:41:20,080 --> 00:41:20,680 own the box. 740 00:41:20,900 --> 00:41:21,500 End of slide. 741 00:41:28,000 --> 00:41:30,740 A problem we got here is, of course, um, 742 00:41:31,720 --> 00:41:33,320 the binary via HTTP. 743 00:41:33,840 --> 00:41:36,000 Um, we're overriding the return address, 744 00:41:36,160 --> 00:41:40,080 so, um, HTTP doesn't really like characters, 745 00:41:40,200 --> 00:41:42,740 like line feeds, character turns, slashes, 746 00:41:43,100 --> 00:41:44,720 zero bytes are obviously bad, 747 00:41:45,020 --> 00:41:48,560 um, but we found out that the HTTP encoding, 748 00:41:48,560 --> 00:41:51,140 you know, the percent XYZ and stuff 749 00:41:51,140 --> 00:41:54,280 that everyone, like, uses to screw up in their web servers, 750 00:41:54,500 --> 00:41:57,940 um, is actually performed on the same buffer 751 00:41:57,940 --> 00:42:00,160 before the overflowed function returns. 752 00:42:00,660 --> 00:42:03,440 So we can actually do, um, overflow 753 00:42:03,440 --> 00:42:05,580 and use the HTTP encoding 754 00:42:05,580 --> 00:42:07,880 so we can use arbitrary addresses, 755 00:42:08,020 --> 00:42:09,360 which made it even easier. 756 00:42:12,360 --> 00:42:15,420 I said we need an intelligent address selection, 757 00:42:15,760 --> 00:42:18,280 um, so what we are doing is, um, 758 00:42:18,560 --> 00:42:20,680 there are several strategies that are listed here. 759 00:42:20,760 --> 00:42:21,600 I'm running out of time, 760 00:42:21,660 --> 00:42:23,360 so I'll skip over and just tell you, 761 00:42:23,420 --> 00:42:25,240 use the second smallest address 762 00:42:25,240 --> 00:42:28,120 or the third smallest address is the best way to do. 763 00:42:28,340 --> 00:42:29,520 You will see it in the code. 764 00:42:30,940 --> 00:42:31,900 Now shellcode. 765 00:42:32,240 --> 00:42:33,980 Um, we had shellcode in the past 766 00:42:33,980 --> 00:42:35,620 that overwrote the complete configuration, 767 00:42:35,920 --> 00:42:39,160 which unfortunately means you lose all the juicy info, 768 00:42:39,320 --> 00:42:41,760 um, like the passwords they use, 769 00:42:41,880 --> 00:42:44,240 and they're never, never going to use 770 00:42:44,240 --> 00:42:45,960 on any other router in their network. 771 00:42:46,340 --> 00:42:48,540 Um, and the routing information, um, 772 00:42:48,560 --> 00:42:49,540 information access lists, 773 00:42:49,720 --> 00:42:52,140 all the stuff you could be interested in, 774 00:42:52,860 --> 00:42:56,300 um, so we figured we need new shellcode, 775 00:42:56,520 --> 00:42:59,180 and for that we actually did binary research on iOS. 776 00:42:59,580 --> 00:43:03,520 Um, iOS, uh, Cisco actually supports 777 00:43:03,520 --> 00:43:06,260 serial debugging via GDP, but it sucks. 778 00:43:06,620 --> 00:43:09,900 Um, but they also got some debugging capability 779 00:43:09,900 --> 00:43:11,020 in the ROM monitor, 780 00:43:11,340 --> 00:43:13,620 um, which is comparable to 781 00:43:13,620 --> 00:43:16,320 what you have in your PC as a BIOS. 782 00:43:16,500 --> 00:43:18,200 And so you can set breakpoints 783 00:43:18,560 --> 00:43:19,240 and do disassembly. 784 00:43:19,600 --> 00:43:21,680 The cool thing here is, um, 785 00:43:21,980 --> 00:43:24,700 code identification of the critical, um, 786 00:43:25,360 --> 00:43:27,240 part of the huge chunk of code you got 787 00:43:27,240 --> 00:43:29,280 is quite simple because the string 788 00:43:29,280 --> 00:43:31,920 that is, um, shown in a function 789 00:43:31,920 --> 00:43:33,900 is actually stored right next to the function 790 00:43:33,900 --> 00:43:34,960 in the text segment. 791 00:43:35,360 --> 00:43:37,960 Um, and that's before the function. 792 00:43:38,120 --> 00:43:39,520 So all you do is turn on 793 00:43:39,520 --> 00:43:41,360 every possible debugging you can give 794 00:43:41,360 --> 00:43:44,440 and, um, do whatever you wanted to find out 795 00:43:44,440 --> 00:43:46,580 and then look for the strings, 796 00:43:46,800 --> 00:43:48,540 find them in the code, disassemble the function, 797 00:43:48,560 --> 00:43:50,640 after that, and you got the function 798 00:43:50,640 --> 00:43:51,500 using those strings. 799 00:43:52,340 --> 00:43:54,720 So equipped with this knowledge, um, 800 00:43:55,060 --> 00:43:56,700 we actually figured out we need 801 00:43:56,700 --> 00:43:57,780 new shell code, 802 00:43:58,280 --> 00:44:00,120 call it next generation code, whatever. 803 00:44:00,440 --> 00:44:02,480 Um, what we do is 804 00:44:02,480 --> 00:44:03,960 runtime iOS patching. 805 00:44:04,740 --> 00:44:06,500 We actually teach the 806 00:44:06,500 --> 00:44:08,840 Cisco device to forget about certain 807 00:44:08,840 --> 00:44:10,500 functions it performed before, 808 00:44:10,720 --> 00:44:12,300 namely password validation. 809 00:44:12,880 --> 00:44:15,180 So, um, with the new shell code 810 00:44:15,180 --> 00:44:16,980 you turn it to the device and it stops 811 00:44:16,980 --> 00:44:18,540 doing the annoying user error 812 00:44:18,560 --> 00:44:18,940 authentication, 813 00:44:19,920 --> 00:44:21,040 give me the password stuff. 814 00:44:21,340 --> 00:44:23,020 It just drops you on the user shell. 815 00:44:23,760 --> 00:44:26,380 And, of course, um, the same is possible 816 00:44:26,380 --> 00:44:27,860 for the enable password. 817 00:44:28,180 --> 00:44:30,560 So, um, it will actually ask you 818 00:44:30,560 --> 00:44:32,260 for the enable password when you say enable 819 00:44:32,260 --> 00:44:34,400 but, um, it will not validate 820 00:44:34,400 --> 00:44:34,840 the results. 821 00:44:35,840 --> 00:44:38,440 Of course, you can do other stuff. 822 00:44:38,720 --> 00:44:40,200 Um, you could actually introduce 823 00:44:40,200 --> 00:44:42,340 something like forgetting about 824 00:44:42,340 --> 00:44:44,160 to check if the BGP neighbor 825 00:44:44,160 --> 00:44:46,160 I'm talking to is really the one I'm supposed 826 00:44:46,160 --> 00:44:46,840 to talk to. 827 00:44:48,560 --> 00:44:49,060 So, um, if you have pure imagination, 828 00:44:49,720 --> 00:44:51,660 the problem here is, um, 829 00:44:51,840 --> 00:44:53,620 we have to keep iOS running. 830 00:44:55,320 --> 00:44:55,880 Well, 831 00:44:56,020 --> 00:44:58,360 the overflow actually destroys a lot of 832 00:44:58,360 --> 00:45:00,440 stuff on the heap because of the, um, 833 00:45:00,580 --> 00:45:01,800 encoding we use. 834 00:45:01,960 --> 00:45:04,200 Um, we send 24 bytes and 835 00:45:04,200 --> 00:45:06,140 they end up being 8 bytes, but we 836 00:45:06,140 --> 00:45:08,220 destroyed a lot. Um, but 837 00:45:08,220 --> 00:45:09,900 the Motorola call structure actually 838 00:45:09,900 --> 00:45:11,920 saves frame pointer and stack pointer 839 00:45:11,920 --> 00:45:14,080 pretty comparable to, um, 840 00:45:14,280 --> 00:45:16,120 the Intel ones. And so 841 00:45:16,120 --> 00:45:18,140 all you need to do is search the stack 842 00:45:18,560 --> 00:45:20,220 of words for, um, 843 00:45:20,380 --> 00:45:22,420 information that was set there by 844 00:45:22,420 --> 00:45:23,820 a function preamble 845 00:45:24,380 --> 00:45:25,940 and use this information 846 00:45:26,560 --> 00:45:27,600 and do a clean return 847 00:45:27,600 --> 00:45:30,180 and better, like, clear the return, 848 00:45:30,360 --> 00:45:32,340 um, information so it will 849 00:45:32,340 --> 00:45:34,080 actually return faults and nobody cares. 850 00:45:35,620 --> 00:45:36,460 This is the 851 00:45:36,460 --> 00:45:38,420 code. Um, I guess nobody can read it 852 00:45:38,420 --> 00:45:40,340 there. Um, it 853 00:45:40,340 --> 00:45:41,760 just finds the return and cleans. 854 00:45:42,040 --> 00:45:44,420 Um, yeah, you can check it out on the 855 00:45:44,420 --> 00:45:46,400 slides later. iOS runtime 856 00:45:46,400 --> 00:45:48,420 patching advantage. Um, 857 00:45:48,560 --> 00:45:50,240 of course, the router stays 858 00:45:50,240 --> 00:45:51,760 online. It doesn't reboot anymore. 859 00:45:52,820 --> 00:45:54,500 Deconfiguration is preserved, so 860 00:45:54,500 --> 00:45:56,300 if you're interested in stuff like 861 00:45:56,300 --> 00:45:58,520 the passwords that are so heavily encrypted 862 00:45:58,520 --> 00:45:59,980 with the password 7 algorithm, 863 00:46:00,420 --> 00:46:02,520 um, and of course, 864 00:46:02,600 --> 00:46:04,620 um, it proves that what people talked 865 00:46:04,620 --> 00:46:06,580 about for years and years back during 866 00:46:06,580 --> 00:46:08,340 iOS runtime code is actually 867 00:46:08,340 --> 00:46:09,600 possible and quite easy. 868 00:46:11,040 --> 00:46:12,500 Disadvantages, of course, it's depending 869 00:46:12,500 --> 00:46:14,040 on the image, so we got the image 870 00:46:14,040 --> 00:46:16,480 dependence again. 871 00:46:16,800 --> 00:46:18,540 Um, you need, therefore, a lot of 872 00:46:18,560 --> 00:46:19,580 data in the large target list and, 873 00:46:19,740 --> 00:46:22,220 well, you actually got annoying messages 874 00:46:22,220 --> 00:46:24,180 on a console saying checksum error 875 00:46:24,180 --> 00:46:26,540 because it does checksum the text 876 00:46:26,540 --> 00:46:28,420 segment and, um, figures out 877 00:46:28,420 --> 00:46:30,520 that there is a problem. But, of course, 878 00:46:30,580 --> 00:46:32,360 um, we patched that out 879 00:46:32,360 --> 00:46:32,720 as well. 880 00:46:34,800 --> 00:46:36,360 So this is what the exploit 881 00:46:36,360 --> 00:46:37,420 is. Um, 882 00:46:38,240 --> 00:46:40,540 Cisco Kazim asked, um, reliable 883 00:46:40,540 --> 00:46:42,240 iOS remote exploitation. 884 00:46:42,740 --> 00:46:43,920 That's just a summary. 885 00:46:45,140 --> 00:46:46,500 Um, and this is 886 00:46:46,500 --> 00:46:47,100 how it looks like. 887 00:46:49,060 --> 00:46:49,940 Quite easy. 888 00:46:53,100 --> 00:46:53,880 She's bad. 889 00:46:56,220 --> 00:46:57,780 Okay, here is something, um, 890 00:46:58,000 --> 00:47:00,400 lots of people for the last years were complaining 891 00:47:00,400 --> 00:47:02,440 that all the presentations held on BlackHat 892 00:47:02,440 --> 00:47:04,580 are actually, um, held the same way 893 00:47:04,580 --> 00:47:06,280 on DEF CON and there is no value add. 894 00:47:06,500 --> 00:47:08,280 So here's our value add to DEF CON. 895 00:47:08,600 --> 00:47:10,520 Um, what about image 896 00:47:10,520 --> 00:47:11,540 independent shellcode? 897 00:47:12,100 --> 00:47:14,440 We can actually, um, instead of 898 00:47:14,440 --> 00:47:16,420 modifying the image, we can actually 899 00:47:16,420 --> 00:47:18,400 modify the configuration. Now, the configuration 900 00:47:18,560 --> 00:47:20,220 is portable over 901 00:47:20,220 --> 00:47:21,460 images and versions. 902 00:47:21,920 --> 00:47:24,540 So all we need to do is have a shellcode that does 903 00:47:24,540 --> 00:47:26,160 string search, um, 904 00:47:26,300 --> 00:47:28,120 memcopy, and checksums. 905 00:47:28,960 --> 00:47:30,360 Well, we can do that. 906 00:47:31,680 --> 00:47:33,160 Config modification code. 907 00:47:33,420 --> 00:47:34,580 Um, we start searching 908 00:47:34,580 --> 00:47:36,000 at the beginning of the NVRAM. 909 00:47:36,160 --> 00:47:38,240 Um, we look for occurrences of, um, 910 00:47:38,420 --> 00:47:40,280 like interesting data. Um, 911 00:47:40,480 --> 00:47:42,280 let's say password and enable. 912 00:47:42,720 --> 00:47:44,500 Um, we replace it 913 00:47:44,500 --> 00:47:45,800 with our information. 914 00:47:46,480 --> 00:47:48,400 Um, and here, right, replace 915 00:47:48,560 --> 00:47:50,360 authentication information for the listed 916 00:47:50,360 --> 00:47:52,160 services. We then 917 00:47:52,160 --> 00:47:54,360 just need to recalculate the checksum, 918 00:47:54,400 --> 00:47:56,060 um, for the NVRAM 919 00:47:56,060 --> 00:47:57,800 and write it back. 920 00:48:00,200 --> 00:48:01,960 And this is how that looks like. 921 00:48:02,820 --> 00:48:04,380 You know, IOS also 922 00:48:04,380 --> 00:48:06,240 has the advantage, um, 923 00:48:06,480 --> 00:48:08,240 of ignoring lines 924 00:48:08,240 --> 00:48:10,420 with bullshit. So, um, 925 00:48:10,520 --> 00:48:12,180 we can actually replace the stuff 926 00:48:12,180 --> 00:48:14,160 and, um, introduce a line feed. 927 00:48:14,360 --> 00:48:16,420 The rest of the encrypted strings ends 928 00:48:16,420 --> 00:48:18,500 up being bullshit. IOS ignores it. 929 00:48:18,560 --> 00:48:18,940 That's fine. 930 00:48:20,380 --> 00:48:22,060 Advantages here. It's image independent. 931 00:48:23,120 --> 00:48:24,660 Um, the configuration 932 00:48:24,660 --> 00:48:26,420 is pretty much preserved except for 933 00:48:26,420 --> 00:48:28,260 the passwords. But, of course, we can change the 934 00:48:28,260 --> 00:48:29,620 shellcode and copy the passwords elsewhere. 935 00:48:30,580 --> 00:48:32,560 Um, and we have actually more 936 00:48:32,560 --> 00:48:34,380 choices of what to do. We can have 937 00:48:34,380 --> 00:48:36,220 shellcodes just renaming every router 938 00:48:36,220 --> 00:48:37,840 to, like, piece of crap. 939 00:48:39,300 --> 00:48:40,260 Um, disadvantage, 940 00:48:40,620 --> 00:48:42,180 of course, it's still, um, 941 00:48:42,260 --> 00:48:44,460 platform dependent. But, well, we cannot 942 00:48:44,460 --> 00:48:46,380 change that except for, um, 943 00:48:46,460 --> 00:48:48,540 if one of the guys that sees this challenge comes up 944 00:48:48,560 --> 00:48:50,660 with a, um, cross-platform shellcode 945 00:48:50,660 --> 00:48:51,860 for Motorola and MIPS. 946 00:48:52,200 --> 00:48:54,140 Um, and 947 00:48:54,140 --> 00:48:56,400 the router has to reboot. So we got a little 948 00:48:56,400 --> 00:48:56,700 downtime. 949 00:48:58,420 --> 00:49:00,500 So what? What's the whole thing 950 00:49:00,500 --> 00:49:02,160 about? Well, didn't we mention 951 00:49:02,160 --> 00:49:04,460 last year that you shouldn't run unneeded services 952 00:49:04,460 --> 00:49:05,520 like UDP echo? 953 00:49:06,560 --> 00:49:08,320 Um, that you actually 954 00:49:08,320 --> 00:49:09,580 should protect your infrastructure 955 00:49:10,440 --> 00:49:12,480 and, um, that you actually 956 00:49:12,480 --> 00:49:14,540 should not copy data into buffers that are 957 00:49:14,540 --> 00:49:15,740 not large enough to hold them. 958 00:49:16,740 --> 00:49:18,480 So the problem here is 959 00:49:18,560 --> 00:49:20,360 iOS moves forward. 960 00:49:20,680 --> 00:49:22,340 Um, the new iOS 961 00:49:22,340 --> 00:49:24,700 versions actually got legal interception built in. 962 00:49:25,360 --> 00:49:26,380 Half a year ago 963 00:49:26,380 --> 00:49:28,560 I was, um, talking to Jaya, who did 964 00:49:28,560 --> 00:49:30,340 the, um, legal 965 00:49:30,340 --> 00:49:32,240 interception talk, and I said 966 00:49:32,240 --> 00:49:34,460 that would be quite interesting because 967 00:49:34,460 --> 00:49:36,520 um, then you can wear 968 00:49:36,520 --> 00:49:38,480 a t-shirt saying my other computer is your legal 969 00:49:38,480 --> 00:49:39,320 interception system. 970 00:49:40,160 --> 00:49:41,180 Well, um, 971 00:49:42,060 --> 00:49:44,540 this seems to become true slowly. 972 00:49:45,340 --> 00:49:46,440 Well, and if your 973 00:49:46,440 --> 00:49:48,340 infrastructure is owned, um, 974 00:49:48,560 --> 00:49:50,380 you can't defend your systems, of course. 975 00:49:52,700 --> 00:49:53,660 One, okay. 976 00:49:53,900 --> 00:49:56,260 Um, and one thing 977 00:49:56,260 --> 00:49:58,000 I wanted to mention is that 978 00:49:58,000 --> 00:49:59,960 there are more people than we, um, 979 00:50:00,040 --> 00:50:01,480 researching iOS exploitation. 980 00:50:02,940 --> 00:50:04,160 As a birthday gift, 981 00:50:04,320 --> 00:50:06,180 I got Body of Secrets, James Bamford. 982 00:50:06,380 --> 00:50:08,420 It actually has a whole page on 983 00:50:08,420 --> 00:50:10,460 the fact that, um, the NSA 984 00:50:10,460 --> 00:50:12,340 is actively trying 985 00:50:12,340 --> 00:50:13,780 to find hacks for iOS 986 00:50:13,780 --> 00:50:16,120 so they can take over Cisco routers. 987 00:50:16,280 --> 00:50:18,020 I just wanted to mention that here. 988 00:50:18,560 --> 00:50:19,440 Um, so, 989 00:50:19,640 --> 00:50:22,300 you actually got some very 990 00:50:22,300 --> 00:50:24,120 excellent, um, experience 991 00:50:24,120 --> 00:50:25,320 on DEF CON. 992 00:50:26,480 --> 00:50:28,380 We just have to identify the 993 00:50:28,380 --> 00:50:28,600 people. 994 00:50:31,100 --> 00:50:32,440 So, the defense part. 995 00:50:32,680 --> 00:50:34,360 Of course, mobile phones, that's easy. 996 00:50:34,480 --> 00:50:36,480 Turn the crap off. Do not do 997 00:50:36,480 --> 00:50:38,300 Bluetooth or have 998 00:50:38,300 --> 00:50:40,260 no, um, infrared 999 00:50:40,260 --> 00:50:42,160 enabled when you're sitting in the airport. 1000 00:50:42,940 --> 00:50:44,280 Do not run any 1001 00:50:44,280 --> 00:50:46,280 Java code just because it says it's gonna 1002 00:50:46,280 --> 00:50:48,180 show you titties. Um, 1003 00:50:48,980 --> 00:50:50,560 when you receive files, 1004 00:50:51,080 --> 00:50:52,260 delete them right away. 1005 00:50:52,540 --> 00:50:54,540 Um, think of your mobile phone as 1006 00:50:54,540 --> 00:50:55,860 a crappy version of Outlook. 1007 00:50:57,720 --> 00:50:58,500 And, well, 1008 00:50:58,560 --> 00:51:00,320 if you got a chance, um, keep your 1009 00:51:00,320 --> 00:51:02,260 phone firmware up to date. Some vendors 1010 00:51:02,260 --> 00:51:04,560 actually, um, allow you to do that. 1011 00:51:04,620 --> 00:51:06,240 For others, you have to arrest, um, 1012 00:51:06,340 --> 00:51:08,240 the people at the shop. And, 1013 00:51:08,420 --> 00:51:10,500 if you're, anyone is with a company 1014 00:51:10,500 --> 00:51:12,500 doing that, um, don't do GPRS 1015 00:51:12,500 --> 00:51:13,240 VPNs. 1016 00:51:14,740 --> 00:51:16,220 Defense Cisco, um, 1017 00:51:17,280 --> 00:51:18,380 well, in some 1018 00:51:18,560 --> 00:51:20,160 memory, do not trust devices just because 1019 00:51:20,160 --> 00:51:22,220 they're in a black box. It doesn't mean 1020 00:51:22,220 --> 00:51:24,480 they're more secure. It mostly means they're less secure. 1021 00:51:24,940 --> 00:51:26,360 Um, keep your 1022 00:51:26,360 --> 00:51:27,380 iOS up to date. 1023 00:51:28,260 --> 00:51:30,400 If possible, actually block every 1024 00:51:30,400 --> 00:51:32,160 direct communication to your routers. 1025 00:51:32,320 --> 00:51:34,200 There is no legitimate use to 1026 00:51:34,200 --> 00:51:36,440 someone else in the internet talk directly 1027 00:51:36,440 --> 00:51:38,300 to your router. So, 1028 00:51:38,380 --> 00:51:40,120 if you had done that in the first place, 1029 00:51:40,240 --> 00:51:42,040 even the, um, queue filling bug 1030 00:51:42,430 --> 00:51:43,580 wouldn't even affect you. 1031 00:51:44,840 --> 00:51:46,320 And, of course, um, 1032 00:51:46,440 --> 00:51:48,360 to do that, you should prefer out of 1033 00:51:48,560 --> 00:51:50,500 management. Um, so 1034 00:51:50,500 --> 00:51:52,460 the one talking to your router is actually 1035 00:51:52,460 --> 00:51:53,860 coming in on a different interface. 1036 00:51:54,840 --> 00:51:56,400 And, well, you should include 1037 00:51:56,400 --> 00:51:58,360 your router in the IDS watchlist. 1038 00:51:59,720 --> 00:52:00,480 Well, I was 1039 00:52:00,480 --> 00:52:02,440 racing through it, and I guess I made it on 1040 00:52:02,440 --> 00:52:04,440 time. Um, thanks 1041 00:52:04,440 --> 00:52:06,180 a lot for being here. 1042 00:52:06,340 --> 00:52:08,460 And, well, I will be at 1043 00:52:08,460 --> 00:52:09,400 the pool, um, 1044 00:52:11,460 --> 00:52:12,340 for questions. 1045 00:52:12,660 --> 00:52:14,480 Um, I know that most people 1046 00:52:14,480 --> 00:52:16,460 don't see the lower part of the screen, but 1047 00:52:16,460 --> 00:52:18,380 this is something they just got in Germany 1048 00:52:18,560 --> 00:52:20,380 out with the advertisements, and I 1049 00:52:20,380 --> 00:52:21,920 thought, we're gonna change that a bit. 1050 00:52:22,920 --> 00:52:24,080 And, thanks very much.