1 00:00:00,000 --> 00:00:05,780 Hey guys, as you already said, I'm Zach Faisal. I may talk a little fast, so if I get way too fast, slow me down. 2 00:00:08,000 --> 00:00:15,060 So, I'm a pen tester by day, DJ and photographer by night. You can find me on Twitter at ZFaisal. 3 00:00:15,880 --> 00:00:19,940 People always ask me, you know, what are your credentials, and well, there they are. 4 00:00:21,620 --> 00:00:26,080 I think it's bullshit when people list a shit ton of certs, but that's just me. 5 00:00:27,560 --> 00:00:32,260 So, yeah, I mean, judge me based on the quality of this talk, not based on a list of certs. 6 00:00:33,380 --> 00:00:36,680 So, quick shameless plugs. We have a little competition going on right now. 7 00:00:37,120 --> 00:00:41,660 There's another talk in track four going on from people from Chicago, too, and we're all from Chicago. 8 00:00:41,900 --> 00:00:44,560 So, I need a quick show of hands. How many people here are from Chicago? 9 00:00:46,340 --> 00:00:48,440 I think I lost the bet. Damn it. 10 00:00:50,680 --> 00:00:54,220 Also, poolside tonight, I'll be DJing in a battle against Keith Myers. 11 00:00:54,400 --> 00:00:55,680 So, if you're around here tonight. 12 00:00:56,080 --> 00:00:56,440 Come on by. 13 00:00:57,200 --> 00:00:59,940 ThoughtCon is a conference I run in Chicago, another hacking conference. 14 00:01:00,860 --> 00:01:03,740 We had about 500 people last year. We're looking to grow a little bit this year. 15 00:01:03,920 --> 00:01:05,100 More info at thoughtcon.org. 16 00:01:05,340 --> 00:01:07,580 And my local homeboys are the 312 crew. 17 00:01:08,600 --> 00:01:10,360 So, TLDR, what does this talk about? 18 00:01:10,560 --> 00:01:13,220 So, you don't spend the next hour here listening to me ramble. 19 00:01:13,980 --> 00:01:15,500 We're going to be talking about NTLM relay. 20 00:01:15,720 --> 00:01:17,780 Not pass the hash, but NTLM relay. 21 00:01:18,340 --> 00:01:19,920 And I'll touch on the difference in a second. 22 00:01:20,400 --> 00:01:25,740 And really, in the end, a new tool set to do cross-protocol relaying of NTLM authentication requests. 23 00:01:26,400 --> 00:01:31,680 As well as new methods to go ahead and get clients to automatically authenticate to us. 24 00:01:31,940 --> 00:01:36,400 And new targets we can relay these hashes to when we do the cross-protocol relaying. 25 00:01:37,440 --> 00:01:38,820 So, let's talk about NTLM. 26 00:01:39,000 --> 00:01:42,120 We're going to do a quick refresher for those of you who don't know what NTLM is. 27 00:01:42,500 --> 00:01:43,820 Hopefully in less than ten minutes. 28 00:01:44,240 --> 00:01:47,340 Any longer, well, it will be a talk about NTLM 101. 29 00:01:48,500 --> 00:01:51,240 So, what the hell is LM and NTLM? 30 00:01:51,660 --> 00:01:54,680 It's Windows password storage and network authentication. 31 00:01:55,140 --> 00:01:55,580 Uh. 32 00:01:56,080 --> 00:01:57,620 It's a protocol used in Windows, obviously. 33 00:01:58,420 --> 00:02:01,000 So, like I said, it was used for password storage and for authentication. 34 00:02:03,600 --> 00:02:05,420 So, god damn, my slides are out of order. 35 00:02:06,620 --> 00:02:09,660 For pass the hash, basically, oh, god, I need to jump around. 36 00:02:10,920 --> 00:02:12,060 So, hopefully you've seen this. 37 00:02:12,160 --> 00:02:13,820 These are the hashes for LM and NTLM. 38 00:02:14,480 --> 00:02:18,920 The LM is split into two seven-character chunks, all capitalized. 39 00:02:18,980 --> 00:02:20,820 So, we all know LM is bad, LM is weak. 40 00:02:20,980 --> 00:02:23,220 I'm not going to spend hours talking about why LM is bad. 41 00:02:23,380 --> 00:02:24,460 You all know it by now, hopefully. 42 00:02:24,620 --> 00:02:25,660 If not, Google. 43 00:02:26,120 --> 00:02:30,760 And an NTLM hash, obviously, is case sensitive, unlimited length, it's not seven-character 44 00:02:30,760 --> 00:02:32,780 chunks, a little stronger, but still has its problems. 45 00:02:34,080 --> 00:02:35,840 So, there's a few problems against it already. 46 00:02:36,600 --> 00:02:41,300 With LM and NTLM network hashes, there's a weakness we know as pass the hash. 47 00:02:41,960 --> 00:02:43,440 This talk isn't about pass the hash. 48 00:02:44,860 --> 00:02:45,400 Oh, wait. 49 00:02:45,620 --> 00:02:46,420 This is really odd. 50 00:02:46,520 --> 00:02:46,720 Sorry. 51 00:02:46,840 --> 00:02:47,460 I'm sorry, guys. 52 00:02:47,600 --> 00:02:48,840 I just did these like five minutes ago. 53 00:02:49,020 --> 00:02:49,400 Ha, ha. 54 00:02:50,100 --> 00:02:50,840 So, LM sucks. 55 00:02:51,080 --> 00:02:51,620 We've been over this. 56 00:02:52,920 --> 00:02:54,760 So, what the hell is NTLM auth? 57 00:02:54,920 --> 00:02:55,540 Not just the password. 58 00:02:55,660 --> 00:02:57,460 But the authentication going across the network. 59 00:02:57,880 --> 00:03:00,600 It's used for remote authentication requests against varying services. 60 00:03:00,860 --> 00:03:02,100 And we'll touch on those services in a minute. 61 00:03:02,320 --> 00:03:03,740 And it comes in a bunch of different flavors. 62 00:03:03,880 --> 00:03:08,000 And we can all get confused when we start talking about NTLM versus NTLM off, V1, V2, 63 00:03:08,440 --> 00:03:08,840 NTLM2. 64 00:03:09,220 --> 00:03:11,600 It gets really confusing whether there's signing or no signing. 65 00:03:11,780 --> 00:03:12,900 So, we'll kind of go over that real quick. 66 00:03:13,620 --> 00:03:17,540 So, when we do NTLM authentication, there's three messages that are sent. 67 00:03:17,920 --> 00:03:19,860 The type one, type two, and type three. 68 00:03:20,760 --> 00:03:24,980 Type one message is the client goes to the server and says I'd like to authenticate and 69 00:03:24,980 --> 00:03:25,620 here's what I support. 70 00:03:26,800 --> 00:03:30,860 So, as you can see, this is just a Wireshark capture chunked out a little bit. 71 00:03:31,020 --> 00:03:34,960 And it puts in there what the supported flags are as to how we can communicate for authentication 72 00:03:35,560 --> 00:03:39,600 as well as the workstation's name and the domain it belongs to. 73 00:03:41,380 --> 00:03:43,660 The server then responds with a type two message. 74 00:03:44,720 --> 00:03:47,460 Now, if you notice in type one message, we don't know who this user is yet. 75 00:03:47,640 --> 00:03:49,540 They just ask to connect and want to know what's supported. 76 00:03:49,760 --> 00:03:54,960 So, when the server responds, it uses the NTLM challenge, which is a server response. 77 00:03:54,960 --> 00:03:55,720 Server response challenge. 78 00:03:56,300 --> 00:03:57,840 This changes every time. 79 00:03:58,020 --> 00:04:01,540 And here in the screenshot, you'll see the static challenge that's used mostly for rainbow tables. 80 00:04:04,160 --> 00:04:08,040 So, server responds with a type two message saying, all right, here's what I support. 81 00:04:08,340 --> 00:04:09,260 Here's my domain name. 82 00:04:09,360 --> 00:04:10,040 Here's my host name. 83 00:04:10,200 --> 00:04:11,160 And here's a challenge. 84 00:04:11,520 --> 00:04:15,980 Use this challenge to salt your password hash with so it's unique every time and you can't 85 00:04:15,980 --> 00:04:17,920 replay it back over and over and over in the same request. 86 00:04:19,200 --> 00:04:21,440 So, then the client authenticates with a type three message. 87 00:04:22,220 --> 00:04:23,860 The type three message is basically 88 00:04:24,960 --> 00:04:30,660 the server challenge hashed with the password hash for the NTLM hash along with the user name, 89 00:04:31,460 --> 00:04:33,380 workstation name, and domain it belongs to. 90 00:04:34,460 --> 00:04:36,340 Session key if it's using session signing. 91 00:04:36,620 --> 00:04:40,960 And other flags to state whether the session is going to be supported for the authentication. 92 00:04:42,080 --> 00:04:44,060 So, that's NTLM version one. 93 00:04:44,320 --> 00:04:49,320 NTLM version two is pretty much the same except it adds additional parameters into the password 94 00:04:49,320 --> 00:04:52,980 response as well as a client challenge. 95 00:04:53,260 --> 00:04:54,440 So, we couldn't. 96 00:04:54,440 --> 00:05:01,380 As a prevention against rainbow tables, the client uses randomness to break the rainbow 97 00:05:01,380 --> 00:05:01,740 tables. 98 00:05:02,500 --> 00:05:03,420 So, we went over that. 99 00:05:04,540 --> 00:05:08,320 So, this is all great and dandy but we've got one more thing we need to talk about which 100 00:05:08,320 --> 00:05:09,280 is Windows integrated authentication. 101 00:05:10,940 --> 00:05:14,700 So, Windows integrated authentication is what's used in Windows in order to make sure that 102 00:05:14,700 --> 00:05:17,960 you don't have to keep logging in over and over with your password to connect to various 103 00:05:17,960 --> 00:05:18,320 services. 104 00:05:18,740 --> 00:05:22,340 So, if you think of every time you're on a domain, you connect to a network share or 105 00:05:22,340 --> 00:05:23,280 an internal web server. 106 00:05:23,420 --> 00:05:24,400 It doesn't ask you. 107 00:05:24,400 --> 00:05:29,640 It just queries the API and gets the information back from it as to what I should use to 108 00:05:29,640 --> 00:05:30,100 authenticate. 109 00:05:31,840 --> 00:05:36,640 So, for HTTP, it obviously protects against that using trusted security zones. 110 00:05:37,000 --> 00:05:41,980 It has to be within the trusted sites or an internal site which is checked by only having 111 00:05:41,980 --> 00:05:43,880 a one word name, not a full domain name. 112 00:05:44,580 --> 00:05:47,980 Now, the interesting thing about this, though, with the one word domain name, and again, 113 00:05:48,000 --> 00:05:52,180 this has all been covered before, I'm just doing a quick refresher, is that the one word 114 00:05:52,700 --> 00:05:54,020 domain name does a search. 115 00:05:54,400 --> 00:06:02,680 It first looks for the DNS name from DNS servers, then tries it with the DNS host name and 116 00:06:02,680 --> 00:06:03,380 works its way back. 117 00:06:03,600 --> 00:06:14,120 So, if your domain is domain server.domain.net, it checks word.domain server.domain.net, 118 00:06:14,260 --> 00:06:20,700 word.domain.net, and then does an NBNS, which is a broadcast request for that domain 119 00:06:20,700 --> 00:06:21,320 name lookup. 120 00:06:21,620 --> 00:06:24,380 It basically asks the network, hey, I'm looking for the DNS name. 121 00:06:24,380 --> 00:06:28,500 ACDB colon slash slash name, do you know who name is, and broadcasts across the local 122 00:06:28,500 --> 00:06:28,820 network. 123 00:06:28,980 --> 00:06:29,740 It's known as NBNS. 124 00:06:30,800 --> 00:06:32,760 As well as SMB everywhere, as I was saying. 125 00:06:33,140 --> 00:06:36,140 There's no restrictions where it automatically authenticates with SMB. 126 00:06:36,220 --> 00:06:37,820 It just automatically authenticates. 127 00:06:38,220 --> 00:06:41,300 And so we can see there's some problems with this if we're able to take and relay this. 128 00:06:42,180 --> 00:06:45,180 So there's some known issues, like I said already about this, the pass the hash stuff. 129 00:06:45,920 --> 00:06:48,500 Pass the hash uses the NTLM hash. 130 00:06:49,480 --> 00:06:53,340 As we look at the protocols for NTLM. 131 00:06:54,380 --> 00:06:56,520 The NTLM hash is used, not the original password. 132 00:06:56,780 --> 00:06:58,200 So all we need is the NTLM hash. 133 00:06:58,400 --> 00:07:02,640 Now we can access the NTLM hash using various tools and windows to gain access to the local 134 00:07:02,640 --> 00:07:07,740 system, password store, as well as memory, and access these password hashes from there. 135 00:07:08,060 --> 00:07:11,980 This is all covered in various other talks, but just a quick refresher to kind of show 136 00:07:11,980 --> 00:07:12,400 the differences. 137 00:07:13,340 --> 00:07:16,720 But the thing with this is it requires local admin access typically on the system. 138 00:07:17,720 --> 00:07:21,320 With this, when it gets local admin, you need to have existing access, obviously. 139 00:07:21,400 --> 00:07:24,360 You're not starting as a guest in order to access. 140 00:07:24,360 --> 00:07:26,940 The local memory store or the local password store. 141 00:07:27,240 --> 00:07:28,680 So what is NTLM relaying? 142 00:07:28,840 --> 00:07:30,920 How is it different from pass the hash? 143 00:07:31,240 --> 00:07:33,140 Everyone was asking me this over and over and over. 144 00:07:33,260 --> 00:07:34,240 Oh, you're talking about pass the hash. 145 00:07:34,380 --> 00:07:34,540 No. 146 00:07:34,760 --> 00:07:36,100 We're talking about NTLM relaying. 147 00:07:36,540 --> 00:07:41,060 So NTLM relaying requires no existing access on the network or on the system. 148 00:07:41,720 --> 00:07:44,360 Basically you get network connectivity either internally or externally. 149 00:07:45,040 --> 00:07:46,160 And you start as a guest. 150 00:07:46,600 --> 00:07:47,380 No credentials. 151 00:07:47,720 --> 00:07:48,980 No access to no systems. 152 00:07:49,480 --> 00:07:51,640 And it basically relays those authentication requests. 153 00:07:51,920 --> 00:07:54,200 Now if we step back to where we talked about the type one, type two, 154 00:07:54,360 --> 00:08:00,340 type three message, there's no kind of verification that the host calling or the 155 00:08:00,340 --> 00:08:01,940 destination host is the one you meant to talk to. 156 00:08:02,180 --> 00:08:04,060 And the host just kind of authenticates to it. 157 00:08:04,640 --> 00:08:08,980 So what we do then is we set up a rogue server to take these authentication requests in 158 00:08:09,480 --> 00:08:11,140 and relay them to another target server. 159 00:08:12,800 --> 00:08:15,400 So this has been around for a while, the NTLM relaying. 160 00:08:15,400 --> 00:08:16,040 It's nothing new. 161 00:08:16,140 --> 00:08:17,980 All of you are probably like, okay, we've heard about this. 162 00:08:18,000 --> 00:08:18,420 This is great. 163 00:08:18,980 --> 00:08:19,800 Why are you different? 164 00:08:20,020 --> 00:08:21,000 So let's tell a little story. 165 00:08:21,860 --> 00:08:22,800 So back in 96, 166 00:08:24,360 --> 00:08:25,600 was when it first kind of came out. 167 00:08:25,680 --> 00:08:28,600 In this paper called Weakness in CIFS Authentication by Dominique. 168 00:08:29,280 --> 00:08:32,400 That's kind of where they first talked about NTLM relaying as a possibility. 169 00:08:34,080 --> 00:08:38,040 In 2001, it really got traction with DillDog. 170 00:08:38,180 --> 00:08:40,620 Actually it was in 2000 was DillDog's NTLM replay. 171 00:08:41,220 --> 00:08:43,020 And statistics SMB relay. 172 00:08:43,220 --> 00:08:48,120 In which it did relaying back to NTLM or TELNET relaying the authentication back. 173 00:08:48,360 --> 00:08:53,140 And used a weakness in IE where you could say TELNET colon slash slash 174 00:08:53,140 --> 00:08:54,340 DIP and I'm not sure. 175 00:08:54,340 --> 00:08:59,660 And then SMB relay took advantage of bouncing SMB requests to other hosts as well as back 176 00:08:59,660 --> 00:09:00,000 to itself. 177 00:09:01,120 --> 00:09:06,020 It finally took until 2008 that Windows patched the weakness where you could bounce a NTLM 178 00:09:06,020 --> 00:09:07,580 authentication request back to itself. 179 00:09:08,420 --> 00:09:10,260 And that was in MS 08068. 180 00:09:11,300 --> 00:09:15,260 And so we couldn't bounce NTLM requests, network requests back to itself. 181 00:09:15,340 --> 00:09:18,100 But we could bounce them to other hosts still because of the way the protocol is designed. 182 00:09:18,840 --> 00:09:23,180 So in 2008, a guy who goes by the handle of Gruts, Kurt. 183 00:09:24,620 --> 00:09:28,600 Did his talk at DEF CON about NTLM is dead. 184 00:09:29,200 --> 00:09:33,960 And I thought that was one of the best talks that year because its impact in corporate 185 00:09:33,960 --> 00:09:34,740 environments is great. 186 00:09:34,860 --> 00:09:36,820 We can talk about mobile phones and how it affects everyone. 187 00:09:36,960 --> 00:09:40,440 But really the core data in corporate environments, it hurts. 188 00:09:41,460 --> 00:09:42,960 So he talked about writing this tool. 189 00:09:43,160 --> 00:09:44,680 Does NTLM relaying over HTTP? 190 00:09:45,840 --> 00:09:49,860 And he talked about the potential of doing it with, you know, as an SMB server as well 191 00:09:49,860 --> 00:09:51,160 to get these authentication requests. 192 00:09:51,500 --> 00:09:54,260 And so this was actually screenshotted two days ago. 193 00:09:54,340 --> 00:09:57,260 So it's still an open case on his Squirtle application. 194 00:09:58,120 --> 00:10:00,720 And I don't think he really has any intention of maintaining it. 195 00:10:00,840 --> 00:10:06,020 So I decided, you know, these weaknesses sound familiar over and over. 196 00:10:06,140 --> 00:10:09,300 We keep talking about these problems over and over and over and over and they're not 197 00:10:09,300 --> 00:10:09,820 getting fixed. 198 00:10:10,000 --> 00:10:13,700 Every environment still has pretty much NTLM enabled in corporate environments. 199 00:10:13,840 --> 00:10:16,200 So what does this sound like to me? 200 00:10:16,380 --> 00:10:20,000 Well, it kind of sounded like the problem we complained over and over and over about 201 00:10:20,000 --> 00:10:24,260 websites not doing SSL encryption for their authentication requests. 202 00:10:24,340 --> 00:10:25,400 As well as managing their cookies. 203 00:10:25,840 --> 00:10:27,820 So in 2010, FireSheep came out. 204 00:10:28,040 --> 00:10:29,320 Most of you are probably familiar with this. 205 00:10:29,820 --> 00:10:34,340 It was a way of capturing cookies and using the sessions I was able to capture over Wi-Fi 206 00:10:34,340 --> 00:10:37,540 or sniffing over the network and impersonate these users. 207 00:10:37,880 --> 00:10:40,260 And I asked myself, why did this have so much traction? 208 00:10:40,560 --> 00:10:42,760 Why did this all of a sudden make everyone change? 209 00:10:42,960 --> 00:10:44,500 Well, because it was so easy to use. 210 00:10:44,780 --> 00:10:49,360 It was so easy for just anyone to start up the application and impersonate someone. 211 00:10:50,860 --> 00:10:52,920 So I kind of decided to start on this goal. 212 00:10:52,920 --> 00:10:59,160 Make an application that you could do NTLM relaying and show the impact to people that's 213 00:10:59,160 --> 00:11:00,480 as easy as FireSheep. 214 00:11:01,060 --> 00:11:01,820 We're getting there. 215 00:11:03,060 --> 00:11:06,920 So basically, I started working on a lot of proof of concepts to see what extent does 216 00:11:06,920 --> 00:11:08,960 NTLM relaying support across multiple protocols. 217 00:11:09,380 --> 00:11:13,540 Like I said, a lot of people talked about it in theory, but no one actually implemented 218 00:11:13,540 --> 00:11:13,920 it. 219 00:11:16,560 --> 00:11:18,700 So the goal, like I said, is FireSheep for NTLM. 220 00:11:20,140 --> 00:11:22,900 So I decided to start learning Ruby because I was going to read a lot of stuff. 221 00:11:22,900 --> 00:11:26,840 I was originally integrated into Metasploit, and that didn't happen, and it went still 222 00:11:26,840 --> 00:11:27,060 Ruby. 223 00:11:27,660 --> 00:11:30,800 So my talk got rejected when I first submitted, both to BlackHand and DEF CON. 224 00:11:31,260 --> 00:11:35,180 But not just did it get rejected, but I got a fake acceptance email. 225 00:11:35,440 --> 00:11:37,480 A friend thought it would be funny to troll me. 226 00:11:40,060 --> 00:11:41,040 What a douche. 227 00:11:43,700 --> 00:11:49,920 He had a friend who actually took and had his talk accepted and sent the actual content 228 00:11:49,920 --> 00:11:52,680 of the email and forged the, you know, headers to be. 229 00:11:55,220 --> 00:11:58,580 And I thought for an hour and a half I was speaking at DEF CON, and then I got the email 230 00:11:58,580 --> 00:11:59,300 saying I was rejected. 231 00:12:01,700 --> 00:12:02,540 And that's the story. 232 00:12:02,660 --> 00:12:02,840 All right. 233 00:12:02,860 --> 00:12:03,660 Thanks for coming, guys. 234 00:12:07,080 --> 00:12:07,560 But no. 235 00:12:07,640 --> 00:12:10,320 Three weeks later, Nikita gets back to me and says, hey, we have a nobody on Sunday. 236 00:12:10,460 --> 00:12:11,200 Somebody dropped out. 237 00:12:11,340 --> 00:12:11,940 Do you want to speak? 238 00:12:12,100 --> 00:12:12,420 Awesome. 239 00:12:13,100 --> 00:12:13,420 Wait. 240 00:12:14,160 --> 00:12:15,700 I have three weeks until DEF CON? 241 00:12:17,040 --> 00:12:17,360 Shit. 242 00:12:18,560 --> 00:12:21,780 So keep that in mind as this tool is coming along, I kind of put it on the back burner 243 00:12:21,780 --> 00:12:22,880 and didn't work on it for a while. 244 00:12:22,880 --> 00:12:25,340 Quite a while between the submission and now. 245 00:12:25,540 --> 00:12:28,280 But we've got something working, and we'll talk more about that. 246 00:12:28,520 --> 00:12:29,220 So what's the problem? 247 00:12:29,360 --> 00:12:31,200 Why do we need another tool to do this? 248 00:12:31,280 --> 00:12:33,260 Why do we need another thing to do NTLM relaying? 249 00:12:34,380 --> 00:12:37,720 Well, the problem is other tools just didn't do what we need to do as a penetration tester. 250 00:12:38,540 --> 00:12:42,420 They really lacked the number of different protocols you could relay these authentication 251 00:12:42,420 --> 00:12:43,060 requests to. 252 00:12:43,380 --> 00:12:47,200 You know, a lot of them were SMB to SMB, HTTP to SMB, and no one was really branching 253 00:12:47,200 --> 00:12:49,100 out of that HTTP and SMB world. 254 00:12:49,360 --> 00:12:51,620 No one was going to LDAP, MSSQL. 255 00:12:52,340 --> 00:12:52,860 No one was really branching out of that HTTP and SMB world. 256 00:12:52,880 --> 00:12:55,300 Testing remote desktop or other stuff or VPNs. 257 00:12:55,360 --> 00:12:56,820 And I thought, you know what? 258 00:12:57,500 --> 00:12:59,960 The other big problem is that all of them sent it to one place. 259 00:13:00,520 --> 00:13:02,060 And we'll talk about why in a second. 260 00:13:02,320 --> 00:13:06,260 But they all forwarded every single request to one destination. 261 00:13:06,740 --> 00:13:08,140 That's noisy as all heck. 262 00:13:08,520 --> 00:13:12,460 We're getting users, we're getting machine accounts, and we're just sending all the 263 00:13:12,460 --> 00:13:13,940 authentication to one target. 264 00:13:15,180 --> 00:13:19,980 And I realize the reason why is we didn't know who the users were before the Type 3 message. 265 00:13:20,280 --> 00:13:22,600 And if you remember the Type 1, Type 2, Type 3 message, 266 00:13:22,880 --> 00:13:25,380 the Type 2 message is what specifies the challenge. 267 00:13:26,020 --> 00:13:28,020 The challenge is unique to every session. 268 00:13:28,320 --> 00:13:31,600 Now, I don't know who that user is until they send their Type 3, the last message. 269 00:13:31,760 --> 00:13:35,520 So I don't know what response from what server to relay on to them. 270 00:13:36,000 --> 00:13:38,480 Well, why aren't any of the other tools doing this? 271 00:13:38,680 --> 00:13:41,160 And so I looked more into the protocols for SMB and HTTP. 272 00:13:42,000 --> 00:13:44,640 And, well, we'll talk about that in a second. 273 00:13:46,240 --> 00:13:47,900 Oh, and it's not going away. 274 00:13:48,580 --> 00:13:52,860 Windows 8 and Windows 2012 still supports NTLM by default. 275 00:13:52,860 --> 00:13:58,040 And that's kind of scary that we know these protocol weaknesses are there, but NTLM is not 276 00:13:58,040 --> 00:13:58,480 going away. 277 00:13:58,660 --> 00:14:03,400 So we really need something to say, hey, as an organization, you need to, under your own 278 00:14:03,400 --> 00:14:07,080 accord, start protecting yourself against these attacks. 279 00:14:08,400 --> 00:14:09,720 So I wanted to be a problem solver. 280 00:14:10,900 --> 00:14:11,960 So here's a tool. 281 00:14:12,120 --> 00:14:13,320 It's called Zack Attack. 282 00:14:13,640 --> 00:14:16,360 Now, I know the name is so freaking lame. 283 00:14:16,640 --> 00:14:18,240 But we went through a list of different names. 284 00:14:21,300 --> 00:14:22,760 My favorite is the last one. 285 00:14:30,560 --> 00:14:31,820 So what's in this tool? 286 00:14:32,260 --> 00:14:33,860 And I'm blowing through these slides fast. 287 00:14:34,100 --> 00:14:36,280 So hopefully I have enough to keep you guys entertained for a while. 288 00:14:36,800 --> 00:14:39,420 So really, in this tool, there's a few different components. 289 00:14:40,060 --> 00:14:42,220 And we'll talk about all these components separately and how they integrate. 290 00:14:42,660 --> 00:14:45,160 So first of all, there's an HTTP and SMB server. 291 00:14:45,520 --> 00:14:49,100 Those are the servers that basically accept the authentication requests. 292 00:14:49,440 --> 00:14:52,660 So as clients get targeted to connect to this, 293 00:14:52,660 --> 00:14:55,440 rogue server, they authenticate and they keep them authenticating. 294 00:14:56,420 --> 00:14:59,120 We have a set of rules for automated exploitation. 295 00:15:00,400 --> 00:15:05,940 We have clients for these automated exploits as well as an API that we can tie into any 296 00:15:05,940 --> 00:15:08,420 other application we want to to do NTLM relaying. 297 00:15:09,200 --> 00:15:13,220 And finally, a generation of payloads to get these clients to automatically authenticate to us. 298 00:15:14,500 --> 00:15:15,880 So first off, these rogue servers. 299 00:15:16,060 --> 00:15:18,980 We want to get people and we want to get them authenticating to us. 300 00:15:19,100 --> 00:15:20,680 And we'll talk about how we're going to get them in a second. 301 00:15:20,880 --> 00:15:22,380 But we've got to have them authenticate to something. 302 00:15:22,380 --> 00:15:22,600 Right? 303 00:15:23,320 --> 00:15:26,000 So the first thing is we need to keep these users authenticating. 304 00:15:26,420 --> 00:15:29,840 A lot of the existing tools will disconnect after the first successful authentication. 305 00:15:30,720 --> 00:15:36,360 So what this tool, Zack Attack, finally does is it keeps them authenticating as much as possible. 306 00:15:37,500 --> 00:15:42,600 Now, on Windows LAN for SMB, I think that's about 30 times before the connection terminates. 307 00:15:43,580 --> 00:15:46,880 So we need to figure out who this user is, too, when we're keeping them authenticating. 308 00:15:46,980 --> 00:15:49,640 So the first authentication request is with a static challenge. 309 00:15:49,860 --> 00:15:51,020 That 1, 1, 2, 2, 3, 3. 310 00:15:51,120 --> 00:15:52,360 For those of you who pen tests, you know this. 311 00:15:52,360 --> 00:15:53,520 It's kind of the rainbow table challenge. 312 00:15:54,920 --> 00:15:56,520 And we need to figure out who this user is. 313 00:15:56,700 --> 00:15:57,920 Like I said, we don't know until type 3. 314 00:15:58,280 --> 00:15:59,400 So we send a static challenge. 315 00:16:02,820 --> 00:16:05,720 So with this, I like to call this the Alzheimer's feature. 316 00:16:06,820 --> 00:16:10,220 It basically forgets who the user is and asks them to reauthenticate every time they connect 317 00:16:10,220 --> 00:16:11,260 without closing the session. 318 00:16:12,280 --> 00:16:18,080 And the reason we do this is because HTTP, WPAD and other requests don't always support cookies. 319 00:16:18,760 --> 00:16:22,300 As well as identifying them over SMB using an IP and 320 00:16:22,360 --> 00:16:25,000 source doesn't work if you're doing it across the Internet behind a NAT. 321 00:16:26,460 --> 00:16:31,160 So for the HTTP server, the way we coded this out was doing a 302 redirect with keep alive. 322 00:16:31,420 --> 00:16:34,720 Now, keep alive will keep the session open so the socket's not closing. 323 00:16:35,260 --> 00:16:38,360 After we authenticate them, we know who they are and we know who they are for the rest of that 324 00:16:38,360 --> 00:16:38,700 session. 325 00:16:40,560 --> 00:16:42,000 For SMB, it was a little more rough. 326 00:16:42,240 --> 00:16:43,940 I had to write a custom SMB server. 327 00:16:44,140 --> 00:16:45,580 Now, that's not any easy task. 328 00:16:45,780 --> 00:16:47,620 And it's a little buggy still, but it works. 329 00:16:48,340 --> 00:16:52,340 So after they authenticate and it does a set up an X connection, for those of you who don't know, 330 00:16:52,340 --> 00:16:55,540 for those of you who aren't familiar with it, I'm not going to go too in depth into the SMB 331 00:16:55,540 --> 00:16:55,820 protocol. 332 00:16:56,100 --> 00:16:57,660 That would be a whole other two hours. 333 00:16:59,220 --> 00:17:03,040 But after it gets the authentication request, it kind of forgets who they are and says, 334 00:17:03,180 --> 00:17:04,680 oh, hey, great, nice to meet you again. 335 00:17:04,920 --> 00:17:05,200 Cool. 336 00:17:05,320 --> 00:17:06,040 Oh, I want to connect. 337 00:17:06,260 --> 00:17:06,980 Wait, who are you again? 338 00:17:07,100 --> 00:17:08,620 And starts the authentication request over. 339 00:17:12,440 --> 00:17:15,520 So we need to get these authentication requests coming to that HTTP and SMB server, right? 340 00:17:16,500 --> 00:17:19,440 And a lot of people have asked, you know, how do you ‑‑ do you do man in the middle? 341 00:17:19,560 --> 00:17:19,880 What do you do? 342 00:17:19,960 --> 00:17:22,320 Well, there's a few different ways we can get people authenticating to our server. 343 00:17:22,340 --> 00:17:23,960 To then bounce them to other stuff. 344 00:17:26,260 --> 00:17:28,580 So what payloads are we going to have in this tool? 345 00:17:28,740 --> 00:17:30,260 Well, first off, there's obviously WPAD. 346 00:17:30,420 --> 00:17:33,660 Now, WPAD, I didn't want to write a whole other NBNS spoofer for those of you who are 347 00:17:33,660 --> 00:17:34,180 familiar with it. 348 00:17:34,800 --> 00:17:36,960 But WPAD is the Web Proxy Auto Detect. 349 00:17:37,860 --> 00:17:40,880 In Windows, when you try to connect, you know, with that little check mark, automatically 350 00:17:40,880 --> 00:17:42,200 find my connection settings. 351 00:17:42,640 --> 00:17:45,240 It sends a request out looking for the name WPAD. 352 00:17:45,900 --> 00:17:48,860 Checks DNS and then checks broadcasting to the network. 353 00:17:49,240 --> 00:17:52,320 Now, you can spoof these requests and respond to them. 354 00:17:52,320 --> 00:17:57,220 By default in Windows, the machine will automatically authenticate to the WPAD server over HTTP 355 00:17:57,830 --> 00:17:59,580 with the currently logged in user's credentials. 356 00:18:01,360 --> 00:18:02,660 So that's great. 357 00:18:02,860 --> 00:18:06,780 You've got to be internal to the network typically or, you know, spoof NBNS or spoof 358 00:18:06,780 --> 00:18:07,160 the DNS. 359 00:18:07,820 --> 00:18:08,500 Wasn't me. 360 00:18:10,320 --> 00:18:12,220 But what about social engineering people? 361 00:18:12,580 --> 00:18:15,800 Now, for a while, pen testers have known about using Internet Explorer and putting 362 00:18:15,800 --> 00:18:18,920 in image tags for a UNC network path. 363 00:18:19,320 --> 00:18:21,760 And then Internet Explorer would pass that back to Windows. 364 00:18:21,760 --> 00:18:25,280 And automatically connect to that network share in an attempt to get that image or whatever 365 00:18:25,280 --> 00:18:25,620 it may be. 366 00:18:25,760 --> 00:18:26,280 It could be JavaScript. 367 00:18:26,600 --> 00:18:27,600 It could be an iFrame, et cetera. 368 00:18:28,200 --> 00:18:30,140 Now, in IE, it automatically authenticates. 369 00:18:31,640 --> 00:18:34,800 But for a while, everyone's solution was Firefox and Chrome. 370 00:18:34,920 --> 00:18:38,440 And you'll see kind of the recurring theme here is people have had kind of haphazard 371 00:18:38,440 --> 00:18:42,880 solutions for this because we didn't fully understand all the remediations for it. 372 00:18:43,340 --> 00:18:44,760 So what about Firefox and Chrome? 373 00:18:44,820 --> 00:18:46,780 We could do, oh, well, Firefox and Chrome are protected. 374 00:18:46,860 --> 00:18:48,160 And you'll see a screenshot here. 375 00:18:48,240 --> 00:18:51,580 This is actually Firefox's error console saying, sorry, can't load. 376 00:18:51,760 --> 00:18:54,980 You know, that network share, you know, it's not in my security context. 377 00:18:55,080 --> 00:18:56,080 It's in file security context. 378 00:18:57,880 --> 00:18:59,420 So that's been the case until now. 379 00:18:59,680 --> 00:19:03,460 So that's one of the cool new things about this tool is that for Firefox and Chrome, 380 00:19:03,540 --> 00:19:07,760 we found out that you can force downloads, obviously sending headers for a forced download. 381 00:19:07,960 --> 00:19:11,060 And all of a sudden, you open it from your temp folder or you open it from your desktop, 382 00:19:11,140 --> 00:19:12,940 and you're now in the file security context. 383 00:19:13,600 --> 00:19:17,100 And voila, it automatically authenticates to the SMB share. 384 00:19:17,720 --> 00:19:19,800 And you've got them authenticating to your rogue server. 385 00:19:21,860 --> 00:19:25,960 But what about, you know, if they won't click to download or open from temp? 386 00:19:26,140 --> 00:19:28,780 Well, could we get it so when they just view a page, they automatically authenticate? 387 00:19:29,060 --> 00:19:29,580 You betcha. 388 00:19:30,100 --> 00:19:33,200 So it turns out there's these things called plug-ins for Firefox and Chrome. 389 00:19:33,420 --> 00:19:36,900 And these plug-ins phone back to other applications, so on and so forth. 390 00:19:38,220 --> 00:19:42,780 And it turns out that QuickTime is the one that I kind of came across as most often installed 391 00:19:42,780 --> 00:19:43,860 by users by default. 392 00:19:44,160 --> 00:19:47,660 You know, there's probably dozens of other extensions, but most commonly you'll see people 393 00:19:47,660 --> 00:19:50,920 with iTunes with their iPhones and all and QuickTime installed with it. 394 00:19:51,940 --> 00:19:56,000 So as I went through a list of different applications, and QuickTime popped up, I thought, 395 00:19:56,060 --> 00:20:01,020 well, how do I get QuickTime to connect to a rogue network server to get the users logged 396 00:20:01,020 --> 00:20:02,620 in, user name and password? 397 00:20:03,720 --> 00:20:10,140 And so after a little tinkering, we found out that you can put a playlist together with 398 00:20:10,140 --> 00:20:14,540 a UNC network path and they'll automatically authenticate and they'll bypass the local 399 00:20:14,540 --> 00:20:15,260 security context. 400 00:20:15,860 --> 00:20:20,140 So you need to do a little more work into other plug-ins. 401 00:20:20,660 --> 00:20:26,080 But for now, really quick time I think is one of the bigger impacts for that. So another 402 00:20:26,080 --> 00:20:29,900 way we can get people to automatically authenticate to our rogue server is over e‑mails. Some 403 00:20:29,900 --> 00:20:34,320 people may already know about this, others not so much, but in Outlook, if you have an 404 00:20:34,320 --> 00:20:38,640 HTML e‑mail and inside of it is a network share, it will automatically connect and authenticate. 405 00:20:39,420 --> 00:20:44,500 That's pretty cool. What about .docs? The whole office suite is actually like this. 406 00:20:44,800 --> 00:20:49,000 Embed an image or an HTML file, open it up, it will automatically connect to that network 407 00:20:49,000 --> 00:21:00,840 share. One of the other things is the desktop.ini files. This, again, wasn't made as well known, 408 00:21:00,920 --> 00:21:06,200 but it's been out there, is that you can generate desktop.ini files to save the icon resource 409 00:21:06,200 --> 00:21:11,840 or the wallpaper for that folder is a network share. And again, the system will automatically 410 00:21:11,840 --> 00:21:17,860 connect, attempt to get that icon and log in with the currently used credentials. And 411 00:21:17,860 --> 00:21:18,980 LNA files. 412 00:21:21,720 --> 00:21:27,020 You can set other parameters in there to automatically connect. So the tool set automatically 413 00:21:27,020 --> 00:21:31,040 creates these desktop.ini files, creates the HTML files really quick, really easy. 414 00:21:31,380 --> 00:21:35,680 And obviously the last one is man in the middle. You can redirect NTM authentication 415 00:21:35,680 --> 00:21:39,920 requests or inject HTML content in the page. While the tool doesn't do this, it helps with 416 00:21:39,920 --> 00:21:45,260 it. But that's the ways you can get clients connecting to these rogue servers to do the 417 00:21:45,260 --> 00:21:48,960 relaying. So the existing tool sets out there that do NTM relaying, you can use that to do a 418 00:21:48,960 --> 00:21:53,680 relaying over SMB or HTTP. You can use all these today to go ahead and use other tools 419 00:21:53,680 --> 00:21:55,100 to get them authenticating to you. 420 00:21:56,660 --> 00:22:00,340 So one of the cool things that I thought about Squirtle, the tool I kind of used as a starting 421 00:22:00,340 --> 00:22:04,320 point for this, was that it did API requests where you could use any tool you wrote to 422 00:22:04,320 --> 00:22:10,660 get these type 2 and type 3 messages. And so with the type 3 messages, that's the final 423 00:22:10,660 --> 00:22:13,740 authentication request. You need to pass the type 2 to the API and get the type 3 back. 424 00:22:14,120 --> 00:22:18,840 So I wrote up an API quick so you can use any tool set you want, any tool you can modify 425 00:22:18,960 --> 00:22:25,940 the source code of and use the rogue servers to connect. Well, that's great. But that requires 426 00:22:25,940 --> 00:22:28,600 you to have some interaction when you're a pen tester, you're testing people. 427 00:22:31,340 --> 00:22:36,240 So what I wrote together that's new for different than any other tool is a set of rules. All 428 00:22:36,240 --> 00:22:39,220 the other relay tools, like I said, forward everything to one source. Now we're identifying 429 00:22:39,220 --> 00:22:44,580 who these users are. So to really show the impact, I wanted to have it so with one click, 430 00:22:44,740 --> 00:22:47,240 like I said, in 60 seconds, you could get domain admin. 431 00:22:48,980 --> 00:22:54,240 So with that, you know, we write these rules out then in the new application to say when 432 00:22:54,240 --> 00:22:57,640 we figure out this user belongs to a group and they may have access over here, do something 433 00:22:57,640 --> 00:23:00,960 automatically when they connect. No longer do we have to try to get them to connect 434 00:23:00,960 --> 00:23:05,820 and wait and hope they come back around. But as soon as you see a user, do this. So the 435 00:23:05,820 --> 00:23:10,160 rule set is pretty simple and I'll show it in the UI in a little bit. If a user is in 436 00:23:10,620 --> 00:23:15,820 a certain group, then use this module, whether it be whatever the client is, SMP, HTTP, 437 00:23:19,540 --> 00:23:27,720 we good? I just hear fuzz. I didn't touch anything, I swear. Okay. So no, we're not so 438 00:23:27,720 --> 00:23:38,180 good. Better? Okay. Swear I didn't touch it. So we write these rule sets basically to say if a 439 00:23:38,180 --> 00:23:41,820 user is in this group and they're in this module to perform this action against these targets. 440 00:23:42,040 --> 00:23:46,440 And should we do it just once per every user? But I'll show that in a second. So the rule sets 441 00:23:46,440 --> 00:23:48,940 kind of go through this sequence of automatically looking for the user, looking for the user, 442 00:23:48,960 --> 00:23:52,500 looking for these API requests, looking for these unruly rules and keep doing it. Keep going 443 00:23:52,500 --> 00:23:58,340 through this until it times out. And if it times out, keep the user authenticating by not letting 444 00:23:58,340 --> 00:24:03,360 them time out and disconnecting them but doing a stack challenge. So the things we can connect 445 00:24:03,360 --> 00:24:07,900 to, we've always had this kind of grid showing that, you know, you can use SMB to connect to 446 00:24:07,900 --> 00:24:14,940 SMB, HTTP to connect to HTTP, so on and so forth doing the NTLM relaying. So the problem was 447 00:24:14,940 --> 00:24:18,940 that people didn't touch a lot of other protocols. And so I decided to take a look at these protocols. 448 00:24:21,480 --> 00:24:26,460 LDAP, MSSQL. Now, I'll touch on why LDAP is kind of awesome in a minute. But MSSQL, cool, we can 449 00:24:26,460 --> 00:24:34,220 get databases, we can get access to the data. Awesome. So SMB with the clients, we wanted to do 450 00:24:34,220 --> 00:24:38,360 some actions automatically as soon as we connected. So one of the big things is there's no tool 451 00:24:38,360 --> 00:24:42,580 out there to enumerate users and groups. Well, sorry, I take that back. There was no tool. There 452 00:24:42,580 --> 00:24:47,080 is now through Metasploit which was released at BlackHat this year. Two of us were working on 453 00:24:47,080 --> 00:24:48,940 kind of separate projects and weren't talking. So there's no tool out there to enumerate users and 454 00:24:49,700 --> 00:24:53,380 groups and didn't know about each other either. So you can enumerate users and groups. Now you 455 00:24:53,380 --> 00:24:57,060 may be like why, it doesn't matter, I can enumerate stuff, whatever. Well, as a penetration tester, 456 00:24:57,200 --> 00:25:00,780 it's one of those things you can figure out the administrators and the local administrators 457 00:25:00,780 --> 00:25:05,220 group as well as further information about what groups and what users you need to target. Cool, 458 00:25:05,300 --> 00:25:09,880 great. We can do NTLM relaying and do enumeration. We can also access file shares. We can 459 00:25:09,880 --> 00:25:15,480 execute commands. But this is great and all, but we can't connect to domain controllers. And the 460 00:25:15,480 --> 00:25:18,940 reason being is that most domain controllers by default have SMB signing. So we can't connect to 461 00:25:18,960 --> 00:25:21,300 domain controllers. Now for those of you who aren't familiar with SMB signing, SMB signing 462 00:25:21,300 --> 00:25:27,740 basically uses the original NTLM hash to sign the session. And so every packet is signed. If 463 00:25:27,740 --> 00:25:33,520 there's a signature is off, it takes and, you know, disconnects you. So by default domain 464 00:25:33,520 --> 00:25:37,260 controllers have SMB signing by default. So by default you can't do SMB relaying to a domain 465 00:25:37,260 --> 00:25:42,180 controller. Now this pissed me off. I had to figure out there had to be some way we could get 466 00:25:42,180 --> 00:25:48,940 there really fast, really easy. So I'll come back to that. So I'm going to go back to the 467 00:25:48,960 --> 00:25:53,300 main thing. So it turned out LDAP is enabled by default on domain controllers, yes, and uses 468 00:25:53,300 --> 00:25:59,420 NTLM authentication it turns out. And that's cool. That's great. But we couldn't change 469 00:25:59,420 --> 00:26:04,040 passwords because typically it requires SSL and SSL is enabled in LDAP unless there's a 470 00:26:04,040 --> 00:26:09,400 certificate of authority set up for the domain. So great. We can also do this with what's written 471 00:26:09,400 --> 00:26:15,760 in the tool that you can change user passwords, reset users, add users, enumerate the domain, 472 00:26:15,880 --> 00:26:18,940 all that cool stuff. But the really cool thing is without LDAP, you can't do that. So we can't 473 00:26:18,960 --> 00:26:23,160 do SSL without any of this using NTLM relaying. We can add users to groups. So if as a tester 474 00:26:23,160 --> 00:26:27,760 you're able to take and connect and get another user's account, we can take and add them to a 475 00:26:27,760 --> 00:26:32,120 domain administrator's group if we get a domain admin and so on and so forth. But going back to 476 00:26:32,120 --> 00:26:36,440 SMB real quick. One of the other cool things about this tool that kind of bugged me was that we 477 00:26:36,440 --> 00:26:40,760 always had to use certain tools to do this. So on the plane ride down here, I decided to hammer 478 00:26:40,760 --> 00:26:44,580 and tinker with some stuff. It's four hours from Chicago, give or take. It's United, so it'll 479 00:26:44,580 --> 00:26:48,940 take a little time. So took and wrote a SOX project. So I'm going to go ahead and show you 480 00:26:48,960 --> 00:26:52,900 the SOX proxy. So for those of you who aren't familiar with SOX, it's a proxy that sends raw 481 00:26:52,900 --> 00:26:57,060 data back and forth, doesn't reparse it. So on the way down, wrote a SOX proxy that says 482 00:26:57,060 --> 00:27:03,380 replacing the NTLM packets with the relay data. That's pretty cool. It's unique, new. And 483 00:27:03,380 --> 00:27:07,880 again, HTTP, we can relay it to SharePoint, some internal websites, great. All of this is 484 00:27:07,880 --> 00:27:12,940 kind of, you know, that's cool, but you have to be inside the network. And a lot of people think 485 00:27:12,940 --> 00:27:17,880 that NTLM relaying is not a problem because you have to be internal to the network. But what 486 00:27:17,880 --> 00:27:18,940 about externally? You know, you have to be inside the network. You have to be inside the network. 487 00:27:18,940 --> 00:27:24,320 Sometimes there's a SharePoint, but typically not too often. And so I thought about what's one 488 00:27:24,320 --> 00:27:33,000 thing that is most organizations have open externally that supports NTLM. And it turns out 489 00:27:33,000 --> 00:27:37,960 Exchange Web Services. For those of you who are not familiar with Exchange Web Services, it's 490 00:27:37,960 --> 00:27:42,600 kind of an HTTP API that's usually on the same server as Outlook Web Access, your web mail and 491 00:27:42,600 --> 00:27:48,920 all. And by default, it uses HTTP negotiate, which supports NTLM. So it's kind of an 492 00:27:48,940 --> 00:27:54,340 internal service. But with that, we're able to do relaying externally to an HTTP service, which 493 00:27:54,340 --> 00:28:00,460 is, yeah, Exchange Web Services. So this becomes a little more scary as people have been talking 494 00:28:00,460 --> 00:28:04,740 about how you have to be internal to an organization to do relaying. We can now take and target 495 00:28:04,740 --> 00:28:11,340 mobile workforce users who are at a mobile hotspot or target people over the Internet if they 496 00:28:11,340 --> 00:28:15,800 don't have outbound firewall rules to connect back to a rogue SMB server, as we talked about, the 497 00:28:15,800 --> 00:28:18,920 rogue server, and get them to auto authenticate to the server. So that's one of the things that's 498 00:28:18,920 --> 00:28:23,240 interesting about this Exchange Web Services. And with this, we can pull all their emails, all 499 00:28:23,240 --> 00:28:26,640 their contacts, their calendar, anything you can do through Exchange Web Services. And why? 500 00:28:26,860 --> 00:28:30,720 Because everyone's got a mobile phone connecting back to Exchange Web Services and ActiveSync. 501 00:28:34,560 --> 00:28:41,220 I wish I had a drink, because I would drink right now. The demo got fucked. And I'm going to 502 00:28:41,220 --> 00:28:45,080 get booed like no other, but oh, thank you, sir. 503 00:28:52,860 --> 00:29:02,300 You are a gentleman and a scholar. Fuck. No, honestly, I had a demo set up to do Exchange Web 504 00:29:02,300 --> 00:29:08,360 Services, show NTLM relaying to Exchange Web Services as well as doing other stuff. So the 505 00:29:08,360 --> 00:29:15,360 problem is all my VNs got fucked. So instead I'll show just the GUI on it. That's the code. Here we go. 506 00:29:15,520 --> 00:29:16,520 So this is the GUI to it. 507 00:29:18,920 --> 00:29:23,380 I'll run through this real quick so you can kind of get an idea of its functionality and how powerful it can be as you grow. 508 00:29:24,000 --> 00:29:29,700 So right now what's running is the rogue HTTP server, the rogue SMB server, and an HTTP management server. 509 00:29:31,600 --> 00:29:40,780 With this we define what users are in what groups. Yeah, cool. So it keeps track of what users connected at what time. 510 00:29:40,920 --> 00:29:48,840 I hope that's big enough. Can people read that or no? Back row? Sort of? Good. So it keeps track of the users 511 00:29:48,920 --> 00:29:53,440 that are connecting back. Now you can keep having users connect back and it has who are the users connected back right now. 512 00:29:53,720 --> 00:30:00,880 Now you'll see there's some system accounts, there's some actual user accounts, and with this we can just in one click say enumerate a target 513 00:30:00,880 --> 00:30:08,440 over SMB, get their e-mails from Exchange Web Services, execute a shell to a session if they're an admin, access a file share as them, 514 00:30:09,200 --> 00:30:16,860 access their SharePoint, et cetera. Again, the VM got fucked so we can't really show all that much. But we can then create rules, like I said. 515 00:30:16,960 --> 00:30:17,920 We can add users to groups. 516 00:30:18,920 --> 00:30:25,340 We can do this automatically through enumeration or we can manually add them to a group and create a group called, say, Moo. 517 00:30:26,660 --> 00:30:37,520 Cool, great. We have now a user. Oh, crap. There it goes. Like I said, the demo gods do not like me. 518 00:30:44,980 --> 00:30:45,660 Fucking Ruby. 519 00:30:49,920 --> 00:30:58,160 Three, two, one, done. So it's very much alpha. I'm sorry, guys, but I had three weeks to code this all out. 520 00:30:59,620 --> 00:31:10,960 So we can add a user to, again, to group. Yarr. Cool. And so we've got this user in this group, Yarr. 521 00:31:11,340 --> 00:31:14,880 We can also, like I said, enumerate from the domain controller all the different user groups. 522 00:31:15,620 --> 00:31:17,580 So then we can create these rules to automatically authenticate. 523 00:31:17,580 --> 00:31:22,080 So in this case, I already have a rule in here. So if you see a user in group, users, Yarr. 524 00:31:22,480 --> 00:31:27,360 Then connect over Exchange Web Services to targets and target groups. Right now there aren't any. 525 00:31:27,660 --> 00:31:33,400 But we can easily add one, say, 10.1.10.2.50 to target group. 526 00:31:36,280 --> 00:31:44,460 Now as soon as it sees an authentication request from someone who's in that user group, it will automatically connect to there and pull all the emails from folder inbox, folder drafts. 527 00:31:44,520 --> 00:31:47,560 We can easily add saying, here's another folder. Let's pull their sign-in. 528 00:31:50,320 --> 00:31:51,800 And voila, it adds that rule. 529 00:31:52,300 --> 00:31:57,780 Now what's cool about this tool is that as it does this authentication request, a lot of tools keep having you re-authenticate. 530 00:31:58,580 --> 00:32:02,580 What it does is it keeps the session open when it connects to this rogue and performs this action. 531 00:32:02,780 --> 00:32:07,500 So instead of re-authenticating every time it tries to get the inbox, it keeps the session alive so you don't have to re-authenticate. 532 00:32:07,740 --> 00:32:13,840 So we have about 30 requests coming in from the system. 533 00:32:13,920 --> 00:32:16,840 So we can set about probably 30 rules in the first try. 534 00:32:18,480 --> 00:32:22,000 And then in that one connection, perform various actions. 535 00:32:23,700 --> 00:32:28,040 And like I said, we can repeat it for all the users and all the targets we connect or just certain targets. 536 00:32:28,820 --> 00:32:33,020 Now at the same time, we can generate the payloads, like I said. 537 00:32:33,220 --> 00:32:37,340 Generating the HTML, the desktop.ini, the doc, LNK file, zip file. 538 00:32:37,460 --> 00:32:39,360 The LNK file doesn't work. It just says how to do it. 539 00:32:39,920 --> 00:32:41,920 As well as generate the HTML email automatically. 540 00:32:42,200 --> 00:32:44,000 So I'm trying to make it as simple as possible. 541 00:32:44,120 --> 00:32:46,220 Like I said, the fire sheep of NTLM, Bruleng. 542 00:32:47,580 --> 00:32:51,880 And finally, it keeps track of all the user hashes like it did before and the static authentication. 543 00:32:52,700 --> 00:32:54,700 And so you can try to crack the passwords as well. 544 00:32:56,780 --> 00:33:01,260 So since the demo is fucked, that's about the best I can show right now for a demo. 545 00:33:02,260 --> 00:33:04,120 And I'm sorry. I'm really sorry, guys. 546 00:33:04,200 --> 00:33:06,420 I'm so pissed that it went to shit on the plane. 547 00:33:08,720 --> 00:33:11,240 So how do we protect ourselves against this? 548 00:33:13,080 --> 00:33:17,560 Really, everyone's had varying solutions for how to protect against this. 549 00:33:19,140 --> 00:33:19,580 And... 550 00:33:23,080 --> 00:33:24,320 I lost this slide. 551 00:33:24,920 --> 00:33:26,700 People have said use NTLM version 2. 552 00:33:26,900 --> 00:33:28,480 The tool supports NTLM version 2. 553 00:33:28,580 --> 00:33:31,900 There's nothing different about NTLM version 2 than NTLM version 1 that we can't relate. 554 00:33:32,680 --> 00:33:37,320 So really the thing you need to do right now if you're a sysadmin is go home and firewall outbound 445. 555 00:33:37,740 --> 00:33:43,260 This will prevent anyone from sending you any of these rogue payloads and getting you to automatically authenticate out of the environment. 556 00:33:43,400 --> 00:33:45,540 But that doesn't protect against mobile workforce, et cetera. 557 00:33:46,900 --> 00:33:47,560 So when do you do that? 558 00:33:47,560 --> 00:33:51,780 In Windows 7 there's a group policy you can set to limit who you can authenticate to you over NTLM. 559 00:33:52,600 --> 00:33:54,640 And everyone said the solution is Kerberos. 560 00:33:54,700 --> 00:33:55,740 Kerberos, Kerberos, Kerberos. 561 00:33:55,840 --> 00:33:56,180 It is. 562 00:33:56,460 --> 00:34:00,980 But the problem is telling an organization you have to switch everything to Kerberos today is not going to work. 563 00:34:01,440 --> 00:34:04,000 The problem is there's a lot of stuff that doesn't support Kerberos. 564 00:34:05,760 --> 00:34:09,140 The other thing is that if you enable Kerberos, you have to force Kerberos. 565 00:34:09,220 --> 00:34:10,440 You can't support NTLM at all. 566 00:34:10,760 --> 00:34:11,780 Same thing with signing. 567 00:34:11,980 --> 00:34:16,720 For those of you who don't know, signing, every packet is signed and then by the original password. 568 00:34:16,720 --> 00:34:17,080 Hash. 569 00:34:18,820 --> 00:34:26,440 So with SMB signing, LDAP signing, HTTP, extended authentication, it all has to be forced, not just supported. 570 00:34:26,700 --> 00:34:30,140 And that's a big misconception that people have is that I enable signing, that should be fine. 571 00:34:30,320 --> 00:34:32,340 You have to force it, which in turn breaks a lot of stuff. 572 00:34:32,520 --> 00:34:39,480 So before you go out there trying to fix NTLM relaying and NTLM issues in your organization, test, test, test, test, test, test. 573 00:34:39,760 --> 00:34:41,400 Because it will break a lot of legacy stuff. 574 00:34:42,320 --> 00:34:45,500 So really there's a lot of balance you have to take when you're trying to. 575 00:34:46,720 --> 00:34:48,340 Protect yourself against it as an organization. 576 00:34:48,700 --> 00:34:50,540 As end users, typically you don't have to worry about this. 577 00:34:50,660 --> 00:34:56,380 But when you're a corporate sysadmin, the big issue is that you need to move away from NTLM. 578 00:34:57,040 --> 00:34:58,760 It's really something that's going to take time. 579 00:34:59,700 --> 00:35:04,040 But Windows 8 and Windows 2012 still supports it and still has it enabled by default. 580 00:35:04,960 --> 00:35:08,360 So we need to go out there and start moving away, move to Kerberos. 581 00:35:08,520 --> 00:35:10,800 And hopefully this tool will be the one that kind of kicks that off. 582 00:35:12,680 --> 00:35:16,180 So the code will be posted on Tuesday when I get back home. 583 00:35:17,020 --> 00:35:19,140 To this website, Git Hub, all this stuff. 584 00:35:19,620 --> 00:35:26,360 This website URL, in case you don't want to take a photo or write it down, is on the DEF CON DVD as my slides. 585 00:35:27,580 --> 00:35:28,940 Check it out if you haven't looked at it yet. 586 00:35:30,080 --> 00:35:34,320 Otherwise, if you have any questions or want to tell me how shitty my talk is or how shitty the demo was. 587 00:35:35,700 --> 00:35:37,360 There's my email, and you can bitch at me on Twitter. 588 00:35:39,320 --> 00:35:39,640 So, 589 00:35:47,100 --> 00:35:49,100 Thank you.