1 00:00:00,000 --> 00:00:02,660 Let's start off with the most common question I get. 2 00:00:02,740 --> 00:00:04,540 Why is all your work Cisco-centric? 3 00:00:04,860 --> 00:00:08,460 Well, they do have quite some market share. 4 00:00:09,060 --> 00:00:12,660 92% of all routers above $1,500, 5 00:00:13,140 --> 00:00:15,720 which I think nowadays is about like 500 euros, 6 00:00:16,920 --> 00:00:18,720 is actually Cisco equipment. 7 00:00:20,360 --> 00:00:23,000 And the other stuff in this area, like Juniper, 8 00:00:23,240 --> 00:00:24,860 like from a hacker perspective, 9 00:00:25,200 --> 00:00:27,920 Juniper is just like a really fucked up free BSD. 10 00:00:27,920 --> 00:00:31,240 So there is actually nothing interesting about it, 11 00:00:31,900 --> 00:00:33,360 neither from an exploitation 12 00:00:33,360 --> 00:00:36,400 nor from a forensics point of view. 13 00:00:37,120 --> 00:00:38,580 The same actually holds true 14 00:00:38,580 --> 00:00:40,560 for your arbitrary cheap home router 15 00:00:40,560 --> 00:00:43,400 because if you actually get off 16 00:00:43,400 --> 00:00:47,200 and unscrew the device and look at it 17 00:00:47,200 --> 00:00:49,440 and find out what it is, it is all Linux. 18 00:00:50,200 --> 00:00:53,680 So this is why I keep doing Cisco stuff. 19 00:00:55,980 --> 00:00:57,900 So why the hackers? 20 00:00:57,920 --> 00:01:00,860 Actually, we actually do network equipment forensics. 21 00:01:01,360 --> 00:01:04,700 By definition, the goal of the whole forensics deal 22 00:01:04,700 --> 00:01:07,760 is to explain the current state of a device, 23 00:01:08,560 --> 00:01:10,460 which means we acquire evidence, 24 00:01:10,780 --> 00:01:12,700 we recover information from the evidence 25 00:01:12,700 --> 00:01:14,880 because the evidence is actually going to be raw data, 26 00:01:15,600 --> 00:01:18,760 and then we actually do some analysis on this information 27 00:01:18,760 --> 00:01:20,900 and find out what actually happened. 28 00:01:21,460 --> 00:01:23,080 For common operating systems, 29 00:01:23,820 --> 00:01:26,040 methods and tools actually exist. 30 00:01:26,320 --> 00:01:27,700 So if you own a Windows, 31 00:01:27,700 --> 00:01:32,380 some certified forensics dude is going to take this apart 32 00:01:32,380 --> 00:01:35,260 and find out who you are and then bust you. 33 00:01:36,000 --> 00:01:39,100 For network equipment, there is nothing of this. 34 00:01:39,420 --> 00:01:41,420 We don't have a way to tell 35 00:01:41,420 --> 00:01:46,620 if a Cisco box actually crashed because it felt like it, 36 00:01:46,700 --> 00:01:47,480 which they do a lot, 37 00:01:47,660 --> 00:01:49,820 or if it actually crashed 38 00:01:49,820 --> 00:01:52,720 because some dude tried a buffer overflow attack on it. 39 00:01:55,380 --> 00:01:57,600 This is the most, like, 40 00:01:57,700 --> 00:02:00,180 frequent-asked question that I get 41 00:02:00,800 --> 00:02:02,820 since, I would say, about eight years. 42 00:02:03,220 --> 00:02:05,840 People go, like, this is all cool and stuff, 43 00:02:06,040 --> 00:02:08,240 but, like, who the fuck would hack a router? 44 00:02:08,620 --> 00:02:10,720 Like, why would you actually do this? 45 00:02:10,800 --> 00:02:11,880 There is no porn on it. 46 00:02:15,460 --> 00:02:17,820 So this is my reasoning for this. 47 00:02:17,920 --> 00:02:20,140 Like, if you compromise a single machine, 48 00:02:20,620 --> 00:02:22,900 you get all the porn that's on a single machine. 49 00:02:23,760 --> 00:02:26,260 If you compromise an important machine, 50 00:02:26,480 --> 00:02:26,980 you get... 51 00:02:27,700 --> 00:02:28,400 porn on this machine 52 00:02:28,400 --> 00:02:30,440 and, like, all the others that trust this machine. 53 00:02:31,080 --> 00:02:32,860 If you compromise the switch 54 00:02:33,540 --> 00:02:35,240 that connects those machines, 55 00:02:35,940 --> 00:02:37,100 like a workgroup switch, 56 00:02:37,400 --> 00:02:38,580 you can actually, like, 57 00:02:38,600 --> 00:02:40,560 make those people watch different porn 58 00:02:40,560 --> 00:02:41,520 than they wanted to watch. 59 00:02:42,500 --> 00:02:44,880 And it's really hard for them to tell why. 60 00:02:46,620 --> 00:02:48,900 And if you actually compromise the router, 61 00:02:49,060 --> 00:02:50,660 then you own the entire network 62 00:02:50,660 --> 00:02:52,340 and you can essentially, like, 63 00:02:52,380 --> 00:02:53,640 stream your porn everywhere you want. 64 00:02:56,480 --> 00:02:57,400 And, yeah. 65 00:02:57,700 --> 00:03:00,680 I'm inspired by the buzzword survivor. 66 00:03:01,040 --> 00:03:04,060 Here's some, like, PowerPoint buzzword pictures. 67 00:03:04,380 --> 00:03:08,020 So just to explain that to the really slow people of you. 68 00:03:10,580 --> 00:03:14,780 If you own a single system in today's networks, 69 00:03:14,920 --> 00:03:18,380 that actually does not give you a significant advantage. 70 00:03:18,620 --> 00:03:20,440 It certainly does give you an advantage, 71 00:03:20,600 --> 00:03:22,280 but it doesn't give you a significant advantage. 72 00:03:22,640 --> 00:03:25,120 So from the attacker point of view, 73 00:03:25,220 --> 00:03:27,420 owning a single system actually 74 00:03:27,420 --> 00:03:30,320 doesn't get you higher chances 75 00:03:30,320 --> 00:03:32,600 to get into the other systems next to it 76 00:03:32,600 --> 00:03:34,780 because the switch is going to block things 77 00:03:34,780 --> 00:03:36,180 like your op games and stuff. 78 00:03:38,560 --> 00:03:40,940 However, if you're actually owning the switch, 79 00:03:42,000 --> 00:03:43,800 all the separation is broken. 80 00:03:44,040 --> 00:03:46,980 You get to modify their communication streams 81 00:03:47,700 --> 00:03:51,220 and it's actually really hard to recognize from the host. 82 00:03:51,440 --> 00:03:53,080 Like, try to find out, connect to a switch 83 00:03:53,080 --> 00:03:54,520 anywhere in the world 84 00:03:54,520 --> 00:03:57,180 and then try to find out if this switch is compromised. 85 00:03:57,420 --> 00:04:00,160 There just is no reverse neck, 86 00:04:00,360 --> 00:04:01,720 like, network access control. 87 00:04:02,180 --> 00:04:05,080 Like, the network is trying to access control you, 88 00:04:05,220 --> 00:04:07,100 but there is actually no way for you telling 89 00:04:07,100 --> 00:04:09,160 if the network is fucked up or not. 90 00:04:11,540 --> 00:04:14,020 And, of course, if you actually own the router, 91 00:04:15,150 --> 00:04:18,300 that means you have control over the entire network 92 00:04:18,300 --> 00:04:20,720 and you can actually, like, add a bonus, 93 00:04:20,820 --> 00:04:23,420 impersonate this network to the internet. 94 00:04:23,800 --> 00:04:25,320 All right. 95 00:04:26,400 --> 00:04:26,980 So, 96 00:04:27,420 --> 00:04:29,500 I wanted to do a slide on, like, 97 00:04:29,500 --> 00:04:30,640 how this looks in the internet, 98 00:04:30,840 --> 00:04:33,680 but there's just way fucking too many routers in the internet. 99 00:04:34,580 --> 00:04:36,080 So, that doesn't work. 100 00:04:37,720 --> 00:04:41,000 So, we're back to, like, Cisco-style 101 00:04:41,840 --> 00:04:43,680 corporate network graphics. 102 00:04:44,440 --> 00:04:47,580 So, this is what a regular network looks like. 103 00:04:47,780 --> 00:04:49,680 Raise your hand if you have ever heard 104 00:04:49,680 --> 00:04:53,420 the term autonomous system in terms of routing. 105 00:04:55,000 --> 00:04:55,520 Ah! 106 00:04:56,020 --> 00:04:57,240 That actually improved. 107 00:04:59,240 --> 00:05:01,140 Good you guys are learning shit. 108 00:05:02,400 --> 00:05:05,440 So, what I'm trying to show here is, like, 109 00:05:05,440 --> 00:05:07,920 multiple autonomous systems connected together 110 00:05:07,920 --> 00:05:11,540 with a core network and then having, like, 111 00:05:11,620 --> 00:05:14,020 you know, government and, like, business and shit. 112 00:05:15,080 --> 00:05:19,460 To your top right, if you have seen other presentations 113 00:05:20,060 --> 00:05:21,880 from me, you know this. 114 00:05:22,080 --> 00:05:24,960 It's the international ASCII symbol of an asshole. 115 00:05:25,500 --> 00:05:25,790 Um. 116 00:05:27,420 --> 00:05:29,140 So, he's going to try to fuck with the network. 117 00:05:31,900 --> 00:05:34,020 The thing about those networks is this. 118 00:05:34,800 --> 00:05:40,360 On the border of the local network to the actual large parts, 119 00:05:40,520 --> 00:05:44,540 to the actual autonomous systems, we do have firewalls. 120 00:05:44,580 --> 00:05:46,940 We do actually have IDS, IPS. 121 00:05:47,420 --> 00:05:50,120 It's not like anyone is watching them, but we do have them. 122 00:05:51,320 --> 00:05:55,360 And whatever your silver bullet for security of the day is. 123 00:05:55,620 --> 00:05:55,920 . 124 00:05:56,840 --> 00:05:57,400 . 125 00:05:57,420 --> 00:06:04,380 You look further into the core, you actually have routers that border the different autonomous 126 00:06:04,380 --> 00:06:04,940 systems. 127 00:06:05,420 --> 00:06:07,060 They do the route distribution. 128 00:06:07,560 --> 00:06:11,600 They care about your local network talking to the core and stuff. 129 00:06:12,000 --> 00:06:13,780 They have ingress and egress filtering. 130 00:06:14,380 --> 00:06:16,620 They do anti-spoofing. 131 00:06:16,800 --> 00:06:24,400 They actually try to keep that core clean and try to prevent the asshole from injecting 132 00:06:24,400 --> 00:06:26,540 an evil routing message into the core. 133 00:06:27,720 --> 00:06:31,680 However, in the core, we actually do have full trust. 134 00:06:32,120 --> 00:06:35,240 This is because it wouldn't work otherwise. 135 00:06:36,020 --> 00:06:42,520 This core is actually exchanging information about the routing tables and about how the 136 00:06:42,520 --> 00:06:45,340 network is supposed to behave with each other. 137 00:06:45,480 --> 00:06:50,180 There is no other choice for the routers than to trust each other. 138 00:06:50,380 --> 00:06:51,880 There is no other way to do it. 139 00:06:53,900 --> 00:06:58,900 That means network security is actually a hierarchical thing. 140 00:06:59,600 --> 00:07:03,960 Defending against your downstream is a very common thing, otherwise all the ISPs would 141 00:07:03,960 --> 00:07:07,440 get owned by you guys with the DSL or cable modems all the time. 142 00:07:07,920 --> 00:07:10,640 They do not accept routing updates. 143 00:07:10,840 --> 00:07:18,340 They do not accept route advertisements for the 192.168 network from your fucking DSL 144 00:07:18,340 --> 00:07:18,640 connection. 145 00:07:19,420 --> 00:07:20,060 However. 146 00:07:20,060 --> 00:07:24,020 The other way around, upstream, is really, really bad. 147 00:07:24,300 --> 00:07:25,500 I mean, what are you going to do? 148 00:07:25,700 --> 00:07:30,420 If your upstream provider says the internet just moved, you have two choices. 149 00:07:30,660 --> 00:07:35,260 Either accept that message and go along with it, or have no internet. 150 00:07:36,500 --> 00:07:41,340 Defending against your peers in those networks is also very, very rare and common. 151 00:07:41,420 --> 00:07:46,140 As I said, it's really hard because you actually have to trust them, otherwise the shit is 152 00:07:46,140 --> 00:07:46,660 not going to work. 153 00:07:48,140 --> 00:07:49,720 If you control anything. 154 00:07:50,060 --> 00:07:50,700 Everything in this hierarchy. 155 00:07:51,120 --> 00:07:53,100 You control everything below. 156 00:07:53,840 --> 00:07:59,900 That means if you control anything in this core, then you control everything around it. 157 00:08:01,280 --> 00:08:06,640 Let's assume our little guy up there compromises this one router. 158 00:08:06,960 --> 00:08:13,460 He gets to actually have a say in the autonomous system to the top right. 159 00:08:14,000 --> 00:08:19,040 If he actually compromises another router, just like one other router that happens to 160 00:08:19,040 --> 00:08:24,060 be peer to the core, he actually does compromise the entire network. 161 00:08:27,400 --> 00:08:32,880 Some of you might actually say, yeah, this is all cool, but I got SSL, and I got my 162 00:08:32,880 --> 00:08:37,280 Debianized keys, and I got SSH, and secure whatnot. 163 00:08:39,280 --> 00:08:40,540 The thing is this. 164 00:08:41,440 --> 00:08:43,200 Those protocols actually work. 165 00:08:43,560 --> 00:08:48,400 There are people with actual brains compared to me that actually work on those protocols. 166 00:08:48,400 --> 00:08:56,260 However, they can only guarantee that your protocol messages are not modified, they're 167 00:08:56,260 --> 00:09:00,020 not fucked with, they're not spoofed, and they're not replayed. 168 00:09:00,860 --> 00:09:07,020 However, if anyone is actually going to do exactly that, if anyone is fucking with your 169 00:09:07,020 --> 00:09:08,660 protocol, what are you going to do? 170 00:09:09,460 --> 00:09:11,080 What are your options? 171 00:09:11,660 --> 00:09:12,900 Your SSL breaks? 172 00:09:13,120 --> 00:09:14,320 Your SSL doesn't work anymore? 173 00:09:14,440 --> 00:09:16,700 Your SSL bitch is about someone doing man in the middle? 174 00:09:17,780 --> 00:09:18,380 Yeah, but... 175 00:09:18,380 --> 00:09:18,540 Yeah, right. 176 00:09:18,640 --> 00:09:23,700 You know that now, but you can't actually get where you want it to go with the SSL connection. 177 00:09:24,640 --> 00:09:30,560 At some point in time, if someone compromises the network, the question becomes availability 178 00:09:31,050 --> 00:09:33,160 or security, one of the two. 179 00:09:33,600 --> 00:09:39,640 If your home banking doesn't work for about a week, then your choice is get off your lazy 180 00:09:39,640 --> 00:09:46,120 ass and actually walk up to the bank and do the transaction manually, or seriously, most 181 00:09:46,120 --> 00:09:48,020 people are going to click on fuck it. 182 00:09:48,020 --> 00:09:54,800 Even if they know, because they don't feel like leaving the room, and they will miss 183 00:09:54,800 --> 00:09:57,100 the next episode of, like, ooh, my bots. 184 00:09:58,820 --> 00:10:00,880 This is actually what happens. 185 00:10:01,180 --> 00:10:05,680 In a business context, this is actually worse, because there is nothing to click on. 186 00:10:05,740 --> 00:10:06,860 Those are automated systems. 187 00:10:07,460 --> 00:10:14,720 At some point, they will simply turn off all certificate validation, because they need 188 00:10:14,720 --> 00:10:15,280 to keep running. 189 00:10:17,840 --> 00:10:25,360 The reason for that is, if the user detects someone, like, fucking in the network, if 190 00:10:25,360 --> 00:10:30,500 he actually called choose a different traffic path, that is what we call source routing. 191 00:10:31,360 --> 00:10:32,680 That is actually... 192 00:10:32,680 --> 00:10:37,360 There is a very good reason this is not in the internet anymore, because that would mean 193 00:10:37,360 --> 00:10:39,140 the user has control over the network. 194 00:10:39,420 --> 00:10:45,040 The user can decide where the actual protocol messages go, what path they take, and this 195 00:10:45,280 --> 00:10:46,700 is really, really bad for networks. 196 00:10:47,040 --> 00:10:52,980 We turned that off about 30 years ago on the internet, so that doesn't work. 197 00:10:55,120 --> 00:11:00,980 What I'm trying to say with all those ramblings here is, all this is actually by design. 198 00:11:02,000 --> 00:11:09,940 IP by design has dumb leaf nodes, like stupid end users, and intelligent core nodes. 199 00:11:10,580 --> 00:11:13,580 If you compromise an intelligent core node... 200 00:11:13,580 --> 00:11:15,260 You actually... 201 00:11:15,260 --> 00:11:17,160 You actually compromise the entire network. 202 00:11:17,420 --> 00:11:18,400 This is by design. 203 00:11:18,540 --> 00:11:19,720 We can't do shit about this. 204 00:11:20,460 --> 00:11:23,600 This is why we try to do network equipment forensics. 205 00:11:23,740 --> 00:11:24,400 Does that make sense? 206 00:11:25,420 --> 00:11:25,860 Good. 207 00:11:27,760 --> 00:11:29,620 What types of attacks do we have? 208 00:11:29,800 --> 00:11:35,140 When we want to do forensics, we can do forensics the way that the certified forensics expert 209 00:11:35,140 --> 00:11:39,200 do it, or we can actually care about what we're trying to detect first. 210 00:11:40,820 --> 00:11:42,740 We're going to take the second route. 211 00:11:44,540 --> 00:11:45,240 This is... 212 00:11:45,240 --> 00:11:47,920 This is essentially the three classes you can do to a router. 213 00:11:48,220 --> 00:11:50,160 You can have protocol-based attacks. 214 00:11:50,900 --> 00:11:57,060 You can actually have attacks on the functionality point, or you can have binary exploitation. 215 00:11:59,420 --> 00:12:00,900 Protocol-based attacks. 216 00:12:01,200 --> 00:12:06,900 I've given my very first talk here at DEF CON, DEF CON 9, on protocol-based attacks. 217 00:12:08,860 --> 00:12:12,600 Essentially the whole idea is you inject control messages into the network. 218 00:12:12,880 --> 00:12:13,440 Like... 219 00:12:13,440 --> 00:12:18,080 You participate in a routing protocol, for example, and you tell the network that the 220 00:12:18,080 --> 00:12:19,680 routing should be different now. 221 00:12:20,040 --> 00:12:23,580 Let's say it goes over your machine, and you can inject your gate point. 222 00:12:25,040 --> 00:12:28,960 The attacker just becomes part of the normal network communication. 223 00:12:32,400 --> 00:12:42,840 Typical examples of that type include well-known things, R poisoning, Kaminsky DNS games, interior 224 00:12:42,840 --> 00:12:43,420 routing, etc. 225 00:12:43,440 --> 00:12:48,800 You just be part of an OSPF cloud and announce your routes. 226 00:12:49,540 --> 00:12:53,400 Or exterior routing, hijacking BGP. 227 00:12:53,480 --> 00:12:54,560 There's very good talk. 228 00:12:55,060 --> 00:12:58,040 This is the speaker over there, standing, wave. 229 00:12:58,420 --> 00:13:00,060 There's very good talk on Sunday. 230 00:13:00,140 --> 00:13:04,800 If you actually want to watch someone who knows really what happens with Cisco, go to 231 00:13:04,800 --> 00:13:05,260 his talk. 232 00:13:07,320 --> 00:13:08,900 You are in the wrong talk. 233 00:13:09,060 --> 00:13:09,660 That's what I'm saying. 234 00:13:12,640 --> 00:13:13,200 So... 235 00:13:13,200 --> 00:13:13,420 I'm sorry. 236 00:13:13,440 --> 00:13:17,980 On the functionality side, we actually do see a lot of configuration-based problems. 237 00:13:19,080 --> 00:13:20,280 The people... 238 00:13:20,280 --> 00:13:21,420 You have to realize this. 239 00:13:21,600 --> 00:13:24,600 Anyone here has a CCIE certification? 240 00:13:25,920 --> 00:13:27,780 Raise your hand if you're a CCIE. 241 00:13:27,920 --> 00:13:28,700 There are two. 242 00:13:29,180 --> 00:13:31,640 Have they taught you to change passwords? 243 00:13:34,760 --> 00:13:39,660 You study for two years, lab exam, and then all the lab has Cisco as a password? 244 00:13:40,880 --> 00:13:43,200 Cisco actually teaches people... 245 00:13:43,200 --> 00:13:44,920 to have Cisco as a password. 246 00:13:45,740 --> 00:13:46,980 Even the highest qualified. 247 00:13:48,420 --> 00:13:52,420 Which is really bad, because some people actually don't realize that in the real world they 248 00:13:52,420 --> 00:13:54,580 should not use Cisco as a password. 249 00:13:55,040 --> 00:13:57,900 So you still find a lot of routers with that problem. 250 00:13:59,800 --> 00:14:03,440 Then we have weak SNMP communities, which pretty much is the same thing. 251 00:14:03,820 --> 00:14:08,500 And we have people posting their configurations on the internet forums, because they can't 252 00:14:08,500 --> 00:14:09,540 figure the shit out themselves. 253 00:14:09,880 --> 00:14:12,140 And then someone else goes and decodes their passwords. 254 00:14:13,740 --> 00:14:19,480 We also have access check vulnerabilities, which fall into the same class for me. 255 00:14:20,180 --> 00:14:26,040 There is the Cisco HTTP vulnerability from like six years back, and you still see people 256 00:14:26,040 --> 00:14:27,040 scanning for this. 257 00:14:27,300 --> 00:14:31,280 People actually scan for Cisco routers that have that vulnerability. 258 00:14:32,120 --> 00:14:33,400 The thing is this. 259 00:14:33,900 --> 00:14:37,780 Blackheads are actually really good at telling you what actually works. 260 00:14:38,100 --> 00:14:42,120 So if people are still scanning for it, it means they actually find stuff. 261 00:14:42,120 --> 00:14:45,780 stuff. They wouldn't scan for stuff that's patched 262 00:14:45,780 --> 00:14:51,100 all over the Internet. Then we have the most beautiful vulnerability 263 00:14:51,100 --> 00:14:56,820 from my point of view, because I'm more of a router guy, the SNMPv3 vulnerability. 264 00:14:58,740 --> 00:15:04,520 Most people have actually not noticed it in all the noise that other vulnerabilities made 265 00:15:04,520 --> 00:15:10,600 this year. Here's the deal. SNMP is the absolute standard 266 00:15:10,600 --> 00:15:14,760 in how to manage routers. People do not use anything else. 267 00:15:15,800 --> 00:15:24,240 The thing is, SNMPv3 means version 3. The entire reason for this version actually 268 00:15:24,240 --> 00:15:30,300 was that in version 1 and 2, everyone was sending a cleartax password called the community 269 00:15:30,300 --> 00:15:33,920 string over the network, and so it was really easy 270 00:15:33,920 --> 00:15:34,340 to ... 271 00:15:34,340 --> 00:15:36,880 You sniff this off the network, and then own all the routers. 272 00:15:37,860 --> 00:15:48,380 In v3, they actually introduced crypto. I'm not making enough sense, so I'm drinking 273 00:15:48,380 --> 00:15:53,980 beer. They introduced crypto, and we all know crypto, 274 00:15:54,100 --> 00:15:56,980 hey, right? You put it in, it's all good. Civil bullet. 275 00:15:58,460 --> 00:16:03,660 Actually not. Then SNMP, the people who designed SNMP are 276 00:16:03,660 --> 00:16:08,960 the same people that tried to carve off single bits of messages, and then instead of putting 277 00:16:08,960 --> 00:16:15,520 a message plain into a packet, they invented ASN1, and everyone gets owned because nobody 278 00:16:15,520 --> 00:16:19,480 actually managed to implement that correctly, and nobody told them that there are actually 279 00:16:19,480 --> 00:16:24,420 compilers for ASN1. We end up having the same people think, hmm, 280 00:16:24,740 --> 00:16:30,340 we have a new authentication mechanism, but HMACs, cryptographic hashes, keyed hashes 281 00:16:30,340 --> 00:16:33,640 with a secret, this is what they use. HMACs, they're really good at this. They're really 282 00:16:33,640 --> 00:16:38,080 long, like 160 bits. Wow, that's saturated our network. 283 00:16:39,080 --> 00:16:42,420 Let's go talk to the crypto guys and see if we can make this a bit smarter. 284 00:16:42,980 --> 00:16:46,640 What they actually did was they talked to the crypto guys, and the crypto guys told 285 00:16:46,640 --> 00:16:52,760 them from a theoretical point of view, taking half of the hash is actually as much proof 286 00:16:52,760 --> 00:16:57,140 as taking the full hash. You can talk to Bruins over here, the guy 287 00:16:57,140 --> 00:16:59,880 with the yellow shirt, if you don't understand why that is correct. 288 00:17:01,520 --> 00:17:02,920 The thing is this. 289 00:17:03,640 --> 00:17:06,600 They thought, okay, we can take half of the hash. That's really cool. 290 00:17:06,820 --> 00:17:12,180 Now let's make this dynamic, and let's specify that we can actually take an arbitrary subset 291 00:17:12,180 --> 00:17:17,240 of the hash in a packet for authentication. What people implement is they do a memcompare 292 00:17:17,240 --> 00:17:22,220 between the hash they have on the router, the hash they get in a packet, and the length 293 00:17:22,220 --> 00:17:25,140 that was advertised in a packet. Does anyone see a problem here? 294 00:17:26,800 --> 00:17:33,340 If you advertise a length of one, you actually do have 256 tries. 295 00:17:33,640 --> 00:17:34,240 You have a lot of time to do that. You have a lot of time to do that until you 296 00:17:34,240 --> 00:17:39,440 own the router. It actually took several years for people 297 00:17:39,440 --> 00:17:46,440 to realize that. The net SNMP guys, the guys who write the 298 00:17:46,440 --> 00:17:49,960 open source version said, oops, we kind of barfed up here. 299 00:17:50,260 --> 00:17:57,300 They went to CERN and said, sorry, if you're running net SNMP, please patch. 300 00:17:57,840 --> 00:18:02,460 And then all the vendors crawl out of their holes and go like, yeah, we copied that code. 301 00:18:03,640 --> 00:18:06,500 This is like the biggest vulnerability in network terms 302 00:18:06,500 --> 00:18:08,280 that we had for many, many years. 303 00:18:08,480 --> 00:18:11,280 Added bonus, all lawful interception equipment 304 00:18:11,280 --> 00:18:13,140 is controlled by SNMPv3. 305 00:18:13,400 --> 00:18:15,560 I leave it up to the audience as a home exercise 306 00:18:15,560 --> 00:18:17,960 to become a lawful entity in your country. 307 00:18:22,780 --> 00:18:26,900 We do actually have routers that do SSH, 308 00:18:27,040 --> 00:18:29,140 and we do actually have routers that do SSH 309 00:18:29,140 --> 00:18:30,140 with Debianized keys. 310 00:18:30,140 --> 00:18:34,220 So that's also a way to get on your router. 311 00:18:34,400 --> 00:18:37,680 Then there is another bug class that I call the queuing bugs. 312 00:18:38,320 --> 00:18:42,380 They essentially, well, the reason they exist 313 00:18:42,380 --> 00:18:44,760 is because Cisco doesn't know software architecture, 314 00:18:44,980 --> 00:18:45,940 but we knew that. 315 00:18:47,240 --> 00:18:49,200 Essentially the problem is you have a router 316 00:18:49,200 --> 00:18:51,460 and interfaces have queues. 317 00:18:51,480 --> 00:18:53,140 Like when packets come in, they get queued up. 318 00:18:53,340 --> 00:18:55,160 And then someone has to take the packet 319 00:18:55,160 --> 00:18:57,320 and say I'm responsible for it, I'm gonna process it, 320 00:18:57,380 --> 00:18:58,180 I take it off the queue. 321 00:18:58,580 --> 00:18:59,980 If nobody does that, 322 00:19:00,140 --> 00:19:01,480 the packet is stuck in the queue. 323 00:19:02,140 --> 00:19:04,300 And there is a bunch of those vulnerabilities, 324 00:19:04,480 --> 00:19:06,780 and they're coming out on a regular basis 325 00:19:06,780 --> 00:19:08,460 about every two years. 326 00:19:09,100 --> 00:19:12,480 Pretty much like a Rock Band's album's release cycle. 327 00:19:13,040 --> 00:19:16,860 So this means that the router actually has a full queue 328 00:19:16,860 --> 00:19:18,660 at some point in time and doesn't actually 329 00:19:18,660 --> 00:19:21,460 accept any traffic anymore, so it gets stuck. 330 00:19:21,680 --> 00:19:23,360 And we want to detect those as well. 331 00:19:24,400 --> 00:19:26,200 And then we have binary exploitation. 332 00:19:26,440 --> 00:19:29,660 And in contrast to common belief, 333 00:19:29,780 --> 00:19:30,120 we want to detect those as well. And then we have binary exploitation. 334 00:19:30,120 --> 00:19:33,020 There has been Cisco hacking and binary exploitation 335 00:19:33,020 --> 00:19:34,160 before Mike Lin. 336 00:19:35,660 --> 00:19:37,840 However, he actually did a really good job 337 00:19:37,840 --> 00:19:41,000 in bringing in the interactive shell. 338 00:19:41,480 --> 00:19:43,960 So we do have binary exploits, 339 00:19:45,280 --> 00:19:47,460 which roughly fall into two classes. 340 00:19:47,720 --> 00:19:50,520 One is you attack a service that runs on the router. 341 00:19:50,760 --> 00:19:53,180 The router runs services like every other computer 342 00:19:53,180 --> 00:19:54,040 on the internet does. 343 00:19:55,120 --> 00:19:57,080 And you can attack those services. 344 00:19:57,300 --> 00:19:59,820 So as you see with the protocols, it's like, 345 00:19:59,820 --> 00:20:01,720 HTTP, FTP, and stuff like that. 346 00:20:03,760 --> 00:20:06,260 However, people that are actually a little bit smart 347 00:20:06,260 --> 00:20:09,140 about their routers, they don't have an HTTP server 348 00:20:09,140 --> 00:20:09,820 running on it. 349 00:20:11,360 --> 00:20:14,080 So there are other attacks, stuff that routers 350 00:20:14,080 --> 00:20:18,540 actually have to do, like OSPF, or IPv6, or something. 351 00:20:18,680 --> 00:20:20,620 And there have been remote exploits for that. 352 00:20:22,640 --> 00:20:23,120 . 353 00:20:29,820 --> 00:20:34,020 So in today's networks, how are people are actually 354 00:20:34,020 --> 00:20:36,380 monitoring and detecting intrusion? 355 00:20:37,260 --> 00:20:37,820 If. 356 00:20:39,720 --> 00:20:40,840 Most don't. 357 00:20:40,980 --> 00:20:43,620 Most just like not look at their routers. 358 00:20:43,980 --> 00:20:48,260 The ones that do use SNMP, as I said, for the most part, 359 00:20:48,380 --> 00:20:52,320 SNMP, the very protocol that is just totally broken two slides 360 00:20:52,320 --> 00:20:56,320 ago, is the thing for managing routers. 361 00:20:56,540 --> 00:20:59,460 The problem here is, from a forensics point of view, 362 00:20:59,500 --> 00:20:59,800 the problem is, from a forensics point of view, 363 00:20:59,820 --> 00:21:06,580 snmp is built it's called network management protocol so it is built for managing the network 364 00:21:06,580 --> 00:21:10,880 aspect of it so it tells you about the routing tables op tables blah blah blah all that stuff 365 00:21:10,880 --> 00:21:15,060 it doesn't actually tell you if you have an additional process running on your router 366 00:21:16,320 --> 00:21:24,380 then we actually have syslog which turns out to be a really useful tool for detection of 367 00:21:24,380 --> 00:21:31,440 intrusion into routers because it supports freeform strings so the coder of some piece 368 00:21:31,440 --> 00:21:38,620 of code in Cisco can actually go and like block a simple like text string and if you configured 369 00:21:38,620 --> 00:21:44,020 SNMP if you configure it so it will actually take this text string and send it over to a 370 00:21:44,020 --> 00:21:50,180 central server so you actually have a record of what's going on then there's configuration 371 00:21:50,180 --> 00:21:53,960 polling in most cases people actually watch their 372 00:21:53,960 --> 00:21:54,120 and 373 00:21:54,380 --> 00:22:00,380 fix if they ever change so there's a cool cool tool called rancid that people actually 374 00:22:00,380 --> 00:22:06,040 use to monitor changes in the configuration because like you're coming to work in the 375 00:22:06,040 --> 00:22:13,140 morning and this tool is telling you someone kind of like reconfigured your routers that 376 00:22:13,140 --> 00:22:19,380 is a telltale that you know you actually shall change from the meetings you had with 377 00:22:19,380 --> 00:22:22,060 the marketing guys to actually like fixing your routers today 378 00:22:23,360 --> 00:22:24,000 um 379 00:22:24,380 --> 00:22:35,200 for the protocol based attacks people run route monitoring and looking glasses what that is is just like another machine usually a router or somebody else 380 00:22:35,200 --> 00:22:44,280 debauched that participates in the routing protocol and just checks if the routes actually change in an unforeseen way the idea is pretty 381 00:22:44,280 --> 00:22:54,020 much the same as with a conflict polling and then we have a very surprising thing that we can use for forensics which is traffic accounting the thing is there's nobody 382 00:22:54,020 --> 00:22:59,340 Nobody actually watches their network closely enough to do any forensics or to actually 383 00:22:59,340 --> 00:23:04,040 see if the router gets owned or if someone does any mischief. 384 00:23:04,500 --> 00:23:10,680 However, they all do traffic accounting, and they all are really, really keen about not 385 00:23:11,660 --> 00:23:16,300 losing information who sent what traffic. The reason being, that's what they are paid 386 00:23:16,300 --> 00:23:20,300 for. This is what they use to charge you for the 387 00:23:20,300 --> 00:23:24,980 traffic. There is actually an interest in not losing 388 00:23:24,980 --> 00:23:29,680 this data, and there is actually an interest in making sure that nobody fucks with it. 389 00:23:30,320 --> 00:23:35,440 It turns out to be a really valuable source for forensics, because it's pretty much the 390 00:23:35,440 --> 00:23:39,500 only non-compromised central locked data that we have in networks. 391 00:23:42,500 --> 00:23:50,260 Take a table and see what of the attacks can we actually detect with the monitoring that 392 00:23:50,300 --> 00:23:54,620 we have in today's networks. Here's my virus scanner. 393 00:23:55,340 --> 00:24:01,420 Hands for my NOT32 virus scanner actually trying to update on the DEF CON network. 394 00:24:02,140 --> 00:24:13,840 That is so not smart. However, this is what kill switches are for. 395 00:24:15,120 --> 00:24:19,780 If you look at this table, you actually see them. 396 00:24:19,780 --> 00:24:24,920 In the bottom line, if you do binary exploitation, we don't see shit. 397 00:24:25,180 --> 00:24:31,100 We have no idea if it actually happened, unless the attacker was really, really stupid and 398 00:24:31,100 --> 00:24:34,920 wrote the configuration, because then we can get them with config polling. 399 00:24:40,120 --> 00:24:45,180 We're actually concentrating on this. What do binary exploits do? 400 00:24:45,600 --> 00:24:49,080 What are we trying to detect? What happens if the binary exploit actually 401 00:24:49,080 --> 00:24:53,480 worked? We're not going to detect the return address 402 00:24:53,480 --> 00:24:56,020 overwrite and then jump into some arbitrary code. 403 00:24:57,020 --> 00:25:03,280 We are going to detect what's happening afterwards, so we should care about what is happening 404 00:25:03,280 --> 00:25:08,200 afterwards. We do have this one type of attack that 405 00:25:08,940 --> 00:25:11,840 people use. There was actually a black hat talk on this, 406 00:25:12,660 --> 00:25:15,680 which is the binary modification of the runtime image. 407 00:25:15,860 --> 00:25:18,660 Essentially, you patch away user credential checking. 408 00:25:18,660 --> 00:25:21,760 or, essentially, you backdoor the router. 409 00:25:22,280 --> 00:25:27,900 You also, and that was not covered, you patch away logging. 410 00:25:28,740 --> 00:25:34,500 What is the point of patching away the user access credential checking when the log messages 411 00:25:34,500 --> 00:25:40,280 go to a central point and say, here's user FX logging into your central Cisco machine? 412 00:25:41,160 --> 00:25:43,680 You actually do patch logging as well. 413 00:25:43,680 --> 00:25:49,760 When you think about what goals people would have when they own the router, they will actually 414 00:25:49,760 --> 00:25:50,980 patch firewall functionality. 415 00:25:51,800 --> 00:25:56,320 They will actually make sure that your ACLs look really, really good, but they actually 416 00:25:56,320 --> 00:25:56,940 don't work. 417 00:25:58,920 --> 00:26:01,900 What also is done is data structure patching. 418 00:26:02,100 --> 00:26:09,580 You go ahead and you patch the access level of a VTY, which is virtual terminals, Cisco 419 00:26:09,580 --> 00:26:13,360 speech in we don't know how to implement ASF spawning telnet. 420 00:26:13,360 --> 00:26:21,460 You actually check those access credentials and patch the check out or set the privilege 421 00:26:21,460 --> 00:26:23,580 level to an already high value. 422 00:26:24,420 --> 00:26:31,480 You can bind additional VTYs, which is essentially like a port binding shellcode, or you just 423 00:26:31,480 --> 00:26:32,960 go ahead and terminate processes. 424 00:26:33,520 --> 00:26:38,220 There is a lot of annoying stuff running on a router that you don't want anymore once 425 00:26:38,220 --> 00:26:39,940 you own it, so you just terminate the processes. 426 00:26:40,160 --> 00:26:41,660 We need to detect that. 427 00:26:41,820 --> 00:26:42,480 We need to detect that. 428 00:26:42,480 --> 00:26:42,880 We need to detect that. 429 00:26:42,880 --> 00:26:45,800 You can change the configuration in runtime. 430 00:26:46,640 --> 00:26:49,160 You can change state machines. 431 00:26:50,760 --> 00:26:56,940 That is actually very, very powerful because it's really hard to detect, but actually so 432 00:26:56,940 --> 00:26:58,100 far nobody has done that. 433 00:26:58,320 --> 00:27:02,600 What has been done widely is TCL backdooring of routers. 434 00:27:03,800 --> 00:27:09,960 Mostly so far it has been done by people that worked for an ISP and then at some point didn't 435 00:27:09,960 --> 00:27:12,640 anymore but didn't want to lose their exclusivity. 436 00:27:12,640 --> 00:27:12,880 They can use that as anücken, and they've also done a lot of stuff in the context of 437 00:27:12,880 --> 00:27:13,240 It's a fairly exclusive access. 438 00:27:15,040 --> 00:27:21,260 The IOS in later versions has TCL script interpreters. 439 00:27:21,880 --> 00:27:26,500 Don't actually ask me why they use TCL, of all things. 440 00:27:26,500 --> 00:27:30,300 links. They do actually have TCL scripts. 441 00:27:30,760 --> 00:27:34,420 They do actually have the ability to bind to a TCP port. 442 00:27:34,860 --> 00:27:40,980 You can have a really, really short port binding shellcode in TCL and just run it. 443 00:27:41,460 --> 00:27:44,160 Of course, they implemented a new feature. They fucked it up badly. 444 00:27:44,740 --> 00:27:49,780 There is a large range of iOS versions where you can actually have your TCL script running 445 00:27:49,780 --> 00:27:55,400 in your authenticated context, and once you log out, the script keeps running with your 446 00:27:55,400 --> 00:28:02,720 former privileges. What we need for the forensics, what we need 447 00:28:02,720 --> 00:28:07,800 for finding all this is, as I said in the beginning, evidence acquisition. 448 00:28:08,060 --> 00:28:12,140 We need to recover information, and we need to analyze this information. 449 00:28:12,720 --> 00:28:15,860 By the way, it would actually not hurt to know how iOS works internally. 450 00:28:18,340 --> 00:28:22,020 Let's do that. What types of memory do we actually have 451 00:28:22,020 --> 00:28:23,100 in such a Cisco device? 452 00:28:25,140 --> 00:28:29,120 That's important for forensics, because we want to know how to get this memory. 453 00:28:30,280 --> 00:28:34,860 In general, how does that work? Cisco device like 50,000-foot view. 454 00:28:35,200 --> 00:28:41,980 When it boots, there is a bios type of thing that's called rambon which is kicking off 455 00:28:41,980 --> 00:28:46,620 your iOS image. The image may or may not be self-decompressing, 456 00:28:47,220 --> 00:28:51,840 so we have to take into account that the image that's actually loaded is not the one that's 457 00:28:51,840 --> 00:28:53,080 running. We're trying to make it work, and we're looking for what's actually there. 458 00:28:53,100 --> 00:28:57,280 The image that gets loaded is unpacking the image that will run eventually. 459 00:28:57,900 --> 00:29:03,460 The image may and will, in most cases, contain firmware for additional hardware. 460 00:29:04,100 --> 00:29:13,240 They do piggy-pack the bytecode for the ISDN controllers or what other line cards you have. 461 00:29:13,340 --> 00:29:16,440 They are actually in the iOS image. They are piggy-packed in there. 462 00:29:17,760 --> 00:29:22,920 The configuration is loaded as an ASCII text from NVRAM or from the network, which would 463 00:29:22,920 --> 00:29:25,320 be the most stupid thing to do, so we're not covering this. 464 00:29:27,120 --> 00:29:32,200 It is actually parsed on load. If the configuration is wrong, if it contains 465 00:29:32,740 --> 00:29:38,620 bullshit or if it contains weird statements that this version of iOS doesn't understand, 466 00:29:39,660 --> 00:29:46,380 the way they solve this is they actually parse it as if you were hacking it into the router 467 00:29:46,380 --> 00:29:50,640 every time you boot it. You can actually have a pretty fucked up 468 00:29:50,640 --> 00:29:56,000 configuration and still a working router. The statements in the configuration are going 469 00:29:56,000 --> 00:30:03,340 to be mixed with defaults of the iOS image. If you are not explicitly configuring a certain 470 00:30:03,340 --> 00:30:07,180 feature, it will default. The problem is, it will actually default 471 00:30:07,180 --> 00:30:09,740 to whatever it feels like in this version of iOS. 472 00:30:10,380 --> 00:30:15,040 This is not a consistent thing. The same configuration on two machines with 473 00:30:15,040 --> 00:30:16,360 slightly different iOS WRK . . . . There are some things that are not consistent. 474 00:30:16,380 --> 00:30:19,300 version will actually produce a different state. 475 00:30:21,240 --> 00:30:26,020 Everything is kept in RAM, so we don't have a hard drive in there. 476 00:30:27,020 --> 00:30:33,400 The configuration changes have immediate effect, so there is no incentive for an attacker or 477 00:30:33,400 --> 00:30:37,060 a network administrator to actually write them back to NVRAM. 478 00:30:37,320 --> 00:30:44,200 This is the most common thing with networks when you have a power outage, because the 479 00:30:44,200 --> 00:30:47,920 guys just do not save the configuration back to NVRAM. 480 00:30:48,220 --> 00:30:54,380 Then when you have a power outage, they go like, fuck, so what did we change the last 481 00:30:54,380 --> 00:31:01,960 two years in this configuration? I mentioned everything is kept in RAM. 482 00:31:02,340 --> 00:31:08,080 We need to actually get to this. On common operating systems and in forensic 483 00:31:08,080 --> 00:31:13,320 scenarios, the volatile information is actually add-on. 484 00:31:13,340 --> 00:31:13,920 It's bonus. 485 00:31:14,200 --> 00:31:22,860 If you pull the power plug of your Unix, Windows, God beware, Mac OS machine, when 486 00:31:22,860 --> 00:31:27,200 the police is crashing in your door, that is not a problem. 487 00:31:27,460 --> 00:31:34,740 All the evidence is actually on the hard drive. The add-on bonus information of what is the 488 00:31:34,740 --> 00:31:40,220 runtime state of your machine would have been nice, and they could throw this whole 489 00:31:40,220 --> 00:31:44,100 machine into super cooling and pull the keys off and stuff. 490 00:31:44,100 --> 00:31:49,580 But in fact, that's actually not required. In fact, you're leaving so much evidence on 491 00:31:49,580 --> 00:31:52,060 the hard drive that it's actually not a big deal. 492 00:31:53,380 --> 00:31:59,240 With Cisco, that's a different story. Because everything is in RAM, we actually 493 00:31:59,240 --> 00:32:04,300 need to get to this RAM when stuff is happening, when we want to know the state of the router, 494 00:32:04,360 --> 00:32:10,780 or when the router actually crashes. We need this on demand, or we need this before 495 00:32:10,780 --> 00:32:14,080 the router crashes. By the way, if you're not familiar with the 496 00:32:14,080 --> 00:32:17,920 system, the way crashing and rebooting is the default behavior of those routers. 497 00:32:18,120 --> 00:32:23,800 If they detect anything wrong, there is no Dr. Watson, there is no please tell Cisco 498 00:32:23,800 --> 00:32:31,060 about this vulnerability, it will just reboot as quickly as it can, which means it is destroying 499 00:32:31,060 --> 00:32:35,960 all the evidence that we potentially would have to find out why it is actually crashing. 500 00:32:38,360 --> 00:32:43,860 We do have non-voluntary evidence on a Cisco. Of course, we have the flash fire system. 501 00:32:44,080 --> 00:32:48,300 On a flash fire system, there is the image. If someone actually modified the image, like 502 00:32:48,300 --> 00:32:53,820 backdoored it, we can get it off the flash fire. We don't actually need to do anything 503 00:32:53,820 --> 00:32:56,380 fancy. We can just take it off the flash and put 504 00:32:56,380 --> 00:33:04,020 it into IDA and then read. NVRAM, I mentioned, contains the configuration, 505 00:33:04,380 --> 00:33:09,900 so if anyone changed the configuration and actually wrote it back, we get it off NVRAM. 506 00:33:10,140 --> 00:33:13,840 But in fact, nobody does that, because that would be really stupid. 507 00:33:14,080 --> 00:33:19,440 But from an attacker point of view, if you actually have a working zero-day against Cisco, 508 00:33:19,900 --> 00:33:25,900 you are not writing the configuration back to NVRAM. You're so not. You're so trying 509 00:33:25,900 --> 00:33:33,280 to stay in the RAM image and hide, because this thing, this exploit that you have there 510 00:33:33,280 --> 00:33:38,300 is way too valuable to give away just by writing the configuration changes. 511 00:33:41,020 --> 00:33:43,120 The good thing is... 512 00:33:43,120 --> 00:33:50,280 The Cisco engineers actually need pretty much the same thing, because if people complain 513 00:33:50,280 --> 00:33:56,000 about their routers crashing and those people actually pay for service, the Cisco people 514 00:33:56,000 --> 00:33:58,460 need a way to tell why the router was crashing. 515 00:33:58,820 --> 00:34:04,420 So they have this not widely documented developer thing that's called core dumpits. 516 00:34:05,560 --> 00:34:13,100 Essentially you can make an IOS machine dump core either on flash or onto a remote server. 517 00:34:13,120 --> 00:34:20,540 In two cases, either when you issue a command, write core, or when a machine crashes. 518 00:34:21,160 --> 00:34:24,940 This is exactly what we want. We get a complete memory image. 519 00:34:25,080 --> 00:34:27,640 It contains main memory. It contains I.O. memory. 520 00:34:27,880 --> 00:34:32,700 It contains the PCI bus memory. And it's a raw dump, so it's perfect evidence 521 00:34:33,320 --> 00:34:40,760 that the router doesn't try to fuck with it. However, we should actually configure this 522 00:34:40,760 --> 00:34:42,700 feature before shit happens. 523 00:34:43,680 --> 00:34:48,200 Afterwards, it's too late. We actually need to configure core dumps. 524 00:34:50,520 --> 00:34:54,240 What's good about this is it actually has no performance impact. 525 00:34:54,760 --> 00:35:00,200 You configure it, it just sits there as information, unless something happens. 526 00:35:00,820 --> 00:35:07,320 You can configure that. Imagine you have a centrally located FTP server 527 00:35:07,320 --> 00:35:10,240 in your network. You can configure all the routers to dump 528 00:35:10,240 --> 00:35:13,100 core to the central FTP server. You can configure all the routers to dump core to the central FTP server. 529 00:35:13,120 --> 00:35:18,080 That saves you a lot of monitoring, and it also means that you don't get called in the 530 00:35:18,080 --> 00:35:23,520 middle of the night when one of your routers rebooted and one of your network management 531 00:35:23,520 --> 00:35:30,000 apes saw this red dot blinking in HP OpenView. But you can actually tell them, you know, 532 00:35:30,100 --> 00:35:34,080 you're not calling me at night. I come in in the morning and look at the 533 00:35:34,080 --> 00:35:38,000 FTP server. If a core showed up in the incoming directory, 534 00:35:38,260 --> 00:35:43,020 I know something rebooted. This is actually really cool. Why it wasn't 535 00:35:43,120 --> 00:35:46,660 used before. Reason being, core dumps were only useful 536 00:35:46,660 --> 00:35:51,280 for Cisco engineers, kind of, and for exploit writers. 537 00:35:51,640 --> 00:35:59,600 Everyone else didn't have a use for it. We actually need a piece of software that 538 00:35:59,600 --> 00:36:05,740 goes ahead and tells us the state of the router that recovers all this information on the 539 00:36:05,740 --> 00:36:10,080 actual abstract state, like what processes were running, what packets were handled right 540 00:36:10,080 --> 00:36:12,560 away, and all that from the core dump. 541 00:36:14,160 --> 00:36:19,900 We want this to be 100% independent. We want this to be a second opinion on what 542 00:36:19,900 --> 00:36:23,920 Cisco tells you, because the command line on the router called lie. 543 00:36:24,620 --> 00:36:34,220 And it actually does, quite often. The thing that broke was Cisco code, so you're 544 00:36:34,220 --> 00:36:37,900 not going to rely on Cisco code to tell you why it broke, right? 545 00:36:39,620 --> 00:36:42,880 On the other hand, we want this to be a forensics tool. 546 00:36:43,120 --> 00:36:47,560 So, we don't want this to be, like, encased, so you get owned when you're actually looking 547 00:36:47,560 --> 00:36:50,700 at evidence, and then you tell people that this is actually not a vulnerability. 548 00:36:52,200 --> 00:36:58,180 We actually want this code to be solid, so you're not getting owned by someone, like, 549 00:36:58,220 --> 00:37:02,980 crashing your router in a very funny way, and then you get cross-site scripted when 550 00:37:02,980 --> 00:37:03,740 you look at the output. 551 00:37:05,080 --> 00:37:11,800 As you probably figured out by now, we have implemented such a tool. The way we do this 552 00:37:11,800 --> 00:37:12,360 is... 553 00:37:12,360 --> 00:37:20,920 We take the image that was supposed to run on this router, and use that together with 554 00:37:20,920 --> 00:37:25,040 the core. The reason is, iOS images are actually a 555 00:37:25,040 --> 00:37:30,520 large ELF binary. It's, like, the biggest LS binary you've 556 00:37:30,520 --> 00:37:35,180 ever seen. It runs directly on the router. 557 00:37:35,360 --> 00:37:39,120 It doesn't have any concept of, like, kernels or something. 558 00:37:39,520 --> 00:37:41,940 And the virtual memory mapping is just... 559 00:37:41,940 --> 00:37:44,820 It's baseline. So, they're, like, the TLB... 560 00:37:45,400 --> 00:37:46,800 Are you fucking kidding me? 561 00:37:48,200 --> 00:37:48,660 Shit. 562 00:37:49,960 --> 00:37:51,900 The TLB is actually... 563 00:37:51,900 --> 00:37:56,940 Only has only five or six entries that says, here's code, here's data, go fire. 564 00:37:59,840 --> 00:38:03,580 Processes on iOS, like, if you log into a Cisco machine, it shows you, like, all the 565 00:38:03,580 --> 00:38:08,300 processes. They're not processes. They are threads. They are CPU contexts. That's it. 566 00:38:08,340 --> 00:38:10,120 There is no memory protection whatsoever. 567 00:38:11,260 --> 00:38:11,920 It has... 568 00:38:11,920 --> 00:38:16,900 It has a really fucked up scheduling, and it has system-wide data structures, which 569 00:38:16,900 --> 00:38:19,920 is really useful for us in this case, because it has a 570 00:38:19,920 --> 00:38:22,540 common heap. Like, everything shares one heap. 571 00:38:22,880 --> 00:38:28,400 And it has very little abstraction over this stuff, so we can actually dig out the entire 572 00:38:28,400 --> 00:38:29,600 state really easily. 573 00:38:31,200 --> 00:38:36,060 So we take this image as a blueprint. We take this image, we take the section information, 574 00:38:36,780 --> 00:38:40,740 and we put it as a blueprint on top of the core. 575 00:38:41,340 --> 00:38:41,900 And... 576 00:38:41,920 --> 00:38:44,620 I wish it were as easy as it sounds. 577 00:38:46,040 --> 00:38:53,740 Cisco has probably found all, 100%, all possible ways to fuck up the ELF format. 578 00:38:54,460 --> 00:38:56,040 And then they have found some more. 579 00:38:57,360 --> 00:39:02,480 So it is actually really, really hard, and we wrote actually a lot of code, and we did 580 00:39:02,480 --> 00:39:04,020 a lot of testing to get this right. 581 00:39:05,680 --> 00:39:11,020 Once we got this, we can actually take this image and say, you know what? The code section, 582 00:39:11,020 --> 00:39:16,520 if that changed between the memory dump and the image, you got owned. 583 00:39:17,160 --> 00:39:21,860 It's like the most simple test in the world, but it actually works really, really well. 584 00:39:23,060 --> 00:39:25,340 So this is a fancy graphic of what we are doing. 585 00:39:25,780 --> 00:39:31,100 We take the ELF header, we map out where stuff is in a core file, and then we compare 586 00:39:31,100 --> 00:39:36,560 everything that is supposed to be really static and really equal, which is code segment and 587 00:39:36,560 --> 00:39:37,220 read-only data. 588 00:39:37,800 --> 00:39:40,700 It's called read-only data. Nobody shall write to it. 589 00:39:42,320 --> 00:39:49,920 This is what we get. The core guys from Core Impact, not Core 590 00:39:49,920 --> 00:39:54,840 Dump, they actually wrote a backdoor for Cisco IOS. 591 00:39:56,080 --> 00:40:02,380 Topo did the original research, and he called it Dick, that IOS rootkit. 592 00:40:02,700 --> 00:40:06,620 I can get to compare my tool to Topo's dick, which is kind of cool. 593 00:40:09,020 --> 00:40:12,260 He was nice enough to provide this backdoor 594 00:40:12,260 --> 00:40:20,320 to me before he actually showed it at ph-neutral. I put it into our tool, which is called SER, 595 00:40:20,520 --> 00:40:28,240 and out come the virtual addresses with the exact location where he actually patched the 596 00:40:28,240 --> 00:40:32,200 image in runtime. We can actually tell that his dick is only 597 00:40:32,200 --> 00:40:33,320 three times four bytes. 598 00:40:38,120 --> 00:40:41,200 I'm running out of time. I wanted to show you how his backdoor looks 599 00:40:41,200 --> 00:40:43,200 like. Because you get the virtual address, you 600 00:40:43,200 --> 00:40:47,500 just load it up as a core file into IDA and then press C at the right place. 601 00:40:47,880 --> 00:40:51,440 But I'm kind of running out of time, so maybe at the end. 602 00:40:52,280 --> 00:40:56,320 What we can do is also we can reconstruct the entire heap. 603 00:40:57,720 --> 00:41:04,660 IOS has so much overhead on a single heap block allocation that we actually find a lot 604 00:41:04,660 --> 00:41:06,380 of valuable information in that. 605 00:41:06,620 --> 00:41:12,440 The heap blocks even have names, like literal ASCII strings telling you what they're supposed 606 00:41:12,440 --> 00:41:15,580 to be. This is really good for us because we can 607 00:41:15,580 --> 00:41:22,340 tell what the block was actually supposed to be used for, and then if it contains a 608 00:41:22,340 --> 00:41:27,380 bunch of capital As, we know if it's not called the A strip block, then we know something 609 00:41:27,380 --> 00:41:33,000 is going on here. We can reconstruct the entire heap. We find 610 00:41:33,000 --> 00:41:36,600 things that Cisco does to their own heap in regular runs. 611 00:41:36,620 --> 00:41:40,200 We find things in runtime without being actually hacked that are really scary. 612 00:41:41,240 --> 00:41:48,200 They free memory somewhere in the read-only data section and then go, we don't need this 613 00:41:48,200 --> 00:41:50,900 memory anymore. Let's make it a heap block and just stick 614 00:41:50,900 --> 00:41:53,920 it into the linked list. How can you do this? 615 00:41:56,100 --> 00:42:01,120 We implement all the functionality that Cisco has that's called check heaps, like all the 616 00:42:01,120 --> 00:42:03,820 onboard tests. We implement that and a lot more. 617 00:42:04,060 --> 00:42:05,560 We find holes in the heap. 618 00:42:06,620 --> 00:42:12,700 Like heap overflow attacks, there's pretty much no hiding. 619 00:42:13,480 --> 00:42:18,940 We can even identify formerly allocated heap blocks, so we can actually tell what process 620 00:42:18,940 --> 00:42:24,000 was eating all your memory and then stop when you locked in, so you couldn't find out who 621 00:42:24,000 --> 00:42:28,340 it is. We extract the process list, of course. 622 00:42:29,160 --> 00:42:33,420 Threat list, process list, whatever. It is called process list. 623 00:42:33,720 --> 00:42:35,360 We do extract that. 624 00:42:37,160 --> 00:42:43,080 We also have the location of the stacks, which means now we do actually have process, memory, 625 00:42:43,380 --> 00:42:51,880 stack, and we can actually apply any known post-mortem analysis method to this, and 626 00:42:51,880 --> 00:42:59,540 we can actually find out what went wrong. We also extract the TCL chunks and try to 627 00:42:59,540 --> 00:43:02,200 find the backdoors. We're actually dumping the chunks right now. 628 00:43:02,680 --> 00:43:06,600 My biggest fear is that at some point in time, I will actually have an object, and I will 629 00:43:06,600 --> 00:43:13,260 to drink lots and lots of alcohol and then write a TCL decompiler to actually find the 630 00:43:13,260 --> 00:43:17,380 backdoors by itself when they're compiled, but I'm so scared of this. 631 00:43:19,900 --> 00:43:23,600 We have some random applications. You can imagine this tool is actually really 632 00:43:23,600 --> 00:43:28,220 cool for research because it actually gives you all the pointers and tells you what to 633 00:43:28,220 --> 00:43:31,020 do. You're not shutting me down. You're so not. 634 00:43:31,400 --> 00:43:34,660 I'm not shutting you down. Who thinks we should give FX five more minutes? 635 00:43:41,360 --> 00:43:44,160 That will be sufficient. Thank you very much for bearing with me. 636 00:43:45,440 --> 00:43:52,340 We also have something. Because we get the I.O. memory as well, we 637 00:43:52,340 --> 00:43:58,400 actually see stuff that I.O.S. does to packets. It is like when they process switch packets, 638 00:43:58,700 --> 00:44:02,820 when they actually have to load them into main memory and think about them. 639 00:44:02,880 --> 00:44:06,000 In the scenario of ACL matching, for example, 640 00:44:06,000 --> 00:44:06,420 or 641 00:44:06,600 --> 00:44:11,040 when they're running firewall stuff, we actually get to see those packets. 642 00:44:11,340 --> 00:44:17,880 Now, I.O. memory is a part of the main memory in the lower end shared memory routers. 643 00:44:18,080 --> 00:44:23,700 It is usually a very large part, and it is ring buffers. 644 00:44:24,860 --> 00:44:31,660 Ring buffers have this wonderful property that they override linearly, but they have 645 00:44:31,660 --> 00:44:36,060 different sizes of ring buffers. They actually have a ring buffer for small packets, medium 646 00:44:36,060 --> 00:44:38,340 medium packets, large packets, extra large packets. 647 00:44:38,920 --> 00:44:45,520 If your network is usually transporting TCP packets that have the full size because everyone 648 00:44:45,520 --> 00:44:51,000 is streaming porn and someone sends an exploit in a small packet, this small packet is going 649 00:44:51,000 --> 00:44:57,520 to stay in memory a long, long time. What we do is we extract the traffic. 650 00:44:57,860 --> 00:45:04,940 We actually dump the traffic that the router was routing in his recent past, which is in 651 00:45:04,940 --> 00:45:11,440 so far cool as that we can say, you know what, this packet over there is the one that 652 00:45:11,440 --> 00:45:17,340 your router crashed on, which means we get instantaneous ODAY collection in the form 653 00:45:17,340 --> 00:45:21,840 it was actually sent. This is how it looks like. 654 00:45:21,980 --> 00:45:28,040 We actually produce a PCAP file, and you can see all the passwords flying by and stuff, 655 00:45:28,200 --> 00:45:33,280 but if someone attacks the router, you can just take this one packet and say, save to 656 00:45:33,280 --> 00:45:34,680 disk, and you've got new ODAY. 657 00:45:34,680 --> 00:45:36,660 And that was the entire point of the exercise. 658 00:45:44,320 --> 00:45:49,380 So quickly, what about crash info? Some iOS devices actually write a file called 659 00:45:49,380 --> 00:45:52,440 crash info. It's a text file, and I'm just not going 660 00:45:52,440 --> 00:45:54,420 into the details. I'm just showing you something here. 661 00:45:54,600 --> 00:45:59,220 On the top, you see a very telltale number that someone exploited this device. 662 00:45:59,740 --> 00:46:04,540 The problem with crash info is it's information that iOS writes. 663 00:46:04,680 --> 00:46:10,800 It reads into a text file of what iOS thinks the cause of the crash was, and in most cases, 664 00:46:10,800 --> 00:46:16,820 if you look at this, in most cases it actually takes a process called crash writer, which 665 00:46:16,820 --> 00:46:21,440 is the process that gets started to write the graph stuff, so it wasn't actually existing 666 00:46:21,440 --> 00:46:23,340 at the point in time where something went wrong. 667 00:46:23,500 --> 00:46:28,120 IOS is just too fucking stupid to find out what crashed, so it's actually like blaming 668 00:46:28,120 --> 00:46:29,840 the process that writes the blame. 669 00:46:30,340 --> 00:46:30,600 . 670 00:46:30,600 --> 00:46:31,560 . 671 00:46:33,680 --> 00:46:35,680 Hackers like to get up on stage and say, 672 00:46:35,840 --> 00:46:41,580 I have this really cool tool, and it's 0.0.1 alpha 673 00:46:41,580 --> 00:46:47,360 and only compiles on Mac OS X on a Solaris platform. 674 00:46:48,860 --> 00:46:51,240 We actually put a lot of work in this. 675 00:46:51,400 --> 00:46:53,340 We actually have this in release state. 676 00:46:54,120 --> 00:46:56,380 We do actually work professionally on this. 677 00:46:58,120 --> 00:47:00,820 Since February, we do have an online service 678 00:47:00,820 --> 00:47:04,220 where you can submit core dumps, and you get a full report, 679 00:47:04,460 --> 00:47:06,020 and it's registration-free and everything. 680 00:47:06,900 --> 00:47:09,840 If there is interest, and I don't know so far, 681 00:47:09,940 --> 00:47:11,360 so feedback, please, 682 00:47:12,900 --> 00:47:15,120 there's going to be a free rootkit detection version 683 00:47:15,120 --> 00:47:18,000 that finds topo stick in your routers. 684 00:47:19,820 --> 00:47:22,320 And we actually do have a professional version 685 00:47:22,320 --> 00:47:25,840 that actually costs money because all that research costs a lot of money 686 00:47:26,540 --> 00:47:30,040 to find stuff and to use on your own FTP server 687 00:47:30,040 --> 00:47:30,800 in larger networks. 688 00:47:30,820 --> 00:47:34,000 To automatically process core dumps that come in. 689 00:47:35,640 --> 00:47:37,340 The challenge here is this. 690 00:47:38,420 --> 00:47:40,780 iOS images have about, like, 691 00:47:40,820 --> 00:47:44,700 there are about 100,000 different iOS images out there. 692 00:47:45,580 --> 00:47:50,380 15,000 officially supported by Cisco at any given point in time. 693 00:47:50,800 --> 00:47:52,700 This is a great headache for us. 694 00:47:53,020 --> 00:47:56,120 It is also a great headache for exploitation 695 00:47:56,940 --> 00:47:59,880 because I want to make sure that you're not thinking, 696 00:47:59,980 --> 00:48:00,800 like, I'm saying, I'm not going to do this. 697 00:48:00,800 --> 00:48:03,060 I'm not saying everyone, like, all the Chinese hack your routers 698 00:48:03,060 --> 00:48:03,880 and own your routers. 699 00:48:04,760 --> 00:48:06,860 It's highly unlikely right now 700 00:48:06,860 --> 00:48:09,480 because remotely you actually have a chance, 701 00:48:09,540 --> 00:48:12,080 one to 100,000 to actually guess the right images. 702 00:48:14,420 --> 00:48:16,180 And stacks are not stable. 703 00:48:16,400 --> 00:48:17,940 Like, all the addresses are not stable. 704 00:48:18,040 --> 00:48:20,100 If you ever wrote a stable exploit, 705 00:48:20,260 --> 00:48:22,960 you know that hard-coded addresses really, really suck. 706 00:48:24,000 --> 00:48:28,160 But all the exploits, mine and everyone else's so far, 707 00:48:30,120 --> 00:48:30,780 have been, like, 708 00:48:30,780 --> 00:48:32,340 have been published with fixed addresses. 709 00:48:32,580 --> 00:48:35,220 So they work with one out of 100,000 images. 710 00:48:36,140 --> 00:48:39,780 So the diversity, the sheer diversity of code 711 00:48:39,780 --> 00:48:41,540 that Cisco puts out there 712 00:48:42,660 --> 00:48:44,620 is almost a better protection 713 00:48:44,620 --> 00:48:46,760 than the source port randomization patch 714 00:48:46,760 --> 00:48:49,780 that you apply to your DNS due to Kaminsky's fucking around. 715 00:48:51,500 --> 00:48:54,300 So they actually, like, make it better for the worse. 716 00:48:56,660 --> 00:48:58,080 This is a slide on, like, 717 00:48:58,080 --> 00:49:00,500 what I think people with backdoors will do. 718 00:49:00,780 --> 00:49:01,240 In the future. 719 00:49:01,500 --> 00:49:02,780 And as you see, 720 00:49:02,900 --> 00:49:05,320 there is no blanks on the detection side. 721 00:49:05,520 --> 00:49:08,280 Once we get all those iOS platforms, 722 00:49:08,340 --> 00:49:09,760 like the hardware platforms, covered, 723 00:49:09,900 --> 00:49:11,120 and that's a lot of work, 724 00:49:11,340 --> 00:49:12,580 once we do that, 725 00:49:12,760 --> 00:49:14,680 I think we should be pretty fine 726 00:49:14,680 --> 00:49:16,140 for the next couple of years 727 00:49:16,140 --> 00:49:18,960 if you guys start configuring your routers 728 00:49:18,960 --> 00:49:21,740 to actually dump core and not ignore reboots. 729 00:49:22,840 --> 00:49:23,860 And that is it. 730 00:49:24,060 --> 00:49:26,080 Thanks for the additional five minutes. 731 00:49:28,900 --> 00:49:30,760 If you're interested, 732 00:49:30,780 --> 00:49:31,740 if you're interested in this subject, 733 00:49:31,940 --> 00:49:34,460 I do recommend going to this website. 734 00:49:34,840 --> 00:49:35,880 There is a wiki. 735 00:49:36,000 --> 00:49:38,900 We actually try to fill it with useful information. 736 00:49:39,280 --> 00:49:41,200 And it actually contains exploits as well.