1 00:00:00,000 --> 00:00:00,720 Hey, how's it going? 2 00:00:02,480 --> 00:00:02,840 Yeah. 3 00:00:04,300 --> 00:00:06,720 So, this is a meta post-exploitation. 4 00:00:08,860 --> 00:00:09,800 I just got a question. 5 00:00:09,980 --> 00:00:11,620 This is still a hacking con, right? 6 00:00:12,860 --> 00:00:15,700 So, you guys mind if we just talk about some hacking techniques for a change? 7 00:00:15,820 --> 00:00:17,480 A little bit of demonstration. 8 00:00:18,760 --> 00:00:19,260 Right on. 9 00:00:21,860 --> 00:00:25,440 All right, so I'm Val Smith, founder of Offensive Computing, 10 00:00:25,440 --> 00:00:26,700 work on the Metasploit project. 11 00:00:28,160 --> 00:00:31,700 Basically, break into computers, reverse things, play with malware. 12 00:00:34,980 --> 00:00:36,340 I'm sort of the new face here. 13 00:00:36,400 --> 00:00:37,080 I'm Colin Ames. 14 00:00:37,080 --> 00:00:38,300 I work for Offensive Computing. 15 00:00:38,300 --> 00:00:40,820 I do pen testing, malware analysis, you know, the usual bit. 16 00:00:41,360 --> 00:00:42,540 Nothing terribly exciting. 17 00:00:47,680 --> 00:00:51,640 All right, so we just wanted to warn you guys. 18 00:00:51,700 --> 00:00:55,880 We discovered this really crazy DNS, you know, can destroy the Internet. 19 00:00:56,700 --> 00:00:59,400 It kind of freaked us out, so we wanted to share it with you to make sure you're aware. 20 00:01:00,220 --> 00:01:03,420 We're going to show you in this next slide here exactly what it is. 21 00:01:06,180 --> 00:01:07,000 So, watch out. 22 00:01:08,020 --> 00:01:08,380 Danger. 23 00:01:10,140 --> 00:01:13,640 Also, since every other talk we've ever given is pretty much just pages of assembly, 24 00:01:13,940 --> 00:01:18,060 we thought we'd have a requisite page for you so you wouldn't feel like you missed anything. 25 00:01:18,940 --> 00:01:20,160 All right, now that that's over. 26 00:01:21,340 --> 00:01:25,780 All right, so basically this is a follow-up to the talk H.T. Moore and I gave last year. 27 00:01:25,900 --> 00:01:26,680 I don't know if any of you saw it. 28 00:01:26,680 --> 00:01:27,140 I don't know if any of you saw that one. 29 00:01:28,300 --> 00:01:34,120 It's a collection of strange, weird, old, unusual ways of breaking into computers. 30 00:01:34,460 --> 00:01:39,980 Well, this year we wanted to do the same thing, but it's about what you do after you break into the computers. 31 00:01:43,360 --> 00:01:46,780 Okay, so how do we define post-exploitation? 32 00:01:47,220 --> 00:01:51,320 Well, we see it as what are the steps you take after you've broken in, 33 00:01:51,440 --> 00:01:56,380 whether your goals are to move on to other computers or escalate your privileges, 34 00:01:56,680 --> 00:01:57,440 or what have you. 35 00:01:57,800 --> 00:02:03,340 A lot of the traditional sort of things people do nowadays are root kits, things like that. 36 00:02:03,400 --> 00:02:04,560 We're going to talk about some different stuff. 37 00:02:05,440 --> 00:02:09,620 And there's several subject matters under post-exploitation that we've broken it down into, 38 00:02:09,800 --> 00:02:17,500 like password management, feature modification, persistence, stealth, things like these. 39 00:02:17,620 --> 00:02:19,200 And we're going to sort of go over each of these topics 40 00:02:19,200 --> 00:02:23,960 and demonstrate a few techniques under each one that we find kind of interesting. 41 00:02:27,640 --> 00:02:30,960 All right, so getting root is just the beginning. 42 00:02:31,220 --> 00:02:34,180 A lot of people focus on, well, I broke into the computer, I got root, I'm done. 43 00:02:35,100 --> 00:02:38,860 We really feel that that's not where it's at. 44 00:02:38,980 --> 00:02:42,320 You want to look at where can I go, what data can I access, 45 00:02:43,420 --> 00:02:46,140 what things can I get into from there, what havoc can I wreak. 46 00:02:51,460 --> 00:02:54,460 Basically, how do you scale to attacking thousands of hosts? 47 00:02:55,480 --> 00:02:56,600 You know, if you're keeping track, 48 00:02:56,600 --> 00:02:58,900 if you're keeping track of one computer at a time, it's kind of hard. 49 00:02:59,160 --> 00:03:01,240 And you see botnet authors are very successful at this. 50 00:03:01,480 --> 00:03:04,740 We're sort of ignoring the botnet technology for this particular talk. 51 00:03:08,460 --> 00:03:11,260 All right, so the first subject we're going to talk about is password management. 52 00:03:12,640 --> 00:03:16,500 And what this means to us is on large pen tests or attacks, 53 00:03:16,720 --> 00:03:17,940 if you're breaking into lots of computers, 54 00:03:18,380 --> 00:03:21,500 you want to be able to keep track of what passwords go with what computer, 55 00:03:22,080 --> 00:03:24,880 what hosts, what access these passwords give you. 56 00:03:27,940 --> 00:03:31,620 So, you know, you want to be able to test passwords that you've captured and cracked 57 00:03:31,620 --> 00:03:34,680 on multiple different systems and see if they're using shared passwords. 58 00:03:34,800 --> 00:03:36,500 This is really common in large networks. 59 00:03:37,740 --> 00:03:39,520 You want to build your word list files. 60 00:03:39,760 --> 00:03:41,220 These are your dictionaries that you're using to crack. 61 00:03:41,500 --> 00:03:45,480 And so, you know, this is pretty easy when you're breaking into one, two, or three computers. 62 00:03:45,680 --> 00:03:51,320 But when you're doing 10,000, 30,000, it gets to be really big and difficult to organize. 63 00:03:56,060 --> 00:03:56,580 And then, you know, you're going to have to figure out, you know, 64 00:03:56,580 --> 00:04:01,600 and, you know, Val's very fond of trying to do all of this in, you know, Notepad or WordPad, TextPad, 65 00:04:01,760 --> 00:04:03,260 and it just doesn't scale to this point. 66 00:04:03,360 --> 00:04:07,700 So, really, you know, our goals here are we want to be able to acquire it 67 00:04:07,700 --> 00:04:11,040 and store it in some meaningful manner and organize it and track it. 68 00:04:11,160 --> 00:04:13,640 I mean, so this is useful both in attacking and gathering, you know, 69 00:04:13,640 --> 00:04:16,600 further intelligence on what targets you might want to hit as well as clean up later. 70 00:04:18,120 --> 00:04:21,820 And so, basically, we just want to expand this out and show you the pieces of it. 71 00:04:24,000 --> 00:04:26,040 So, basically, like I said, there's many stages. 72 00:04:26,120 --> 00:04:26,560 The first one's open. 73 00:04:26,580 --> 00:04:30,640 Those are, of course, acquiring hashes or, you know, cache credentials or so forth on a host, 74 00:04:30,860 --> 00:04:35,980 listing tokens, what's available there, several tools that we can do that, some choices here. 75 00:04:36,060 --> 00:04:38,860 Then you have to prioritize, make some decisions, decide what you want to do with it, 76 00:04:39,000 --> 00:04:44,000 and then take your choices that you want and crack them or rainbow tables 77 00:04:44,000 --> 00:04:45,760 or however you want to approach these passwords. 78 00:04:45,880 --> 00:04:47,760 We don't want to talk about cracking here. 79 00:04:48,420 --> 00:04:49,300 People do it. 80 00:04:49,320 --> 00:04:49,980 It's not hard. 81 00:04:50,160 --> 00:04:54,720 I mean, there are some idiosyncrasies to it that we just can't get into right now. 82 00:04:54,880 --> 00:04:56,460 And then, really, it's, you know, we want to track. 83 00:04:56,580 --> 00:05:00,260 So, you can look back at what you've done, where you're going, as well as reuse it. 84 00:05:03,880 --> 00:05:05,840 So, again, here's some more existing tools. 85 00:05:06,000 --> 00:05:11,160 You know, you have loft crack, can't enable, and these, you know, core impact that'll allow you to view a session, 86 00:05:11,320 --> 00:05:14,980 view some tool types, hash types, decide how you want to crack them, 87 00:05:15,080 --> 00:05:17,880 if you're going to use a rainbow tables or just a John type approach, 88 00:05:18,420 --> 00:05:20,460 and then, basically, you know, how we want to track them. 89 00:05:21,120 --> 00:05:24,800 And this is just we're trying to show you sort of a snapshot of what tools are out there 90 00:05:24,800 --> 00:05:26,480 and what limited features they are. 91 00:05:29,180 --> 00:05:32,240 So, here's a nice little screenshot just to kind of give you an idea. 92 00:05:32,420 --> 00:05:33,900 You know, you have loft crack and can't enable. 93 00:05:34,180 --> 00:05:37,680 You know, there's some good information here, but all in all, not terribly useful to you 94 00:05:37,680 --> 00:05:40,360 when we're talking about tens of thousands of boxes. 95 00:05:45,040 --> 00:05:45,960 Does this mic work? 96 00:05:46,140 --> 00:05:46,680 Oh, right on. 97 00:05:46,920 --> 00:05:48,260 Sorry, our voice is a little rough. 98 00:05:48,380 --> 00:05:49,620 We've been in Vegas for about a week. 99 00:05:49,780 --> 00:05:52,740 So, bear with us. 100 00:05:53,780 --> 00:05:56,460 And as we, you know, the poor man's KVM, as we just, you know, 101 00:05:56,480 --> 00:05:58,720 unplug and re-plug in, the... 102 00:06:03,080 --> 00:06:06,220 So, here's a basic demo of MetaPasses, some Metasploit that we, 103 00:06:06,300 --> 00:06:08,540 or a Metasploit module that we've created. 104 00:06:08,720 --> 00:06:12,280 So, basically, here we are scanning a network, show you some clients. 105 00:06:12,400 --> 00:06:15,120 We're basically going to start from, like, 20 to about, you know, 55, 106 00:06:15,700 --> 00:06:20,460 and some basic options that hopefully we'll zoom in on and you can see a little better. 107 00:06:21,180 --> 00:06:22,000 Ah, there we go. 108 00:06:22,160 --> 00:06:25,100 So, you know, we generally, you can specify a dictionary list. 109 00:06:25,280 --> 00:06:26,020 You can have... 110 00:06:27,560 --> 00:06:29,060 Where you want to place these files. 111 00:06:29,240 --> 00:06:33,980 In this example, we're using FGDump, which is not, it's terribly detectable by AV, 112 00:06:34,140 --> 00:06:36,920 but this is to demonstrate as we run out of time to finish the code. 113 00:06:37,020 --> 00:06:39,620 And hopefully, as we get later, we're going to integrate this further in 114 00:06:39,620 --> 00:06:43,740 and use Meterpreter as opposed to a lot of these methods for actually acquiring the hashes 115 00:06:43,740 --> 00:06:47,620 and use and fully utilize the Metasploit framework for it. 116 00:06:47,800 --> 00:06:50,000 But you can plug in your dumper of choice to this right now? 117 00:06:50,240 --> 00:06:51,720 Yes, it'll do what I want. 118 00:06:51,820 --> 00:06:55,360 And it's also, you know, we want to acquire the password hashes. 119 00:06:56,360 --> 00:06:56,460 Okay. 120 00:06:56,480 --> 00:06:57,880 As well as tokens on each host. 121 00:07:04,100 --> 00:07:08,340 And as we kind of go through here, kick in a few more options. 122 00:07:08,620 --> 00:07:11,380 We're going to specify the range of hosts that we want to go through. 123 00:07:14,160 --> 00:07:14,720 Type faster. 124 00:07:15,360 --> 00:07:15,860 All right. 125 00:07:16,860 --> 00:07:18,560 And, you know, some general things. 126 00:07:18,800 --> 00:07:20,900 You know, 10 seconds for a timeout, that's just way too long. 127 00:07:21,020 --> 00:07:23,780 I'm way too impatient for that, so let's knock it down a bit. 128 00:07:23,940 --> 00:07:24,980 And then we're going to go into a user. 129 00:07:25,040 --> 00:07:26,120 This is a user that we have. 130 00:07:26,120 --> 00:07:30,280 We have already acquired and hacked, and so that's important here. 131 00:07:30,440 --> 00:07:32,300 Like, we have the password in our dictionary list, 132 00:07:32,420 --> 00:07:35,840 so we have a specific number of passwords we've already acquired for this network. 133 00:07:36,140 --> 00:07:38,300 And so, like we're saying, this is post-exploitation. 134 00:07:38,540 --> 00:07:39,360 We have one host. 135 00:07:39,460 --> 00:07:42,680 We have one password at least, and we know at least one user. 136 00:07:42,740 --> 00:07:45,140 Here it's local Val Smith, who's a local administrator. 137 00:07:46,420 --> 00:07:49,700 As we kick it off, you'll also see, so we'll have output. 138 00:07:49,920 --> 00:07:51,180 The black screens are actually dumping. 139 00:07:51,560 --> 00:07:55,520 And if you look over on the right screen, you can actually see, well, not really. 140 00:07:55,520 --> 00:07:57,340 But, you know, so here's some output. 141 00:07:57,460 --> 00:08:00,520 We have some tokens that are going through, showing that we're dumping some passwords. 142 00:08:00,800 --> 00:08:00,880 Hey, tokens. 143 00:08:01,800 --> 00:08:07,500 And up in the right-hand corner, you can actually see the host broken out by IP ranges, 144 00:08:07,680 --> 00:08:10,700 and then you have a .pwdump as well as just a normal file. 145 00:08:10,840 --> 00:08:13,540 And these are each host that's been executed and exploited 146 00:08:13,540 --> 00:08:17,060 and gathered into further intelligence so we can dig deeper. 147 00:08:17,300 --> 00:08:21,920 And so then we're going to go ahead and dump our acquired information into Lovecrack here. 148 00:08:22,280 --> 00:08:25,500 And we've prepended the last octet onto ESP. 149 00:08:25,520 --> 00:08:26,720 And we're going to go ahead and do that each because, well, as you'll see, 150 00:08:26,780 --> 00:08:29,180 there's quite a few administrators going through here. 151 00:08:29,340 --> 00:08:33,860 So it's, you know, here's to aid in your continuation where you've cracked what you're going to do. 152 00:08:33,960 --> 00:08:36,620 And, you know, some fun passwords up there, you know, kind of amusing. 153 00:08:37,460 --> 00:08:42,120 So what this thing is doing is basically you start off with one account that you've hacked on the system. 154 00:08:42,280 --> 00:08:46,280 You feed it to this, and it's going to go out across the network, whatever ranges you specify, 155 00:08:46,560 --> 00:08:51,640 and try this password on every system, and then use whatever access it has to gather intelligence, 156 00:08:51,840 --> 00:08:53,940 like other passwords, accounts, tokens. 157 00:08:54,320 --> 00:08:55,500 So it's really easy. 158 00:08:55,520 --> 00:09:00,480 It's really automating that process of reusing your password and connecting to thousands of systems. 159 00:09:11,400 --> 00:09:12,500 Oh, my God, it worked. 160 00:09:14,080 --> 00:09:18,640 All right, so now we're going to get into a topic, stealth versus persistence. 161 00:09:19,400 --> 00:09:25,040 Back in the old days when people talked about the concept of root kits, this is basically a set of software 162 00:09:25,040 --> 00:09:25,500 that you would use. 163 00:09:25,520 --> 00:09:26,940 You would use it to maintain root on a system. 164 00:09:27,640 --> 00:09:30,900 You know, you would upload your files, and then you'd use them so you could come back. 165 00:09:31,740 --> 00:09:36,200 Nowadays, everyone, when they talk about root kits, it's pretty much all about hiding your activities 166 00:09:36,200 --> 00:09:37,600 rather than maintaining access. 167 00:09:38,160 --> 00:09:43,300 You know, if you see any of Joanna's talks, it's like, how do I hide my files and my network access 168 00:09:43,300 --> 00:09:44,180 and things like this. 169 00:09:44,500 --> 00:09:48,740 These two concepts in our minds still go hand in hand, but we sort of split them out because we sort of, 170 00:09:48,780 --> 00:09:52,200 we see them as really different aspects of post-exploitation. 171 00:09:54,580 --> 00:09:54,940 Okay. 172 00:09:54,940 --> 00:09:57,200 So what is persistence to us? 173 00:09:57,400 --> 00:09:58,720 Well, to us, it's maintaining access. 174 00:09:59,140 --> 00:10:02,260 You know, just being able to re-access the target that you've broken into. 175 00:10:02,600 --> 00:10:03,780 And why would you want to do this? 176 00:10:03,900 --> 00:10:05,220 Well, targets can get patched. 177 00:10:05,940 --> 00:10:10,300 A lot of exploits can be one-shot only, meaning once you use your exploit and break in, 178 00:10:10,380 --> 00:10:13,620 the system's unstable and you can't break in again using the same exploit. 179 00:10:15,060 --> 00:10:19,800 Often you need to return to the host you've broken into multiple times afterwards 180 00:10:19,800 --> 00:10:24,300 because either you don't know how useful the target is or you've learned something further on, 181 00:10:24,300 --> 00:10:28,540 breaking into the network that tells you, oh, I need to go back and get this information or this data. 182 00:10:30,300 --> 00:10:35,920 The goals of persistence and post-exploitation are really access the target as often as you want. 183 00:10:36,860 --> 00:10:38,460 This is sort of a huge area of study. 184 00:10:38,640 --> 00:10:40,240 There's lots of people working on tools for this. 185 00:10:40,840 --> 00:10:42,920 Also keep in mind, sometimes persistence doesn't matter. 186 00:10:43,320 --> 00:10:46,000 You know, sometimes speed is more important than persistence. 187 00:10:47,800 --> 00:10:48,340 All right. 188 00:10:48,380 --> 00:10:52,880 So we've broken down sort of the stages of persistence, which start off as the initial access. 189 00:10:52,880 --> 00:10:59,720 This is when you exploit the box, either with Metasploit or standalone exploit or stolen password. 190 00:10:59,920 --> 00:11:00,540 You break in. 191 00:11:00,760 --> 00:11:02,160 At that point, you've got to make a decision. 192 00:11:02,380 --> 00:11:04,800 Well, what do I use to get persistence? 193 00:11:05,060 --> 00:11:06,100 What do I use to get back in? 194 00:11:06,240 --> 00:11:07,400 Am I going to upload a backdoor? 195 00:11:07,640 --> 00:11:09,060 Am I going to upload a rootkit? 196 00:11:09,820 --> 00:11:10,740 These types of things. 197 00:11:10,980 --> 00:11:13,200 It's really OS-dependent, target-dependent. 198 00:11:13,220 --> 00:11:14,820 It depends on how well you know your target. 199 00:11:15,500 --> 00:11:18,720 Then you're going to set up your persistent mechanism, whatever it is, 200 00:11:18,840 --> 00:11:22,580 and then you're going to come back to the target on successive occasions. 201 00:11:22,880 --> 00:11:23,540 And you get what you need. 202 00:11:24,900 --> 00:11:26,420 I'm a big advocate of clean-up. 203 00:11:26,560 --> 00:11:30,360 I've seen, like, a lot of pen testers leave 100 different tools on the target. 204 00:11:31,080 --> 00:11:32,120 This gets you caught. 205 00:11:32,520 --> 00:11:35,180 It makes forensics really easy, things like this. 206 00:11:35,520 --> 00:11:36,880 So leave no trace. 207 00:11:38,240 --> 00:11:41,180 There's all kinds of existing tools to help you maintain persistence. 208 00:11:41,640 --> 00:11:43,520 I'm not really going to talk too much about these. 209 00:11:44,040 --> 00:11:45,860 They're all pretty cool, and everybody uses them. 210 00:11:45,960 --> 00:11:47,280 But they're conventional. 211 00:11:47,480 --> 00:11:51,840 The existence of one of these things on your system tells the target that they've been hacked. 212 00:11:52,880 --> 00:11:56,040 So we have sort of a couple of different perspectives on persistence. 213 00:11:56,580 --> 00:12:00,260 If you can always re-exploit the target, then why worry about it? 214 00:12:00,680 --> 00:12:04,340 This is sort of unlikely to be the case, but occasionally it is. 215 00:12:05,600 --> 00:12:10,220 What we really prefer to do is inject, add, or modify new vulnerabilities into a target. 216 00:12:10,840 --> 00:12:17,300 It's really hard to determine maliciousness when the system just has a bug and they're not aware of it. 217 00:12:17,420 --> 00:12:19,980 If they discover the bug, it's not like discovering a rootkit. 218 00:12:20,140 --> 00:12:21,980 When you see a rootkit, it's like, oh, crap, I've been hacked. 219 00:12:22,880 --> 00:12:24,140 Whatever vulnerable piece of software. 220 00:12:24,600 --> 00:12:25,660 Have I been hacked? 221 00:12:27,380 --> 00:12:28,100 What's the deal? 222 00:12:29,280 --> 00:12:30,680 It's very difficult. 223 00:12:30,840 --> 00:12:34,520 If you watch any other talks any other year, it's very difficult to find bugs. 224 00:12:34,640 --> 00:12:35,560 People are writing fuzzers. 225 00:12:35,620 --> 00:12:37,540 People are doing all these crazy things to look for bugs. 226 00:12:38,060 --> 00:12:40,360 Now imagine someone's purposely putting bugs in the code. 227 00:12:40,940 --> 00:12:46,700 That would be very difficult to detect and even more difficult to understand is this on purpose 228 00:12:46,700 --> 00:12:48,660 or is this just accidents of coding? 229 00:12:50,940 --> 00:12:51,500 All right. 230 00:12:51,500 --> 00:12:54,820 We also like leveraging existing persistent admin access. 231 00:12:54,980 --> 00:12:56,940 There's lots of things out there, especially in the enterprise, 232 00:12:57,140 --> 00:13:01,280 that people use legitimately to have access to the hosts they're going after. 233 00:13:01,800 --> 00:13:04,360 Things like Nagios, which is a big monitoring software. 234 00:13:04,800 --> 00:13:07,840 On some attacks I've done, we'll actually add our own Nagios checks, 235 00:13:08,060 --> 00:13:12,480 which go out and give us root on all the systems or access to all the systems that it's checking. 236 00:13:14,220 --> 00:13:17,420 Configuration management systems like CFEngine and SMS are really good to attack 237 00:13:17,420 --> 00:13:20,360 because they basically have access to every system in the network, 238 00:13:20,460 --> 00:13:21,480 and they're pushing things out. 239 00:13:21,480 --> 00:13:25,960 If you break into those and just use what's there, 240 00:13:26,080 --> 00:13:27,940 use what the target has left for you to use. 241 00:13:30,280 --> 00:13:30,800 All right. 242 00:13:30,840 --> 00:13:33,800 Here's some examples, and we're going to show some demos of some of these concepts. 243 00:13:34,560 --> 00:13:35,940 Imagine you're going after a machine, 244 00:13:36,100 --> 00:13:39,900 and lots of admins use VNC to remote administer their machines. 245 00:13:41,140 --> 00:13:43,900 You break into the computer somehow, and you want persistent access, 246 00:13:44,040 --> 00:13:46,420 but you don't want to put in a Trojan because they're likely to find it. 247 00:13:47,020 --> 00:13:50,580 Well, replace the existing VNC with a vulnerable version that's got an exploit, 248 00:13:50,580 --> 00:13:51,640 like authentication bypass. 249 00:13:52,880 --> 00:13:56,860 Make sure that you copy the password so that the target doesn't realize 250 00:13:56,860 --> 00:13:58,060 that his software's been modified. 251 00:13:59,080 --> 00:14:00,560 His VNC's going to work normally. 252 00:14:00,740 --> 00:14:02,880 When he logs in to do his thing, it's still going to be there, 253 00:14:03,040 --> 00:14:06,920 but you're also going to have an exploit that you know will work every time, 254 00:14:07,000 --> 00:14:09,840 and you haven't added any rootkits or backdoors. 255 00:14:13,580 --> 00:14:17,040 Another really sneaky thing we like to do is to add vulnerable code to applications. 256 00:14:17,440 --> 00:14:20,460 This works really well on web apps because they're not compiled, 257 00:14:20,580 --> 00:14:22,200 so the code's sitting there for you to modify. 258 00:14:22,780 --> 00:14:24,960 Do things like take out user input validation. 259 00:14:25,700 --> 00:14:29,300 A lot of these web applications have forms that people fill in. 260 00:14:29,480 --> 00:14:31,500 Well, go in there and take out the security checks 261 00:14:31,500 --> 00:14:33,400 so that you can exploit them later. 262 00:14:33,660 --> 00:14:36,600 It's unlikely that the coder's going to notice that and say, 263 00:14:36,760 --> 00:14:38,640 wow, someone modified my code. 264 00:14:39,000 --> 00:14:41,200 They just maybe won't even notice it ever. 265 00:14:41,540 --> 00:14:43,380 The focus here is on vague intent. 266 00:14:43,820 --> 00:14:45,700 Never be solely malicious. 267 00:14:46,020 --> 00:14:48,260 Never have your actions only have one outcome. 268 00:14:50,800 --> 00:14:51,700 Reintroduce patch books. 269 00:14:53,200 --> 00:14:56,420 Here's a more concrete real-world example of this. 270 00:14:57,240 --> 00:15:00,340 We're going to show a demo, so I'm not going to talk too much on this slide. 271 00:15:01,080 --> 00:15:04,120 Basically, adding an extra field into a form 272 00:15:04,120 --> 00:15:06,280 with a little bit of extra code that processes it 273 00:15:06,280 --> 00:15:08,600 that does not look malicious, but the code has a vulnerability. 274 00:15:10,120 --> 00:15:12,940 Let me switch up just a little bit more. 275 00:15:13,840 --> 00:15:16,160 When you're adding vulnerable code to a web app, 276 00:15:16,380 --> 00:15:18,560 you can add things that will execute your commands, 277 00:15:18,560 --> 00:15:22,500 just like as if they had coded it insecurely themselves. 278 00:15:23,060 --> 00:15:25,620 I mean, who needs to add a shell bound to a port 279 00:15:25,620 --> 00:15:30,340 which is going to be noisy and be detectable in some tool? 280 00:15:30,600 --> 00:15:32,460 It's unlikely to ever detect these kind of things, 281 00:15:32,520 --> 00:15:34,800 especially in big apps that have thousands of lines of code. 282 00:15:35,680 --> 00:15:37,460 One good thing is they can never be sure 283 00:15:37,460 --> 00:15:38,760 of the maliciousness of these bugs. 284 00:15:38,980 --> 00:15:40,520 They're not going to be able to say definitively, 285 00:15:40,540 --> 00:15:43,560 well, we've been hacked because this bug is in our code. 286 00:15:43,720 --> 00:15:44,860 That doesn't make much sense. 287 00:15:54,680 --> 00:15:56,000 All right, one sec. 288 00:16:01,040 --> 00:16:03,180 All right, so basically what we've done 289 00:16:03,180 --> 00:16:05,260 is contrived sort of a really simple web app 290 00:16:05,260 --> 00:16:06,880 to show you the concept here. 291 00:16:07,240 --> 00:16:10,040 All this web app does is take what you type in and echo it, 292 00:16:10,140 --> 00:16:14,380 but extrapolate this idea out to any type of large web application. 293 00:16:18,560 --> 00:16:20,560 All right, so we're just typing in our stuff to make sure it works. 294 00:16:21,080 --> 00:16:23,300 This one in particular uses a get request, 295 00:16:23,700 --> 00:16:26,100 so you can see the different parameters in the URL. 296 00:16:26,800 --> 00:16:28,900 So we've hacked the web server, okay? 297 00:16:28,980 --> 00:16:30,320 We have access to the web server. 298 00:16:30,460 --> 00:16:32,820 We want persistent access so that we can come back. 299 00:16:33,100 --> 00:16:35,320 The admin's likely to discover that there's a bug 300 00:16:35,320 --> 00:16:37,540 in whatever we use to exploit it and patch it. 301 00:16:37,840 --> 00:16:40,720 So what we're doing is we're going into this web application that they have, 302 00:16:40,800 --> 00:16:41,860 we're looking at their code, 303 00:16:41,980 --> 00:16:43,760 and we're going to add just a few lines of code 304 00:16:43,760 --> 00:16:47,220 that introduce a vulnerability that we can use to get back in later. 305 00:16:51,480 --> 00:16:54,100 All right, so in this particular piece of code, 306 00:16:54,240 --> 00:16:56,400 they have a function called check page. 307 00:16:56,680 --> 00:16:58,520 This is just a very simple Perl example. 308 00:16:58,960 --> 00:17:02,640 Okay, so what they do is they look to see if, you know, 309 00:17:02,680 --> 00:17:06,400 something's getting passed from the form to the parameter page lock, 310 00:17:06,580 --> 00:17:07,620 and then they do something with it. 311 00:17:07,800 --> 00:17:10,680 So we're just going to add another check for another form field, 312 00:17:10,920 --> 00:17:13,540 and we'll call it lang, which looks fairly innocuous, 313 00:17:13,540 --> 00:17:14,400 like language check. 314 00:17:16,260 --> 00:17:17,900 So if we detect that... 315 00:17:18,560 --> 00:17:21,640 any data has been passed to this form field, 316 00:17:23,020 --> 00:17:24,580 we're going to process this data 317 00:17:24,580 --> 00:17:28,660 by doing open file name with whatever the data is. 318 00:17:29,340 --> 00:17:31,280 So the vulnerability here is that Perl, 319 00:17:31,440 --> 00:17:34,360 if it receives a pipe to the open function, 320 00:17:34,620 --> 00:17:36,500 will execute that as a shell command. 321 00:17:37,000 --> 00:17:40,080 And so all we've done is introduce a vulnerability into this web app. 322 00:17:40,240 --> 00:17:42,920 We didn't put in a backdoor listener, just a bug. 323 00:17:43,900 --> 00:17:45,080 That looks fairly innocent. 324 00:17:45,220 --> 00:17:46,660 I mean, if you're reading this code, you're not going to see, 325 00:17:46,660 --> 00:17:48,440 oh, evil hacker backdoor here. 326 00:17:49,240 --> 00:17:51,560 Well, you might now that we've told you about it, but... 327 00:17:52,380 --> 00:17:54,600 Okay, so we're going to add a hidden field. 328 00:17:55,220 --> 00:17:58,720 Now, what this means is that your regular users using this web page 329 00:17:58,720 --> 00:18:00,700 aren't going to notice any change in the functionality. 330 00:18:00,960 --> 00:18:02,700 They're not going to see any difference to their form. 331 00:18:02,860 --> 00:18:04,160 It's going to work exactly the same. 332 00:18:04,380 --> 00:18:06,620 So we reload it. We test it. 333 00:18:06,680 --> 00:18:07,720 It works exactly the same. 334 00:18:08,280 --> 00:18:10,840 However, when I get requests, there's now a new parameter called lang. 335 00:18:11,580 --> 00:18:12,900 So all we do is we go in here, 336 00:18:13,020 --> 00:18:15,800 and you could craft this with curl or with some script, 337 00:18:15,800 --> 00:18:17,740 or a lot of different ways. 338 00:18:17,840 --> 00:18:19,480 You can do it in a post, and there you go. 339 00:18:20,060 --> 00:18:22,180 We just add a command to the lang parameter, 340 00:18:22,420 --> 00:18:25,260 and it executes shell commands right through the web. 341 00:18:25,480 --> 00:18:27,400 So we now have a persistent access backdoor 342 00:18:27,400 --> 00:18:32,120 inside of their own source code that looks like innocent source code. 343 00:18:33,440 --> 00:18:35,280 So extrapolate this out to PHP, 344 00:18:35,500 --> 00:18:38,040 whatever web application software you want to use, 345 00:18:38,140 --> 00:18:39,120 and you'll have a backdoor. 346 00:18:39,300 --> 00:18:42,560 If you use post instead of gets, nothing will show up in the logs, 347 00:18:42,740 --> 00:18:45,480 and we'll get into some more complex concepts on this 348 00:18:45,480 --> 00:18:46,060 in just a sec. 349 00:18:50,300 --> 00:18:52,700 So, I mean, you know, that's a good sign. 350 00:18:52,900 --> 00:18:54,520 We're trying to make you think outside the box. 351 00:18:54,780 --> 00:18:58,540 But, you know, bin password showing up in your web logs 352 00:18:58,540 --> 00:19:00,740 is probably pretty malicious, right? 353 00:19:00,980 --> 00:19:02,600 So we want to hide intent again. 354 00:19:02,720 --> 00:19:03,360 We want to try it. 355 00:19:03,460 --> 00:19:05,180 So the next step is, you know, how do we hide this? 356 00:19:05,240 --> 00:19:08,200 Like, well, if name is this with this value of input, 357 00:19:08,460 --> 00:19:10,980 go ahead and just change the password to something we know 358 00:19:10,980 --> 00:19:11,840 or do whatever. 359 00:19:12,300 --> 00:19:13,720 And if we want to make it even further, 360 00:19:13,720 --> 00:19:16,040 we can obfuscate it with URL encoding and other things. 361 00:19:16,180 --> 00:19:18,740 Because you don't, you know, network traffic and sniffers 362 00:19:18,740 --> 00:19:21,180 and snort and these sort of things will pick up similar, 363 00:19:21,460 --> 00:19:23,080 you know, will pick up simple intent, 364 00:19:23,200 --> 00:19:24,160 will pick up simple strings. 365 00:19:24,300 --> 00:19:27,380 And strings identify very specifically intent in this case. 366 00:19:27,800 --> 00:19:29,300 And, you know, if we really... 367 00:19:32,380 --> 00:19:34,720 So if we really want to, you know, take it to the next step, 368 00:19:34,860 --> 00:19:37,280 like keep Stealth involved with our persistence, 369 00:19:37,660 --> 00:19:40,220 you know, we want to encode it differently. 370 00:19:40,400 --> 00:19:42,860 We want to provide some logic at the back end. 371 00:19:42,860 --> 00:19:45,180 Like, do we want to use a validation field 372 00:19:45,180 --> 00:19:48,820 as an input key to, you know, our Caesar cipher 373 00:19:48,820 --> 00:19:51,220 or a Rot 13 rotational cipher 374 00:19:51,220 --> 00:19:53,220 and then gain a command out of that? 375 00:19:53,360 --> 00:19:55,200 And if the command is valid, go ahead and run it. 376 00:19:55,320 --> 00:19:57,420 And so this is all done on the actual server side. 377 00:19:58,000 --> 00:20:00,620 And that way you can hide your intent across the network 378 00:20:00,620 --> 00:20:01,860 and bridge those gaps. 379 00:20:02,040 --> 00:20:04,840 And these are very simple things that kind of take it to the next level. 380 00:20:05,520 --> 00:20:06,740 Let me just go back real quick. 381 00:20:06,880 --> 00:20:08,980 I just want to give another side example. 382 00:20:09,100 --> 00:20:12,140 Like, imagine that you embed a code 383 00:20:12,140 --> 00:20:14,980 inside the web form where if a particular name, 384 00:20:15,240 --> 00:20:17,740 first name, last name, age, date of birth, 385 00:20:17,900 --> 00:20:19,420 a particular sequence of information 386 00:20:19,420 --> 00:20:21,000 that looks completely innocuous is entered. 387 00:20:21,200 --> 00:20:23,180 That means run this shell command. 388 00:20:23,600 --> 00:20:25,700 So that's going to be very, very hard to detect. 389 00:20:29,580 --> 00:20:32,340 So, I mean, and now that we've talked a little bit 390 00:20:32,340 --> 00:20:34,320 about persistence and continuing, you know, 391 00:20:34,340 --> 00:20:36,620 covert accessing of targets, 392 00:20:36,740 --> 00:20:38,240 I mean, there are other ways of doing this as well. 393 00:20:38,320 --> 00:20:40,700 You know, there's general, like, support accounts 394 00:20:40,700 --> 00:20:42,120 that are automatically added into your network 395 00:20:42,140 --> 00:20:43,540 and, yes, you can crack these in rainbow tables 396 00:20:43,540 --> 00:20:44,920 and you can re-enable them. 397 00:20:45,000 --> 00:20:45,700 You can change names. 398 00:20:45,900 --> 00:20:47,860 You can make a guest look something else. 399 00:20:48,020 --> 00:20:50,440 Now, again, if you're adding guests to the admin group, 400 00:20:50,520 --> 00:20:52,180 that might be a little visible. 401 00:20:52,340 --> 00:20:54,460 But these are simplistic things that you can do 402 00:20:54,460 --> 00:20:56,920 to maintain persistence at a very legitimate level, 403 00:20:57,060 --> 00:20:59,300 which makes it harder at the end for people 404 00:20:59,300 --> 00:21:01,340 to kind of keep track of what's going on. 405 00:21:01,560 --> 00:21:03,960 And, you know, we have some examples of at later, 406 00:21:04,040 --> 00:21:05,600 so we don't want to really get into that 407 00:21:05,600 --> 00:21:07,760 because Val loves at very much, so. 408 00:21:09,120 --> 00:21:11,200 Yeah, a lot of what we're going to be talking about is, 409 00:21:11,200 --> 00:21:13,300 you know, some of it's kind of old stuff, 410 00:21:13,540 --> 00:21:16,000 but the old stuff really, really works very well. 411 00:21:16,340 --> 00:21:18,420 I mean, ask any professional pen tester. 412 00:21:18,640 --> 00:21:21,320 They're going to be using 10-year-old NetBIOS bugs. 413 00:21:24,380 --> 00:21:26,840 Okay, so now that we've done persistence, 414 00:21:27,000 --> 00:21:30,820 we're going to sort of merge into persistence's sister, stealth. 415 00:21:31,800 --> 00:21:33,960 And what we think stealth is all about, 416 00:21:34,040 --> 00:21:34,980 well, it's about hiding your activity 417 00:21:34,980 --> 00:21:37,880 from a whole series of things which might detect you. 418 00:21:38,040 --> 00:21:40,460 Intrusion detection, antivirus, you know, 419 00:21:40,460 --> 00:21:43,440 sysadmins reading their logs, users even. 420 00:21:43,640 --> 00:21:45,640 I mean, often I've been on a pen test 421 00:21:45,640 --> 00:21:47,460 where I've done something weird and the user said, 422 00:21:47,680 --> 00:21:50,000 oh, my box windows started opening 423 00:21:50,000 --> 00:21:52,080 and they called the security guys and then I got caught. 424 00:21:52,980 --> 00:21:54,560 So really it's about hiding yourself 425 00:21:54,560 --> 00:21:55,920 from anything that might detect you. 426 00:21:57,220 --> 00:21:58,560 And why do you care if you hide? 427 00:21:58,680 --> 00:21:59,920 Well, if you get caught, you get stopped. 428 00:22:00,460 --> 00:22:03,320 So, you know, the longer you can go undetected, 429 00:22:03,540 --> 00:22:06,040 it's sort of like you're always going to get hacked. 430 00:22:06,460 --> 00:22:08,000 You're probably always going to get detected 431 00:22:08,000 --> 00:22:09,180 while you're hacking as well. 432 00:22:09,180 --> 00:22:11,420 You know, it's both sides have this problem. 433 00:22:11,780 --> 00:22:13,880 But the longer you can operate, the more you can do. 434 00:22:14,700 --> 00:22:17,100 Also, admins won't fix problems that they don't know exist. 435 00:22:17,380 --> 00:22:18,520 So if you're being really noisy, 436 00:22:18,700 --> 00:22:20,260 you're running a bunch of exploits 437 00:22:20,260 --> 00:22:22,700 and, you know, busting shells all over the place, 438 00:22:23,480 --> 00:22:25,000 the admins might see this and say, 439 00:22:25,080 --> 00:22:26,180 well, I got to start patching. 440 00:22:26,780 --> 00:22:28,900 Or they might not. All right. 441 00:22:29,560 --> 00:22:31,200 Also, I feel very strongly about this. 442 00:22:31,260 --> 00:22:32,300 When you're doing a pen test, 443 00:22:32,980 --> 00:22:35,460 you should be testing really the organization's capabilities 444 00:22:35,460 --> 00:22:38,880 to detect and defend against what you're doing. 445 00:22:39,180 --> 00:22:41,380 A lot of people, their pen test is, 446 00:22:41,500 --> 00:22:42,420 well, we got in. 447 00:22:42,600 --> 00:22:45,300 We got into this many boxes with this many exploits, 448 00:22:45,300 --> 00:22:46,060 and they're done. 449 00:22:46,420 --> 00:22:49,040 But really, you have to assume 450 00:22:49,040 --> 00:22:50,100 that you're going to get broken into, 451 00:22:50,340 --> 00:22:53,420 which as a large organization, you have to rely on detection 452 00:22:53,420 --> 00:22:54,360 and what do you do? 453 00:22:54,440 --> 00:22:55,680 How do you stop it? How do you protect? 454 00:22:56,500 --> 00:22:58,720 So, you know, we don't feel like we've done a good job 455 00:22:58,720 --> 00:23:01,100 unless we've exercised those aspects 456 00:23:01,100 --> 00:23:02,960 of your organization and security as well. 457 00:23:05,020 --> 00:23:06,900 So some of the goals we see for stealth 458 00:23:06,900 --> 00:23:08,560 is to keep the system operable. 459 00:23:09,180 --> 00:23:09,400 That's a big deal. 460 00:23:09,660 --> 00:23:11,380 You know, a lot of these really high-end rootkits 461 00:23:11,380 --> 00:23:14,280 you see people talking about make the system unstable, 462 00:23:14,600 --> 00:23:15,740 cause lots of blue screens, 463 00:23:16,060 --> 00:23:17,860 cause task manager to crash. 464 00:23:19,060 --> 00:23:22,020 So if a system gets really unstable, unusable, 465 00:23:22,460 --> 00:23:24,380 someone's going to come and rebuild it or fix it, 466 00:23:24,480 --> 00:23:25,360 and then you're going to be screwed. 467 00:23:25,940 --> 00:23:27,340 So you want to be able to operate 468 00:23:27,340 --> 00:23:28,180 without fear of detection, 469 00:23:28,460 --> 00:23:29,600 and you want to be robust. 470 00:23:29,900 --> 00:23:32,740 A lot of these stealth rootkit tools 471 00:23:33,160 --> 00:23:34,600 are very difficult to run, 472 00:23:34,700 --> 00:23:35,560 and you have to, like... 473 00:23:35,560 --> 00:23:38,280 There's a lot of work involved. You should just be able to go in, 474 00:23:39,180 --> 00:23:40,260 and then do what you want to do, 475 00:23:40,320 --> 00:23:42,180 and not have to keep babying the tools. 476 00:23:42,720 --> 00:23:44,040 And above all, don't look malicious. 477 00:23:45,180 --> 00:23:47,120 The mere presence of hacker tools 478 00:23:47,120 --> 00:23:49,380 on a target indicates that they've been hacked. 479 00:23:49,540 --> 00:23:51,340 So if you're only using what's there, 480 00:23:51,540 --> 00:23:53,240 what's normal to be on a system, 481 00:23:53,500 --> 00:23:55,780 you're not uploading tons and tons of stuff 482 00:23:55,780 --> 00:23:57,600 from PacketStorm or one of these sites, 483 00:23:58,420 --> 00:24:00,500 they're going to take less of a look at you. 484 00:24:01,800 --> 00:24:03,240 Alright, so there's lots of tools 485 00:24:03,240 --> 00:24:04,580 for evading detection. 486 00:24:05,320 --> 00:24:06,980 Rootkits is the big one everyone talks about. 487 00:24:06,980 --> 00:24:09,500 Metterpreter is a metasploit module 488 00:24:10,960 --> 00:24:11,680 for, basically, 489 00:24:12,060 --> 00:24:13,540 it's one of the payloads you can run. 490 00:24:13,920 --> 00:24:15,080 And it's an amazing tool 491 00:24:15,080 --> 00:24:16,300 for evading detection. 492 00:24:16,540 --> 00:24:17,740 It's pretty good. You should take a look at it. 493 00:24:18,600 --> 00:24:20,420 There's encryption, like Shakataganai 494 00:24:20,420 --> 00:24:22,640 and some of the other encoders for exploits, 495 00:24:22,680 --> 00:24:24,520 which help with IDS evasion. 496 00:24:24,860 --> 00:24:26,680 And log cleaners and all the standard stuff. 497 00:24:27,580 --> 00:24:28,840 And then with your binaries, 498 00:24:28,860 --> 00:24:29,980 as you're uploading your tools, 499 00:24:30,140 --> 00:24:31,840 I mean, one of the tools we're going to show later 500 00:24:31,840 --> 00:24:34,260 while we were testing got detected by an AV and deleted. 501 00:24:34,560 --> 00:24:36,580 And so if you see any of our other 502 00:24:36,980 --> 00:24:38,900 computer talks, all we ever talked about before 503 00:24:38,900 --> 00:24:40,560 was sort of anti-analysis techniques. 504 00:24:40,940 --> 00:24:42,300 So you can use some of those ideas. 505 00:24:45,200 --> 00:24:47,160 So, you know, our perspective on stealth 506 00:24:47,160 --> 00:24:48,380 is don't be different. 507 00:24:48,600 --> 00:24:49,380 Don't be an anomaly. 508 00:24:49,720 --> 00:24:51,540 Don't be something strange on the system. 509 00:24:51,820 --> 00:24:52,920 Hide in plain sight. 510 00:24:53,240 --> 00:24:56,320 Make all of your tools and all your behavior ambiguous. 511 00:24:56,680 --> 00:24:57,920 Well, is that an admin tool? 512 00:24:58,280 --> 00:25:00,200 Could it be used maliciously? 513 00:25:00,340 --> 00:25:02,960 Make it really hard to figure out what's going on. 514 00:25:03,380 --> 00:25:04,940 Another thing of stealth people forget 515 00:25:04,940 --> 00:25:06,040 is the whole concept of, 516 00:25:06,980 --> 00:25:08,280 you know, the guys I'm worried about are over here, 517 00:25:08,300 --> 00:25:09,500 so I'm going to throw a rock over there. 518 00:25:10,520 --> 00:25:12,600 Make one target look really noisy. 519 00:25:12,620 --> 00:25:13,820 Make a server freak out 520 00:25:13,820 --> 00:25:15,940 while you hack quietly on this other server here. 521 00:25:18,340 --> 00:25:20,740 And we focus a lot on trying to know our target's environment. 522 00:25:21,060 --> 00:25:22,740 If you see our tactical exploitation talk 523 00:25:22,740 --> 00:25:23,380 from last year, 524 00:25:24,120 --> 00:25:25,600 a lot of it is about this. 525 00:25:25,760 --> 00:25:27,140 Really knowing what they have 526 00:25:27,140 --> 00:25:29,000 so that you can profile your attacks. 527 00:25:29,340 --> 00:25:31,620 For example, if they're using encryption on all their networks, 528 00:25:32,020 --> 00:25:33,680 maybe you should encrypt what you're doing. 529 00:25:33,680 --> 00:25:35,520 But if they're not, maybe you shouldn't 530 00:25:35,520 --> 00:25:37,500 because an admin might see encryption 531 00:25:37,500 --> 00:25:38,620 going across a network and say, 532 00:25:38,680 --> 00:25:39,880 well, that's weird, we don't use that here. 533 00:25:40,500 --> 00:25:41,960 So change your strategy up. 534 00:25:42,060 --> 00:25:43,620 Don't always follow the same steps. 535 00:25:46,100 --> 00:25:48,040 And don't always focus on exploits. 536 00:25:48,040 --> 00:25:49,900 Usually on big pen tests you use one exploit 537 00:25:49,900 --> 00:25:51,020 and the rest of the time you're doing 538 00:25:51,020 --> 00:25:52,980 all this post-exploitation stuff to break in. 539 00:25:53,460 --> 00:25:55,520 It's very hard to write a regular expression 540 00:25:55,520 --> 00:25:56,080 for intent. 541 00:25:56,720 --> 00:25:59,240 So if you're doing normal behavior 542 00:25:59,240 --> 00:26:01,180 that users do with malicious intent, 543 00:26:01,480 --> 00:26:03,440 no automated system is going to detect 544 00:26:03,680 --> 00:26:04,360 that. It's very difficult. 545 00:26:07,140 --> 00:26:09,200 Also, focus on some crazy techniques 546 00:26:09,200 --> 00:26:10,720 that don't leave any footprint on the network. 547 00:26:11,040 --> 00:26:12,800 Lots of big organizations are moving towards 548 00:26:12,800 --> 00:26:15,380 full packet capture and network logging 549 00:26:15,380 --> 00:26:17,500 and IDSs that store what's been 550 00:26:17,500 --> 00:26:18,100 happening forever. 551 00:26:18,700 --> 00:26:20,840 So use things that aren't ever seen 552 00:26:20,840 --> 00:26:22,560 by these systems at all, like IR ports. 553 00:26:23,040 --> 00:26:24,880 You walk into a room like this full of laptops, 554 00:26:25,160 --> 00:26:26,620 a lot of these laptops have IR ports. 555 00:26:26,960 --> 00:26:28,620 They'll automatically connect to each other, 556 00:26:28,700 --> 00:26:30,280 set up a network, and share folders. 557 00:26:30,600 --> 00:26:32,380 Well, you can just start throwing your Trojans 558 00:26:33,680 --> 00:26:35,540 over IR, and then later when you hack them 559 00:26:35,540 --> 00:26:36,620 your code is already there. 560 00:26:37,160 --> 00:26:39,700 So a forensics analysis or network forensics 561 00:26:39,700 --> 00:26:41,560 is never going to see anything going across 562 00:26:41,560 --> 00:26:43,400 the network sending tools because it never 563 00:26:43,400 --> 00:26:44,860 went on the network. It went over IR, 564 00:26:45,540 --> 00:26:47,100 Bluetooth, or any of these other strange 565 00:26:47,100 --> 00:26:48,200 types of protocols. 566 00:26:49,660 --> 00:26:51,580 Look at IPv6 and old 567 00:26:51,580 --> 00:26:52,920 protocols nobody uses anymore. 568 00:26:53,440 --> 00:26:55,540 A lot of people have their IPv4 interface 569 00:26:56,140 --> 00:26:57,460 firewalled off, but their 570 00:26:57,460 --> 00:26:58,980 IPv6 is sitting there wide open. 571 00:27:00,080 --> 00:27:01,120 So think 572 00:27:01,120 --> 00:27:03,400 about really weird strategies that 573 00:27:03,680 --> 00:27:04,700 are outside of the norm. 574 00:27:06,340 --> 00:27:07,680 Continuing on this idea of 575 00:27:07,680 --> 00:27:08,520 strange ideas 576 00:27:09,380 --> 00:27:11,740 outside of the norm, in Windows 577 00:27:11,740 --> 00:27:13,660 basically you have securable objects. 578 00:27:13,840 --> 00:27:15,380 This could be a file, this could be a registry key, 579 00:27:15,600 --> 00:27:16,960 this could be a policy, basically. 580 00:27:17,580 --> 00:27:19,540 So logging is completely based upon all 581 00:27:19,540 --> 00:27:21,180 of these things. So if there's 582 00:27:21,180 --> 00:27:23,940 no logs, there's nothing to look at. 583 00:27:24,360 --> 00:27:25,560 Well, okay, but 584 00:27:26,240 --> 00:27:27,380 what about, you know, 585 00:27:27,420 --> 00:27:29,460 logging's a good thing. If I just turn off all your logs 586 00:27:29,460 --> 00:27:31,780 you'll probably notice that something's 587 00:27:31,780 --> 00:27:33,320 a little strange. So wait, wait a minute. 588 00:27:33,680 --> 00:27:35,520 We can do the exact same thing. We can cause almost 589 00:27:35,520 --> 00:27:36,880 a denial of service, in a sense, 590 00:27:37,000 --> 00:27:39,600 where we can put audit on success 591 00:27:39,600 --> 00:27:41,560 of opening, you know, hkey 592 00:27:41,560 --> 00:27:43,560 local machine run. That doesn't get called 593 00:27:43,560 --> 00:27:44,620 ever in a normal day. 594 00:27:44,900 --> 00:27:47,520 If you're generating thousands and thousands 595 00:27:47,520 --> 00:27:49,520 of legitimate accesses, the logs 596 00:27:49,520 --> 00:27:51,380 will fill up with plenty of noise, 597 00:27:51,460 --> 00:27:53,400 and then you could either choose to allow 598 00:27:53,400 --> 00:27:55,440 them to log your actual malicious actions 599 00:27:55,440 --> 00:27:57,220 or not log. But, you know, 600 00:27:57,320 --> 00:27:59,420 an admin will take a great deal of time 601 00:27:59,420 --> 00:28:01,280 hunting down all of these 602 00:28:01,280 --> 00:28:03,300 individual little pieces, and if you're 603 00:28:03,680 --> 00:28:05,660 not doing it programmatically, it's pretty much 604 00:28:05,660 --> 00:28:07,540 impossible, because I can enumerate through an entire 605 00:28:07,540 --> 00:28:09,240 file system that gets opened daily 606 00:28:10,000 --> 00:28:11,660 and create it so on accessible, 607 00:28:11,980 --> 00:28:13,140 you know, on successful 608 00:28:13,660 --> 00:28:15,560 opening of any of these objects, go ahead 609 00:28:15,560 --> 00:28:17,420 and log something to the security log for me. 610 00:28:17,880 --> 00:28:19,840 That turns into a real headache really quickly 611 00:28:19,840 --> 00:28:21,620 and can be very useful. Yeah, you might even 612 00:28:21,620 --> 00:28:23,360 get the admin to turn logging off for you 613 00:28:23,360 --> 00:28:24,080 without doing anything. 614 00:28:31,820 --> 00:28:33,560 I'm glad I got my AV guy with me. 615 00:28:35,160 --> 00:28:35,740 I try. 616 00:28:35,960 --> 00:28:36,220 I try. 617 00:28:36,820 --> 00:28:38,660 So, I mean, we're going to give just a general example 618 00:28:38,660 --> 00:28:41,440 of some logging stuff affecting auditing, 619 00:28:41,520 --> 00:28:42,540 affecting local policies. 620 00:28:43,240 --> 00:28:45,700 So, as we see here, we actually have multiple views. 621 00:28:46,020 --> 00:28:47,660 And you might notice we're using 622 00:28:47,660 --> 00:28:49,640 a lot of old tools. That's because the old stuff still works. 623 00:28:50,180 --> 00:28:51,480 PS exec still rocks 624 00:28:51,480 --> 00:28:52,540 if they don't block it. 625 00:28:52,960 --> 00:28:55,200 So, here, this is for the audience. 626 00:28:55,300 --> 00:28:57,480 This is the view on the system. We've got the firewall up. 627 00:28:57,580 --> 00:28:58,900 We have some logs on the screen. 628 00:28:59,060 --> 00:29:01,180 We have some auditing, you know, on success, failure, 629 00:29:01,320 --> 00:29:03,380 normal things that you would actually expect 630 00:29:03,680 --> 00:29:03,980 from the system. 631 00:29:08,140 --> 00:29:09,400 And so, we're going to go in again. 632 00:29:09,540 --> 00:29:11,400 We have an account on this box, so obviously 633 00:29:11,400 --> 00:29:12,960 we can update to it. Post exploitation. 634 00:29:13,360 --> 00:29:13,600 Yes. 635 00:29:15,020 --> 00:29:17,000 And we're going to, you know, query to make sure 636 00:29:17,000 --> 00:29:18,700 that the firewall's actually on. 637 00:29:18,900 --> 00:29:20,320 And it is. Huzzah. 638 00:29:20,600 --> 00:29:21,560 Let's go ahead and stop it. 639 00:29:24,220 --> 00:29:25,080 And, you know, 640 00:29:25,220 --> 00:29:27,800 we also want to stop, you know, some antivirus 641 00:29:27,800 --> 00:29:29,780 if it's there. Take that Symantec. 642 00:29:30,500 --> 00:29:31,580 Some antivirus will be much 643 00:29:31,580 --> 00:29:33,660 harder to stop, but Symantec's... Yeah. 644 00:29:33,680 --> 00:29:34,240 Pretty easy. 645 00:29:35,700 --> 00:29:37,540 So then we'll go ahead and, you know, make 646 00:29:37,540 --> 00:29:39,520 an actual directory for our tools. 647 00:29:40,220 --> 00:29:41,660 And we'll share that out, 648 00:29:41,720 --> 00:29:43,200 you know, because we're nice guys. We like to use 649 00:29:43,740 --> 00:29:45,720 NetBio sharing. It's a terribly useful tool. 650 00:29:46,740 --> 00:29:47,600 And then we mount 651 00:29:47,600 --> 00:29:49,000 it on our attacking machine. 652 00:29:50,580 --> 00:29:51,060 And 653 00:29:51,620 --> 00:29:53,760 copy everything over. Now we have some good things. 654 00:29:53,840 --> 00:29:55,240 We have two tools here, basically 655 00:29:55,240 --> 00:29:57,100 audit policy and clear logs. 656 00:29:57,600 --> 00:29:59,580 Audit policy will programmatically alter 657 00:29:59,580 --> 00:30:00,500 your auditing 658 00:30:01,380 --> 00:30:03,660 as well as many other things. 659 00:30:03,680 --> 00:30:05,220 But clear log is the next one. 660 00:30:06,780 --> 00:30:07,540 So we've 661 00:30:07,540 --> 00:30:09,000 set all of the auditing to nothing. 662 00:30:11,620 --> 00:30:13,360 And we've gone ahead and cleared the logs. 663 00:30:13,980 --> 00:30:15,400 Now, of course, you could turn auditing back. 664 00:30:15,520 --> 00:30:17,440 Now you could do your evil and then come back 665 00:30:17,440 --> 00:30:19,260 and turn the logs back on and make everything normal. 666 00:30:19,420 --> 00:30:20,880 And then there's just a blip in time, 667 00:30:21,000 --> 00:30:22,800 which is probably harder to detect. 668 00:30:24,980 --> 00:30:25,540 We'll go ahead 669 00:30:25,540 --> 00:30:27,620 and refresh all these wonderful tools here 670 00:30:28,260 --> 00:30:29,160 so we can see 671 00:30:29,160 --> 00:30:30,520 a nice gooey view of it. 672 00:30:32,900 --> 00:30:33,660 No firewalls. 673 00:30:34,240 --> 00:30:35,900 No logs in the actual log 674 00:30:35,900 --> 00:30:37,420 over there. And no auditing. 675 00:30:37,780 --> 00:30:39,600 And we haven't been sending NOPs across 676 00:30:39,600 --> 00:30:41,060 the network. We haven't been sending, you know, 677 00:30:41,580 --> 00:30:42,820 255As across the network. 678 00:30:43,380 --> 00:30:45,420 Yeah, we're doing sort of weird old 679 00:30:46,180 --> 00:30:47,560 traditional stuff, but 680 00:30:47,560 --> 00:30:49,680 people are so focused nowadays on 681 00:30:49,680 --> 00:30:51,640 exploits and all the new 682 00:30:51,640 --> 00:30:53,600 things coming out that a lot of this old 683 00:30:53,600 --> 00:30:55,700 stuff is either hard to tell that it's 684 00:30:55,700 --> 00:30:57,280 malicious or it'll be easily missed. 685 00:30:58,780 --> 00:30:59,660 A lot of what 686 00:30:59,660 --> 00:31:01,600 we'll do is we'll actually do what we 687 00:31:01,600 --> 00:31:03,560 just demonstrated where we clear out the logs and all this 688 00:31:03,680 --> 00:31:05,360 and then put everything back. Like, we'll make a backup 689 00:31:05,360 --> 00:31:06,880 of what the security policies are. 690 00:31:07,440 --> 00:31:09,540 We'll turn the firewall back on. We'll turn the AV 691 00:31:09,540 --> 00:31:11,300 back on. So we'll get into a box, 692 00:31:11,480 --> 00:31:13,600 turn everything off, do our evil, put it back to the 693 00:31:13,600 --> 00:31:15,680 way it was, and it's going to be hard 694 00:31:15,680 --> 00:31:17,080 for them to realize that we're over there. 695 00:31:19,020 --> 00:31:19,380 Alright. 696 00:31:19,520 --> 00:31:21,000 So now we're going to talk about user identity theft. 697 00:31:21,840 --> 00:31:23,560 And I don't mean social security numbers. 698 00:31:24,740 --> 00:31:25,100 So 699 00:31:25,500 --> 00:31:26,900 often it's not always about root. 700 00:31:27,460 --> 00:31:29,240 It's about what access can you get. 701 00:31:29,420 --> 00:31:31,580 You know, a lot of networks will actually set up root to 702 00:31:32,240 --> 00:31:33,320 not be able to access 703 00:31:33,680 --> 00:31:35,500 users' home directories so that 704 00:31:35,500 --> 00:31:37,060 there's for privacy concerns, whatever. 705 00:31:37,500 --> 00:31:39,440 So when you're doing post-exploitation 706 00:31:39,440 --> 00:31:41,320 activities, you want it to look like 707 00:31:41,320 --> 00:31:42,920 whoever you want, whenever you want. 708 00:31:43,320 --> 00:31:45,720 Use the credentials and access that someone else has. 709 00:31:46,200 --> 00:31:47,580 You know, the goals here are to 710 00:31:47,580 --> 00:31:48,540 change your identity at will, 711 00:31:49,400 --> 00:31:51,640 whether it's domain credentials, user ID, 712 00:31:52,180 --> 00:31:52,960 existing sessions, 713 00:31:53,420 --> 00:31:54,840 impersonating system accounts, whatever. 714 00:31:55,180 --> 00:31:57,580 And this is all in order to make your activities 715 00:31:57,580 --> 00:31:58,740 look like normal user behavior. 716 00:31:59,100 --> 00:32:01,580 You know, if they see account hacked going across the network 717 00:32:01,580 --> 00:32:03,500 doing lots of weird stuff, it's pretty obvious. 718 00:32:03,680 --> 00:32:05,820 But if they see Joe DBA 719 00:32:05,820 --> 00:32:07,080 accessing the database, 720 00:32:07,400 --> 00:32:08,660 that's what he does every day. 721 00:32:10,520 --> 00:32:10,960 So 722 00:32:10,960 --> 00:32:13,680 the stages of this are first you want to target the users. 723 00:32:13,960 --> 00:32:14,660 So while you're going through, 724 00:32:14,760 --> 00:32:17,600 gather intelligence about who has access to what data. 725 00:32:18,560 --> 00:32:19,160 You know, 726 00:32:19,180 --> 00:32:21,420 if you see Joe DBA, it's likely 727 00:32:21,420 --> 00:32:22,600 he's going to be the database guy. 728 00:32:23,500 --> 00:32:25,380 You want to change your identity by hijacking 729 00:32:25,380 --> 00:32:27,220 credentials, which we're going to show how to do. 730 00:32:28,220 --> 00:32:29,720 Access is the end goal, 731 00:32:29,900 --> 00:32:30,480 not root. 732 00:32:31,820 --> 00:32:33,480 So there's actually some pretty 733 00:32:33,680 --> 00:32:34,520 cool tools to do this. 734 00:32:34,880 --> 00:32:36,300 There's a tool, and we're going to show 735 00:32:36,300 --> 00:32:38,160 some stuff with it, called Incognito. 736 00:32:38,640 --> 00:32:40,360 It's actually been built into Metasploit now. 737 00:32:40,560 --> 00:32:42,520 It's very, very useful as you hijack tokens. 738 00:32:43,520 --> 00:32:45,200 The FURootkit from rootkit.com 739 00:32:46,040 --> 00:32:47,240 is very cool, and 740 00:32:47,240 --> 00:32:49,460 you can actually extend it to do some interesting things. 741 00:32:50,520 --> 00:32:51,460 And then some more 742 00:32:51,460 --> 00:32:52,860 traditional things, process injection, 743 00:32:53,160 --> 00:32:53,740 things like this. 744 00:32:55,200 --> 00:32:57,420 So, you know, in this wonderful world 745 00:32:57,420 --> 00:32:58,640 of identity theft, we still have 746 00:32:58,640 --> 00:33:00,260 securable objects, we still have a bunch of crap. 747 00:33:00,260 --> 00:33:01,760 And I used to say this, 748 00:33:01,880 --> 00:33:04,160 but I'm tired, and I just don't want to say it anymore. 749 00:33:04,520 --> 00:33:06,140 But, you know, what we basically 750 00:33:06,140 --> 00:33:08,040 want is a privilege. Privileges is controlled by 751 00:33:08,040 --> 00:33:10,400 SIDs and tokens on Windows systems. 752 00:33:10,640 --> 00:33:11,880 And since we're very Windows-centric 753 00:33:12,380 --> 00:33:14,220 here for this talk, that's what we're 754 00:33:14,220 --> 00:33:16,380 going to stick with. And what do we want? 755 00:33:16,460 --> 00:33:18,040 We want access. And what do we get? 756 00:33:18,180 --> 00:33:19,460 Access, access, access. 757 00:33:19,880 --> 00:33:21,480 And basically, you know, we're going to show 758 00:33:22,040 --> 00:33:23,740 how we'll use Incognito to 759 00:33:24,260 --> 00:33:26,260 swipe leftover tokens that 760 00:33:26,260 --> 00:33:28,040 are on a box to then elevate 761 00:33:28,040 --> 00:33:30,060 privileges to something that's a little more useful 762 00:33:30,260 --> 00:33:30,860 for us in targeting. 763 00:33:32,400 --> 00:33:34,160 Alright, so basically what we're 764 00:33:34,160 --> 00:33:36,080 going to demo here, a little bit 765 00:33:36,080 --> 00:33:38,020 might be slightly tedious because it's stuff 766 00:33:38,020 --> 00:33:40,040 you probably know, but we really wanted to show 767 00:33:40,040 --> 00:33:41,880 the entire mindset and step-by-step process 768 00:33:41,880 --> 00:33:44,040 of starting with one host that we've 769 00:33:44,040 --> 00:33:46,100 hacked, how do we take over an entire 770 00:33:46,100 --> 00:33:47,820 domain? It's already loaded. 771 00:33:48,320 --> 00:33:50,060 So we're going to actually take over 772 00:33:50,060 --> 00:33:52,180 a domain admin and do what we want. 773 00:33:52,460 --> 00:33:54,040 Alright, so we're doing our traditional 774 00:33:54,040 --> 00:33:55,940 enumeration stuff, looking for hosts to go after. 775 00:33:56,180 --> 00:33:58,040 And we're just sort of using sort of innocuous 776 00:33:58,040 --> 00:34:00,160 looking things rather than Nessus or whatever. 777 00:34:00,260 --> 00:34:02,200 So we're looking for 778 00:34:02,200 --> 00:34:03,620 like the servers and the clients. 779 00:34:03,860 --> 00:34:05,660 And here we sort of contrived an example. 780 00:34:06,040 --> 00:34:07,880 So we're looking at it. We're going to run 781 00:34:08,660 --> 00:34:10,180 some random Metasploit exploit 782 00:34:10,180 --> 00:34:11,700 that we know will work on this system. 783 00:34:12,480 --> 00:34:14,120 This demo is about what 784 00:34:14,120 --> 00:34:15,200 happens after you break in. 785 00:34:16,680 --> 00:34:18,100 Alright, so we exploit the box. 786 00:34:18,400 --> 00:34:20,100 We're using Meterpreter as our payload. 787 00:34:20,360 --> 00:34:21,900 So we really, really like Meterpreter. 788 00:34:22,240 --> 00:34:24,140 You should also like Meterpreter. 789 00:34:24,680 --> 00:34:25,620 Meterpreter has a 790 00:34:26,210 --> 00:34:28,080 file browser built into it 791 00:34:28,080 --> 00:34:29,940 that lets you transfer files over. 792 00:34:30,260 --> 00:34:31,560 It's a communications channel. 793 00:34:31,980 --> 00:34:33,880 So we're just going to transfer 794 00:34:33,880 --> 00:34:35,760 some random password dumping tool. 795 00:34:36,480 --> 00:34:38,320 And again, some of this 796 00:34:38,320 --> 00:34:40,120 you know, but it's the step-by-step 797 00:34:40,120 --> 00:34:41,720 concepts of starting 798 00:34:42,120 --> 00:34:44,340 from the beginning getting to running the domain. 799 00:34:45,260 --> 00:34:46,120 We're going to use a tool 800 00:34:46,120 --> 00:34:47,500 called Sam Juicer, which 801 00:34:48,180 --> 00:34:50,080 is part of Metasploit research. 802 00:34:50,500 --> 00:34:51,360 Vinnie Lu wrote it. 803 00:34:51,800 --> 00:34:52,760 It's pretty decent. 804 00:34:54,140 --> 00:34:55,780 Alright, so using Meterpreter, 805 00:34:55,960 --> 00:34:58,160 we've set up a shell. And I know you can't 806 00:34:58,160 --> 00:34:59,760 read that, but it's actually not that important. 807 00:35:00,260 --> 00:35:01,000 We're going to use dumping passwords. 808 00:35:02,280 --> 00:35:03,740 So we have local access 809 00:35:03,740 --> 00:35:04,980 to one machine on the network. 810 00:35:05,220 --> 00:35:06,340 We've captured their hashes. 811 00:35:06,760 --> 00:35:08,160 And we're going to crack them. 812 00:35:08,360 --> 00:35:10,800 When it comes to Windows, obviously 813 00:35:10,800 --> 00:35:12,780 you're going to get the passwords eventually. 814 00:35:13,180 --> 00:35:14,400 You're going to use Rainbow Crack 815 00:35:14,400 --> 00:35:15,480 or BruteForce or whatever. 816 00:35:15,960 --> 00:35:17,220 And you'll get the account. 817 00:35:18,020 --> 00:35:20,080 But the more important thing here is 818 00:35:20,080 --> 00:35:21,140 what account to go after. 819 00:35:21,320 --> 00:35:22,680 How do we know which account to target? 820 00:35:23,620 --> 00:35:25,900 Should we crack all ten passwords we just dumped? 821 00:35:25,900 --> 00:35:27,760 Well, that might be a waste of processing resources. 822 00:35:28,740 --> 00:35:30,240 So we're going to run a couple of commands. 823 00:35:30,440 --> 00:35:31,840 And we'll zoom in here in a sec 824 00:35:31,840 --> 00:35:33,060 so you can actually see what we're doing. 825 00:35:34,260 --> 00:35:35,340 We're running net 826 00:35:35,760 --> 00:35:37,860 local group administrators because we want to target 827 00:35:37,860 --> 00:35:39,040 who's in the admin group. 828 00:35:39,240 --> 00:35:41,160 Well, there's an account called Local Val Smith 829 00:35:41,560 --> 00:35:42,680 which is in the admin group. 830 00:35:43,120 --> 00:35:45,360 What this tells us is, okay, who cares about all the other accounts? 831 00:35:45,520 --> 00:35:46,480 Let's just crack that one. 832 00:35:47,940 --> 00:35:50,180 And then we're enumerating the domain admins. 833 00:35:50,220 --> 00:35:51,780 Well, there's one called Admin Val Smith. 834 00:35:52,020 --> 00:35:54,060 So that tells us who we want to go after next. 835 00:35:54,860 --> 00:35:55,620 We're building our 836 00:35:55,900 --> 00:35:57,500 attack plan as we go along. 837 00:35:58,940 --> 00:35:59,480 All right. 838 00:35:59,520 --> 00:36:01,220 So we really like Loftcrack still. 839 00:36:01,380 --> 00:36:02,820 I know it's old, but it's still cool. 840 00:36:03,860 --> 00:36:05,300 So we've cracked it. Whatever. 841 00:36:06,840 --> 00:36:07,720 Now we're going to move on 842 00:36:07,720 --> 00:36:08,400 to the next stage. 843 00:36:10,920 --> 00:36:11,720 Incognito has a 844 00:36:11,720 --> 00:36:13,840 standalone mode, which we really want to show 845 00:36:13,840 --> 00:36:15,520 a lot of the manual, hands-on techniques. 846 00:36:16,020 --> 00:36:18,220 And it has sort of a long command line. 847 00:36:18,440 --> 00:36:19,680 But the first thing we're going to do 848 00:36:19,680 --> 00:36:20,740 is we want to enumerate tokens. 849 00:36:21,140 --> 00:36:23,780 And if you noticed before, MetaPass does this for you now. 850 00:36:24,060 --> 00:36:25,760 So we have the automated 851 00:36:25,900 --> 00:36:26,780 way and the manual way. 852 00:36:28,460 --> 00:36:30,180 So with Incognito, 853 00:36:30,240 --> 00:36:31,560 you pass it the username and password 854 00:36:31,560 --> 00:36:33,500 that you cracked that's a local account on the box. 855 00:36:33,720 --> 00:36:35,720 And it tells you that there's a token 856 00:36:35,720 --> 00:36:37,780 present for the domain admin 857 00:36:37,780 --> 00:36:38,620 that we want to target. 858 00:36:40,440 --> 00:36:41,600 So now we're going to go ahead 859 00:36:41,600 --> 00:36:43,400 and write a new command that says 860 00:36:43,400 --> 00:36:45,440 give us a shell using the account 861 00:36:45,440 --> 00:36:46,580 that we've hacked that's local 862 00:36:47,440 --> 00:36:49,500 and hijack the domain admin credentials 863 00:36:49,500 --> 00:36:51,180 off of the box. Believe it or not, 864 00:36:51,220 --> 00:36:52,880 when you log out, your credentials don't go away. 865 00:36:53,120 --> 00:36:54,620 They don't really go away until you reboot. 866 00:36:55,900 --> 00:36:57,660 I'm not sure what the design theory is behind that. 867 00:36:58,340 --> 00:36:59,700 Alright, so now we've got a shell. 868 00:37:00,480 --> 00:37:01,740 I'm running it on my tool. 869 00:37:02,180 --> 00:37:03,860 And basically we're domain admin. 870 00:37:04,140 --> 00:37:05,180 And that's really all it took. 871 00:37:05,780 --> 00:37:07,460 There's a lot of theory behind the way that 872 00:37:07,460 --> 00:37:09,680 Incognito works. I recommend reading 873 00:37:09,680 --> 00:37:10,900 Luke Jennings' paper on it. 874 00:37:11,440 --> 00:37:13,680 It's pretty awesome. But just to prove that we have 875 00:37:13,680 --> 00:37:15,800 domain admin, we're now adding a hacked account 876 00:37:15,800 --> 00:37:17,640 to the domain. I don't recommend doing this 877 00:37:17,640 --> 00:37:19,240 in practice because it's really obvious. 878 00:37:19,560 --> 00:37:21,500 But this just shows that our access is working. 879 00:37:22,560 --> 00:37:24,000 So we've added a username and password 880 00:37:24,000 --> 00:37:25,740 to the domain. And we're going to go check 881 00:37:25,900 --> 00:37:27,680 the domain admins group on the target 882 00:37:27,680 --> 00:37:29,720 that we hacked to verify that it all worked. 883 00:37:32,440 --> 00:37:33,520 And there it is. 884 00:37:33,660 --> 00:37:35,520 We've added our hacked account 885 00:37:35,520 --> 00:37:36,760 to the domain admins group. 886 00:37:37,080 --> 00:37:38,940 So we've basically taken over domain using 887 00:37:38,940 --> 00:37:40,580 only local access to one machine. 888 00:37:41,840 --> 00:37:43,760 And we're automating a lot of these 889 00:37:43,760 --> 00:37:45,400 types of attacks inside of Metasploit. 890 00:37:45,500 --> 00:37:47,080 And we'll be releasing the modules for them. 891 00:37:47,820 --> 00:37:48,740 So look for that. 892 00:37:56,480 --> 00:37:56,920 Okay. 893 00:37:57,640 --> 00:37:59,560 Alright, next subject matter. Feature modification. 894 00:38:01,320 --> 00:38:03,720 This is the idea of changing existing features 895 00:38:03,720 --> 00:38:05,960 on a system to benefit our post-exploitation 896 00:38:05,960 --> 00:38:06,400 activities. 897 00:38:08,120 --> 00:38:10,060 You know, whether a little bit 898 00:38:10,060 --> 00:38:11,420 of it's kind of related to stealth. 899 00:38:11,520 --> 00:38:13,320 All these subjects intertwine and they're all 900 00:38:13,320 --> 00:38:15,600 really part of each other. But, you know, 901 00:38:15,600 --> 00:38:17,320 maybe you want to enable and secure things. 902 00:38:17,500 --> 00:38:19,140 Or you want to re-enable things they've turned off. 903 00:38:22,000 --> 00:38:23,420 And again, you know, 904 00:38:23,460 --> 00:38:25,660 obviously I like securable objects a little 905 00:38:25,900 --> 00:38:27,240 too much. It's probably a bad thing. 906 00:38:27,440 --> 00:38:29,940 But again, I mean, this is what controls all these things. 907 00:38:30,060 --> 00:38:31,560 This is how you disable things on Windows. 908 00:38:31,720 --> 00:38:33,680 This is how we want to leverage this 909 00:38:33,680 --> 00:38:35,800 to re-enable them. And basically, you know, 910 00:38:35,840 --> 00:38:37,340 these are what we have to do to do it. 911 00:38:37,420 --> 00:38:39,280 And it plays many roles. 912 00:38:39,600 --> 00:38:41,800 And so we've showed multiple variants 913 00:38:41,800 --> 00:38:43,320 of it, like how you use it here, 914 00:38:43,420 --> 00:38:45,240 how you use it there, and when it's important. 915 00:38:49,680 --> 00:38:51,580 Alright. We really like movies, so we're going to be 916 00:38:51,580 --> 00:38:52,480 showing a few of them here. 917 00:38:52,660 --> 00:38:55,400 But, yeah, basically 918 00:38:55,900 --> 00:38:57,740 you know, we're going to show a fun demo here 919 00:38:57,740 --> 00:38:59,580 in a second about re-enabling GUI access 920 00:38:59,580 --> 00:39:01,680 remotely from a command line, and why 921 00:39:01,680 --> 00:39:03,160 you would even care about doing this. 922 00:39:04,200 --> 00:39:05,820 But, you know, you've got to be careful with this 923 00:39:05,820 --> 00:39:07,700 because sometimes turning stuff that they've 924 00:39:07,700 --> 00:39:09,620 intentionally turned off is a bad idea because 925 00:39:09,620 --> 00:39:10,200 it gets you caught. 926 00:39:11,720 --> 00:39:13,740 Alright, so we've just provided a slide. I'm not going to 927 00:39:13,740 --> 00:39:15,880 read the whole thing, but this slide 928 00:39:15,880 --> 00:39:17,880 helps you enable 929 00:39:17,880 --> 00:39:19,840 VNC, like install it and turn 930 00:39:19,840 --> 00:39:21,820 it on remotely. If you've got 931 00:39:21,820 --> 00:39:23,680 an exploit, you can use the Metasploit 932 00:39:23,680 --> 00:39:25,400 module for injecting VNC. 933 00:39:25,900 --> 00:39:27,220 But a lot of times you've broken it with a password. 934 00:39:28,060 --> 00:39:29,640 So, you know, you've got a password, 935 00:39:29,820 --> 00:39:31,600 you can get a shell through PsExec or 936 00:39:31,600 --> 00:39:33,780 some other way. So how do you install 937 00:39:33,780 --> 00:39:35,740 it fairly legitimately over a 938 00:39:35,740 --> 00:39:37,820 command line? Well, this is how you 939 00:39:37,820 --> 00:39:39,280 do it. You make a registry file 940 00:39:39,280 --> 00:39:41,800 that looks like this. There's tools 941 00:39:41,800 --> 00:39:43,780 out there to encode your password in the format that 942 00:39:43,780 --> 00:39:45,860 it needs. You install this using these 943 00:39:45,860 --> 00:39:47,600 commands, and we'll show a little quick demo. 944 00:39:53,620 --> 00:39:55,780 Now, the reason you would do this is 945 00:39:55,900 --> 00:39:57,780 a lot of times the system 946 00:39:57,780 --> 00:39:59,680 you're going after is running 947 00:39:59,680 --> 00:40:01,620 an application that doesn't have a command line 948 00:40:01,620 --> 00:40:03,880 component to it. And often you don't even care 949 00:40:03,880 --> 00:40:05,500 if you get root. You want access to the application. 950 00:40:05,760 --> 00:40:07,460 We'll show you why at the end of this demo here. 951 00:40:09,380 --> 00:40:09,780 Alright, 952 00:40:09,920 --> 00:40:11,360 so, you know, we've hacked this machine. 953 00:40:11,600 --> 00:40:13,860 We have a command shell on it. We're going to establish 954 00:40:13,860 --> 00:40:15,680 authentication to it using this password 955 00:40:15,680 --> 00:40:16,740 that we've cracked or whatever. 956 00:40:21,240 --> 00:40:21,640 Alright. 957 00:40:22,540 --> 00:40:23,900 So, we're going to gain a shell. 958 00:40:25,200 --> 00:40:25,880 You can use 959 00:40:25,900 --> 00:40:27,080 lots of different things. We're using 960 00:40:27,080 --> 00:40:28,560 PsExact because it's easy. 961 00:40:30,400 --> 00:40:31,580 And we're going to add a director 962 00:40:31,580 --> 00:40:33,960 under Program Files. Now, a lot of people 963 00:40:33,960 --> 00:40:35,760 will look in Windows System 2 for 964 00:40:35,760 --> 00:40:37,640 malware, System 3 too, but 965 00:40:38,060 --> 00:40:39,760 you know, sticking stuff 966 00:40:39,760 --> 00:40:41,340 in Program Files works pretty good too. 967 00:40:41,860 --> 00:40:43,340 We're going to share this out to ourselves 968 00:40:43,340 --> 00:40:44,620 so we can copy files to it. 969 00:40:46,440 --> 00:40:47,700 And I advise turning shares 970 00:40:47,700 --> 00:40:49,240 off after you're done using them. 971 00:40:52,520 --> 00:40:53,720 Alright, so we're going to connect 972 00:40:53,720 --> 00:40:55,620 to the share that we made. This is all like 973 00:40:55,900 --> 00:40:57,440 1994 NetBio stuff. 974 00:40:58,960 --> 00:40:59,880 Alright, so we copy 975 00:40:59,880 --> 00:41:00,720 our tools over there. 976 00:41:03,480 --> 00:41:05,380 We're going to go in there. Everything looks good. 977 00:41:05,940 --> 00:41:07,280 So, we're going to add the registry 978 00:41:07,880 --> 00:41:09,540 settings using regedit. 979 00:41:11,040 --> 00:41:11,580 We're going to 980 00:41:11,580 --> 00:41:13,140 install the service for VNC. 981 00:41:15,220 --> 00:41:15,820 And then 982 00:41:15,820 --> 00:41:17,660 I believe we're going to start the service. 983 00:41:23,120 --> 00:41:23,520 Remember, 984 00:41:23,660 --> 00:41:24,620 we have to wait for it to install. 985 00:41:25,900 --> 00:41:26,760 It takes a little time. 986 00:41:26,960 --> 00:41:29,440 And for some reason, installing VNC this way, 987 00:41:29,500 --> 00:41:31,340 starting the service always fails the first try. 988 00:41:32,100 --> 00:41:33,860 I don't know if it's a timing issue or what, 989 00:41:33,960 --> 00:41:35,600 but the second try always works, so 990 00:41:36,060 --> 00:41:36,920 keep that in mind. 991 00:41:38,480 --> 00:41:39,740 Alright, so now we're going to connect 992 00:41:39,740 --> 00:41:41,560 to our target. Metasploit actually provides 993 00:41:41,560 --> 00:41:43,900 a VNC viewer for you if you want to use that. 994 00:41:45,960 --> 00:41:46,780 So we're going to connect. 995 00:41:47,780 --> 00:41:49,440 So we started off with a command line, 996 00:41:49,540 --> 00:41:50,720 which is pretty good for most things. 997 00:41:50,900 --> 00:41:52,460 And a lot of hackers focus on command lines. 998 00:41:52,640 --> 00:41:54,660 But what if what you want isn't on the command line? 999 00:41:55,900 --> 00:41:57,400 Let's say telecommunications and 1000 00:41:57,400 --> 00:41:58,820 power and phone 1001 00:41:59,740 --> 00:42:01,640 monitoring and configuring 1002 00:42:01,640 --> 00:42:01,840 systems. 1003 00:42:03,040 --> 00:42:05,620 These are unlikely to be accessible via a command line. 1004 00:42:06,260 --> 00:42:07,760 But lots of systems use 1005 00:42:07,760 --> 00:42:09,080 VNC for remote administration. 1006 00:42:09,580 --> 00:42:11,620 And so, you know, you've just 1007 00:42:11,620 --> 00:42:13,620 enabled yourself further access that you didn't have. 1008 00:42:25,060 --> 00:42:25,640 Alright. 1009 00:42:25,900 --> 00:42:27,640 So, you know, 1010 00:42:27,680 --> 00:42:29,000 on a sort of similar topic, 1011 00:42:30,820 --> 00:42:32,320 we just added VNC. 1012 00:42:32,560 --> 00:42:33,920 But, okay, well, VNC isn't 1013 00:42:33,920 --> 00:42:35,260 something they had there natively. 1014 00:42:35,320 --> 00:42:37,440 So are they going to detect it? Well, possibly. 1015 00:42:37,560 --> 00:42:39,560 Maybe in a corporate port scan 1016 00:42:39,560 --> 00:42:40,940 they're going to see this weird port open. 1017 00:42:41,260 --> 00:42:43,480 Okay, well, what about a remote desktop? 1018 00:42:43,660 --> 00:42:45,680 That's something that is fairly legitimate 1019 00:42:45,680 --> 00:42:47,880 and is already on your system, just often disabled. 1020 00:42:48,240 --> 00:42:49,180 And why do you want this? 1021 00:42:49,300 --> 00:42:51,200 Well, maybe the system you're going after is running 1022 00:42:51,200 --> 00:42:52,700 the security cameras for the company, 1023 00:42:52,840 --> 00:42:55,120 and you want to see what's going on on these cameras. 1024 00:42:55,900 --> 00:42:57,000 Or who knows what else evil. 1025 00:42:59,260 --> 00:42:59,740 Alright. 1026 00:42:59,860 --> 00:43:01,600 So, enabling remote desktop is actually 1027 00:43:01,600 --> 00:43:03,400 much more difficult than enabling VNC. 1028 00:43:05,360 --> 00:43:07,240 You have to do a lot of work with 1029 00:43:08,040 --> 00:43:08,520 GPOs. 1030 00:43:08,760 --> 00:43:11,480 So we've created this policy file, which we'll provide 1031 00:43:11,480 --> 00:43:13,300 in the slides, which will 1032 00:43:13,900 --> 00:43:15,620 enable remote desktop for you. 1033 00:43:15,660 --> 00:43:16,680 Terminal services, basically. 1034 00:43:17,320 --> 00:43:19,200 Change the account to whatever real account 1035 00:43:19,200 --> 00:43:20,140 you have access to. 1036 00:43:22,200 --> 00:43:22,680 Alright. 1037 00:43:22,820 --> 00:43:25,460 So then there's another file you need to create with some registry settings 1038 00:43:25,900 --> 00:43:27,260 that turns on terminal services. 1039 00:43:27,460 --> 00:43:29,120 And then a set of commands that you run. 1040 00:43:32,420 --> 00:43:33,600 We really love movies. 1041 00:43:35,200 --> 00:43:38,120 And the stuff in the slides is really for you later. 1042 00:43:38,380 --> 00:43:39,580 We're going to basically go through 1043 00:43:39,580 --> 00:43:41,560 the exact same thing again here in the movie. 1044 00:43:41,680 --> 00:43:42,820 Just sort of reiterate it. 1045 00:43:44,480 --> 00:43:46,020 We're just showing that, you know, 1046 00:43:46,060 --> 00:43:47,600 we tried to connect with remote desktop, failed. 1047 00:43:49,780 --> 00:43:51,660 Then we're going to go ahead and, you know, hop in here 1048 00:43:51,660 --> 00:43:51,940 and 1049 00:43:53,120 --> 00:43:54,240 this is our shell 1050 00:43:54,240 --> 00:43:55,500 that's on the actual remote box. 1051 00:43:55,600 --> 00:43:57,100 And we're going to move into the security database 1052 00:43:57,100 --> 00:43:59,240 where the actual local policy database is stored. 1053 00:43:59,920 --> 00:44:01,660 And create a copy of it, because remember 1054 00:44:01,660 --> 00:44:03,560 we like cleaning up. 1055 00:44:03,740 --> 00:44:05,100 You know, we're all about cleaning up. 1056 00:44:05,400 --> 00:44:06,720 So we want to 1057 00:44:07,580 --> 00:44:09,120 share this out and copy it. 1058 00:44:10,000 --> 00:44:11,880 And then we've pushed a registry 1059 00:44:11,880 --> 00:44:13,860 file, which allows us to toggle things on 1060 00:44:13,860 --> 00:44:15,660 because there are some settings that are controlled in the registry. 1061 00:44:15,880 --> 00:44:17,560 Some are controlled in the local policy database. 1062 00:44:18,640 --> 00:44:19,840 So we have two of those. 1063 00:44:19,940 --> 00:44:21,920 An INI that will allow us to push to the database. 1064 00:44:21,940 --> 00:44:23,680 And a reg file that will change it. 1065 00:44:24,520 --> 00:44:25,000 We've 1066 00:44:25,820 --> 00:44:28,180 we've made sure that we've turned terminal services on 1067 00:44:28,180 --> 00:44:29,640 via SC. 1068 00:44:31,940 --> 00:44:33,120 And we've now 1069 00:44:33,720 --> 00:44:34,720 seven minutes. 1070 00:44:35,080 --> 00:44:37,180 And then we've pushed the registry file 1071 00:44:37,180 --> 00:44:38,860 and then we're going to apply 1072 00:44:38,860 --> 00:44:41,660 well, first copy and then apply changes to the actual 1073 00:44:41,660 --> 00:44:42,500 new database 1074 00:44:42,500 --> 00:44:44,600 and push through it. 1075 00:44:53,600 --> 00:44:54,680 And we're forcing an update. 1076 00:44:54,760 --> 00:44:56,420 You have to use GP update to do these things 1077 00:44:56,420 --> 00:44:57,740 because local policy updates 1078 00:44:57,740 --> 00:44:59,540 are not transparent 1079 00:44:59,540 --> 00:45:01,520 and so you have to generally force a lot of the stuff 1080 00:45:01,520 --> 00:45:03,540 and we restart and re-verify everything. 1081 00:45:10,440 --> 00:45:11,860 And then we'll go ahead and log in with 1082 00:45:11,860 --> 00:45:12,260 Remote Desktop. 1083 00:45:14,340 --> 00:45:15,800 And huzzah, we have some Oracle 1084 00:45:15,800 --> 00:45:18,140 access, which is not something you can get on the command line. 1085 00:45:18,760 --> 00:45:19,860 At least in many 1086 00:45:20,560 --> 00:45:21,820 cases. And look normal. 1087 00:45:23,260 --> 00:45:23,920 Alright, we've 1088 00:45:23,920 --> 00:45:25,380 got about five minutes left, so 1089 00:45:26,780 --> 00:45:27,700 what I want to talk about 1090 00:45:27,700 --> 00:45:30,180 really briefly is abusing the scheduler. 1091 00:45:30,560 --> 00:45:31,940 And basically 1092 00:45:33,080 --> 00:45:33,920 a lot of 1093 00:45:33,920 --> 00:45:35,720 these techniques we're automating, we're putting into 1094 00:45:35,720 --> 00:45:36,800 Metasploit using modules. 1095 00:45:37,720 --> 00:45:39,840 And abusing the scheduler is, a lot of people will turn 1096 00:45:39,840 --> 00:45:41,700 off admin dollars so you can't get a show using 1097 00:45:41,700 --> 00:45:43,260 PSExec. They'll turn off 1098 00:45:44,100 --> 00:45:46,080 service control manager so you can't turn services 1099 00:45:46,080 --> 00:45:47,900 on and off. What we like 1100 00:45:47,900 --> 00:45:49,900 to do in that case is use at. At is 1101 00:45:49,900 --> 00:45:51,660 just a scheduling command. You can say 1102 00:45:51,940 --> 00:45:53,840 at that system, at this time, 1103 00:45:53,860 --> 00:45:55,900 run this command. So we've written some tools 1104 00:45:55,900 --> 00:45:57,760 to automate it that we're porting to Metasploit. 1105 00:45:57,860 --> 00:45:59,840 And we're just going to go ahead and go right into the demo since 1106 00:45:59,840 --> 00:46:00,780 we're almost out of time here. 1107 00:46:04,420 --> 00:46:04,780 Alright. 1108 00:46:05,700 --> 00:46:07,920 So, you know, currently this is just 1109 00:46:07,920 --> 00:46:09,540 a sort of a wrapper Perl script. 1110 00:46:10,180 --> 00:46:11,820 We have a bunch of parameters, so all the 1111 00:46:11,820 --> 00:46:13,760 different evil stuff we want to do, whether it's turning 1112 00:46:13,760 --> 00:46:15,140 on shares, adding accounts, 1113 00:46:16,380 --> 00:46:17,880 turning, disabling services, whatever 1114 00:46:17,880 --> 00:46:19,080 we put in here. 1115 00:46:19,980 --> 00:46:21,520 You can use lots of different file 1116 00:46:21,940 --> 00:46:23,600 types for protocols. We're using TFTP for 1117 00:46:23,600 --> 00:46:25,700 simplicity. That often is 1118 00:46:25,700 --> 00:46:27,040 detected on networks, so be careful. 1119 00:46:27,700 --> 00:46:29,680 We have a little config file. So basically 1120 00:46:29,680 --> 00:46:31,460 we're going to run our command 1121 00:46:31,460 --> 00:46:33,200 against a list of IP addresses. 1122 00:46:34,140 --> 00:46:35,760 And I've actually used this 1123 00:46:35,760 --> 00:46:37,720 with great success on really large pen tests 1124 00:46:37,720 --> 00:46:39,860 where everything is disabled on the network 1125 00:46:39,860 --> 00:46:41,780 except for at, but we have the admin 1126 00:46:41,780 --> 00:46:43,260 password so we can control it. 1127 00:46:44,220 --> 00:46:45,860 So basically what this is going to do 1128 00:46:45,860 --> 00:46:47,540 is it's going to connect to the target, 1129 00:46:47,760 --> 00:46:49,980 it's going to figure out what time it is at the target, 1130 00:46:50,120 --> 00:46:51,780 and then it's going to say, 1131 00:46:51,940 --> 00:46:53,820 okay, in one minute from whatever time it 1132 00:46:53,820 --> 00:46:55,420 currently is, run all these different commands. 1133 00:46:56,020 --> 00:46:57,480 So you can see basically it's 1134 00:46:57,920 --> 00:46:59,660 populating up, it's adding shares, 1135 00:47:00,200 --> 00:47:02,040 it's adding accounts, putting people 1136 00:47:02,040 --> 00:47:03,780 in the administrators group, turning off 1137 00:47:03,780 --> 00:47:05,640 antivirus, and it's going to do this 1138 00:47:05,640 --> 00:47:07,800 automated and fairly quickly over a large 1139 00:47:07,800 --> 00:47:08,460 number of hosts. 1140 00:47:12,880 --> 00:47:13,820 So yeah, we're 1141 00:47:14,360 --> 00:47:15,520 just about out of time. 1142 00:47:15,580 --> 00:47:16,740 We're going to go ahead and go to the 1143 00:47:17,540 --> 00:47:19,180 question and answer room in a minute here. 1144 00:47:21,940 --> 00:47:23,680 But yeah, basically just automating things 1145 00:47:23,680 --> 00:47:24,980 using scheduler is pretty cool. 1146 00:47:28,060 --> 00:47:29,820 Alright, so we want to thank 1147 00:47:29,820 --> 00:47:31,980 all the people from Offensive Computing 1148 00:47:31,980 --> 00:47:33,460 and Uninformed and Metasploit 1149 00:47:33,460 --> 00:47:35,740 and our different friends, Danny Quist 1150 00:47:35,740 --> 00:47:37,780 and Curb Klepto. Also 1151 00:47:37,780 --> 00:47:39,600 really seriously check out Luke Jennings. 1152 00:47:41,900 --> 00:47:43,760 Here's a couple of related talks that you might 1153 00:47:43,760 --> 00:47:45,660 want to consider checking out. Scape and 1154 00:47:45,660 --> 00:47:47,640 Spoonum released a talk called Beyond 1155 00:47:47,640 --> 00:47:49,480 EIP, which is on the 1156 00:47:49,480 --> 00:47:51,920 exploit side, the code side 1157 00:47:51,940 --> 00:47:53,840 of post-exploitation activities. Really good. 1158 00:47:54,080 --> 00:47:55,320 And Luke Jennings' talk. 1159 00:47:58,620 --> 00:47:59,980 Alright, thank you very much. 1160 00:48:00,120 --> 00:48:00,380 Thank you.